This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connecting to SMTP server with user name and password

 
Rames Raja
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic