Email received sent via webmail but not Javamail
I'm trying to send emails via Javamail to a corporate account. My Java test app works fine when I send message to gmail and my personal email. I can also successfully send to the corporate account via my email hosting webmail client.
I've read through posts here and have tried setting -Djava.net.preferIPv4Stack=true in the VM for the test app but it did not work.
I have checked the junk mail at the corporate client and the message is not there. That is not to say its not being blocked elsewhere at the corporate site.
Any ideas what can be causing this problem?
I'm using org.apache.commons.mail.HmtlEmail and this is the test code:
// Create the email message HtmlEmail email = new HtmlEmail(); email.setHostName(smtpHost); email.setAuthenticator(new DefaultAuthenticator(smtpUser, smtpPwd)); email.setSSLOnConnect(true); email.addTo(to); email.setFrom(from); email.setSubject(subject); // set the html message email.setHtmlMsg(text); // set the alternative message email.setTextMsg("Your email client does not support HTML messages"); // send the email email.send();
So @Bill's question regarding Javamail debug output got me thinking about the content of the email message. The debug log shows all is fine but what I found was I included Bootstrap and Fontawsome JS / CSS links in the email header and that caused the message to be rejected by the corporate system for security reasons presumably. Thanks for the help