This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Connecting to SMTP server with user name and password Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Connecting to SMTP server with user name and password" Watch "Connecting to SMTP server with user name and password" New topic
Author

Connecting to SMTP server with user name and password

Rames Raja
Greenhorn

Joined: Jan 27, 2003
Posts: 7
Hi,
I am trying to send mail using SMTP server in java.
But my SMTP only allows valid users to send mails so I need to pass my user name and password to my SMTP server.
How do I do this ?
Thank you
Ramesh
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Ramesh,
so u have a valid username/password for the email domain right?
then u can use,
Properties prop = new Properties();
prop.setProperty
("mail.smtp.host","mail.yourhost.com");
prop.setProperty("mail.user","yourusername");
prop.setProperty("mail.password","yourpassword");
session = Session.getDefaultInstance(prop,null);
hope this helps
regards
maulin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connecting to SMTP server with user name and password
 
Similar Threads
JavaMail e-mail goes to Junk E-mail
Send mail using JavaMail API by connecting to another network
Need Information about sending email Please
basic question about smtp server
Authentication with SMTP Server