1

I am using javamail api in java servlet to send mail. It seams to send mail only to gmail Id's, whereas I want it to be able to send to any email ID. Do I require different property value here? I followed http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/ to develop the code. The property values are:

props.setProperty("mail.smtp.host", "smtp.gmail.com");

props.setProperty("mail.smtp.port", "587");

props.setProperty("mail.smtp.auth", "true");

props.setProperty("mail.smtp.starttls.enable", "true");

mrig
  • 382
  • 1
  • 4
  • 21
  • After little testing, it seems like there is problem with for sending mail to a particular server only. It worked fine with yahoo, gmail, live. – mrig Oct 29 '12 at 05:39

2 Answers2

1

No , There is no need to change configurations what you have ,Here it will act as server(Gmail) from there you can send mail to any mail servers(yahoo,hotmail and etc..).

sunleo
  • 10,589
  • 35
  • 116
  • 196
0

You can send mail to any email ids. You can mention them in TO address or CC or BCC, check your authentications are correct.

Here is an detailed example from an existing post how to send an email from jsp/servlet?

Hope this can help you

Community
  • 1
  • 1
vels4j
  • 11,208
  • 5
  • 38
  • 63