Search code examples
javaandroidemailjakarta-mailoutlook.com

Send mail to @hotmail.com/@live.com with JavaMail


I develop a application on android to send email. I want to use account MSN to send mail but it not send and error code on debug as below: enter image description here

My configure on property are:

systemProperty.put("mail.smtp.starttls.enable","true");
systemProperty.put("mail.smtp.auth", "true");
systemProperty.setProperty("mail.host", "smtp.live.com");
systemProperty.put("mail.smtp.port", "587");

The password and email address are correct and i ever test with other host are work except MSN.


Solution

  • It looks like JavaMail isn't able to figure out your host name correctly, although I don't know why it would think "????" is your host name. Set the mail.smtp.localhost property to the correct host name for your machine. See the javadocs for the com.sun.mail.smtp package for details.