Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There were a few questions, so here are a few answers:</p> <p>Try adding the following to your code -- they make things work better in Gmail:</p> <pre><code>properties.put("mail.smtp.socketFactory.fallback", "false"); properties.put("mail.smtp.ssl.enable", "true"); </code></pre> <p>and make sure your Authenticator is something like this:</p> <pre><code>javax.mail.Authenticator auth = new javax.mail.Authenticator(){ protected PasswordAuthentication getPasswordAuthentication(){ return new PasswordAuthentication(username,password); } }; </code></pre> <p>Google still has some sending limits. They are pretty high, but that's all subjective. If that doesn't work, here are a few more answers:</p> <p>Java will allow you to send mail straight from your application. However, this will rarely if ever make it past email spam filters. So even though you <em>can</em> send it without the SMTP, it is not recommended. One of the main reasons these emails are blocked is because the ip address that sent the email isn't one of the valid <a href="http://en.wikipedia.org/wiki/MX_record" rel="nofollow">MX records</a> for that domain. SMTP makes it possible to send mail from a "trusted" source, and usually that means making it past spam filters. </p> <p>With all that in mind, your other option, as you mentioned, is to make a local email server. However, that email server needs an MX Record for the "from" domain. <a href="https://support.google.com/a/answer/33353?hl=en&amp;ref_topic=1611273" rel="nofollow">Google provides a pretty comprehensive set of instructions for how to set that with the different DNS providers (all listed down the left side)</a>. i.e. if your from address is you@yourdomain.com, then yourdomain.com needs to have an MX Record pointing to the server that hosts your email server.</p> <p>Hope that helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload