File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes smtp host in java mail program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "smtp host in java mail program" Watch "smtp host in java mail program" New topic

smtp host in java mail program

him kal

Joined: Feb 25, 2001
Posts: 1
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

Joined: Jan 07, 1999
Posts: 6920
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.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: smtp host in java mail program
It's not a secret anymore!