views:

598

answers:

3

I have read that to send email in Java I need to obtain my ISP's SMTP address, but if I am intending to host my web app online, will this be my hosts ISP SMTP address?

EDIT: So I need to find out my clients ISP's SMTP address and send via this?

+3  A: 

No, unless your webhost is the same as your ISP or your webhost also offers SMTP services.

In response to your edit, yes you need your ISP's SMTP address by the sound of things.

Dan Vinton
+1  A: 

It will be the SMTP address you want to forward email through.

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

Graphain
+3  A: 

JavaMail is the built-in API for e-mail.

Ask your ISP if the host runs sendmail or equivalent locally (the web server host). It may be an advantage to hand off to sendmail as early as possible. In other words, try "localhost" as the SMTP server name.

Why? JavaMail is a simple SMTP client. It doesn't deal with DNS MX records. It doesn't have a built-in capability to queue mail if the SMTP server is unavailable. There's the default Java infinte DNS cache so that a DNS change to the SMTP host won't register with your app (tunable, but one more tuning to do). These are things that a local sendmail (or equivalent) process will do.

So if you can hand off the e-mail to a local sendmail/equivalent, that may improve e-mail delivery reliability. Assuming the local sendmail works, of course. It's how we configure some in-house apps that uses JavaMail to send mail and fixed all the above problems.

John M