Sending email in Java

I read that in order to send email in Java, I need to get my ISP SMP address, but if I intend to host my web application on the Internet, would that be my host SMTP address?

EDIT: So, I need to find out my clients' SMTP addresses and send through that?

+1


source to share


3 answers


JavaMail is a built-in API for email.

Ask your ISP if the host is running sendmail or equivalent locally (web server host). This can be advantageous to send to sendmail as early as possible. In other words, try "localhost" as the SMTP server name.



Why? JavaMail is a simple SMTP client. It does not handle DNS MX records. It does not have a built-in mail queue capability if the SMTP server is not available. There it defaults to Java infinte DNS cache so that DNS change on SMTP host is not logged in your application (configurable, but one more setting). This is what the local sendmail process (or equivalent) will do.

So if you can send email to local sendmail / equivalent, that can improve the reliability of email delivery. Let's assume local sendmail is running, of course. This is how we are configuring some native applications that use JavaMail to send mail and has fixed all of the above issues.

+4


source


Not unless your web host is the same as your ISP and your web host also offers SMTP services.



In response to your edit, yes, you need your SMP address for the sound of things provider.

+3


source


This will be the SMTP address that you want to send by email.

If you want to send email through your ISP account, then that will be SMTP.

+1


source







All Articles