3
votes

I am building a mail client and I would like to know if my session is able to support all kind of smtp connections... although I don't really know what can I expect from there

I would like to confirm if the following is correct

1 - For SMTP I will only need the host:

props.put("mail.smtp.host", host);

Don't I need user and pass?

2 - For SMTPS I will need to set the tls or is it always true? What about ssl?

I'm a little bit noob about the mail protocols so I would really appreciate some help on this topics.

1

1 Answers

4
votes

I would recommend spending some time with the JavaMail FAQ, which has more resources to help you get started.

To answer your immediate questions...

  1. Whether you need a username and password or not depends on your mail server. Most public mail servers do. Some company-internal mail servers do not.
  2. "smtps" is "smtp over an SSL connection". Officially, "TLS" is just the standard version of "SSL", but in this context when people refer to "TLS" they're usually referring to the "STARTTLS" command. The STARTTLS command allows you to make a plain text (non-SSL) connection, and then switch that connection to use SSL (TLS). You don't need this if you're using the "smtps" protocol since it makes an SSL connection to begin with.