I am not sure do i need to configure some mail server (like james) to send email from java api like explained at this Java email send code example
3 Answers
No but its not a good idea. When you want to use javax.mail session you need a mail server which accepts smtp connection from your app. This is preffered why.
But you could also write a socket based adapter which directly tries to deliver the mail to the receivers mail server by connecting by smtp and handle the protocol your self. That is theoreticaly, because most email server would not accept your application, because there spam protection will block you.
So my advice is. Don't think to much about this. Use a locale mailserver like james or one of the millions smtps proxies out there for development. And later in production change configuration to a well setup mailserver (most called MTA) where you can be sure that your mails will be delivered.

- 2,660
- 15
- 24
yes :) in this example it is installed at localhost, so mail is passed to another service within the same box. of course, you can use an external server, too - for example if you have a development system home, than utilize the mail server of your ISP.

- 11
- 2
You do not need to set up one yourself. Mail providers, such as GMail
and Outlook
for instance, expose their own mail servers which you can use to transmit email messages.
Note however that in such cases, email transmission might eventually be blocked so as to discourage the delivery of SPAM mail.

- 51,780
- 5
- 72
- 96
-
Got your point. But my point is we need mail server whether it is provided by me or somebody else like gmail/outlook right? – emilly Apr 18 '15 at 13:46
-
@emilly: As far as I know yes. – npinti Apr 19 '15 at 09:46