11

Can anybody explain me what this line means in JavaMail API?

props.put("mail.smtp.host", host);

It is used to setup a mail server, but I don't understand it.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
simplyblue
  • 2,279
  • 8
  • 41
  • 67
  • How was my answer in your previous question insufficient? http://stackoverflow.com/questions/2957299/help-configuring-a-mail-server-for-use-with-mail-jar-and-activation-jar – BalusC Jun 02 '10 at 13:08

2 Answers2

6

The String variable host contains the DNS name of a server that accepts connections on port 25 for SMTP. Adding this property to the props collection, which is in turn passed into Javamail, tells Javamail what host to send the mail to, initially.

You might also see something that helps in this answer.

Community
  • 1
  • 1
bmargulies
  • 97,814
  • 39
  • 186
  • 310
  • hhey can u give me an example..!!plz..!! – simplyblue Jun 02 '10 at 12:44
  • yes..i did read it...but im trying to send a email with java code..i have configured a smtp server with my gmail account..!! after that i cant understand what to do...!! i am unable to understand the string variable "host" .plz explain me how to do it..! i dont know how to assosiate my java code with mail server..plz..plz hellp...!!! – simplyblue Jun 02 '10 at 12:51
0

This value helps Javamail to understand to which server it has to hit for DNS name. Its ususally through a port opened( default 25).

GustyWind
  • 3,026
  • 3
  • 41
  • 50