Reputation: 1887
I am following answer no 8 from the following post:
it is working fine for the gmail. but not working for hotmail and yahoo. i define following smtp server
SMTP Server for hotmail:
smtp.live.com
SMTP Server for yahoo:
plus.smtp.mail.yahoo.com
how this code work for hotmail and yahoo?
Upvotes: 1
Views: 1673
Reputation: 2356
I am able to send mail using this code: Make sure you perfectly checked your smtp port and smtp host.
enter code here
private String mailhost = "smtp.mail.yahoo.com";
// private String mailhost = "plus.smtp.mail.yahoo.com";
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "25");
Upvotes: 0
Reputation: 33792
Read about :
Note the port numbers and other details
for example, hotmail
private String mailhost = "smtp.live.com";
and
props.put("mail.smtp.port", "587");
props.put("mail.smtp.socketFactory.port", "587"); // because of SSL
Upvotes: 4