Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

smtp host in java mail program  RSS feed

him kal
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m a bit confused on setting SMTP host while sending email thru my java mail program. What I do is:
1.Properties props = new Properties();
props.put("", "");
2.I get the following console output:
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s
mtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG: SMTPTransport trying to connect to host "", port 25
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Could not connect to SMTP host:, port: 25;
nested exception is: no further information (code=10051)
at javax.mail.Transport.send0(Compiled Code)
at javax.mail.Transport.send(
at Mail.sendMail(
at MailMessage.main(

I might be using wrong smtpHost.
I use as my POP server and I can pop mails from to my outlookexpress (win98). But for some reason I m not able to send mails from outlook thru this POP.
I read on softhome that some ISP block port #25 to check spamming. I connect to internet via netzero and but in vain.
Incidentally, when I was in india and my ISP was and I could send mail thru the same javaMail program using "props.put("", "");" Even I used to POP mail from into my outlook.
Frank Carver
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to look at your outlook settings for the SMTP host instead of the POP3 host. The fact that a system offers POP3 (or IMAP) says nothing about whether it also offers SMTP. Typically POP3 or IMAP are used by you to collect mail which has been sent to you, while SMTP is used by you to send mail.
If you can successfully send mail from outlook, then outlook must be set up with a valid SMTP host, you just need to find out what it is.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!