Sending email from servlet

R

Rhino

I'd like to send the occasional email from Java servlets but I'm struggling
to figure out the best way to do that in 2010.

I am trying to get some older servlets working again after a long absence
from Java. One of the tasks that some of my servlets did occasionally was
to send emails. It seems I used to use a jar that I got from the O'Reilly
website, dated 2002, which I have long since lost after a hard drive crash.
I'm not having any luck finding it at the O'Reilly site now and I'm
guessing that it's out of date anyway at this point.

Can anyone point me to a modern example of how to send email with a
servlet, as well as where I can find the jar(s) needed, assuming that they
aren't built into Java somewhere?

I've been googling for examples but most are undated, use the same O'Reilly
jar that I was using (without supplying a working link where I can get it
again), or are very old.
 
R

Rhino

I'd like to send the occasional email from Java servlets but I'm
struggling to figure out the best way to do that in 2010.

I am trying to get some older servlets working again after a long
absence from Java. One of the tasks that some of my servlets did
occasionally was to send emails. It seems I used to use a jar that I
got from the O'Reilly website, dated 2002, which I have long since
lost after a hard drive crash. I'm not having any luck finding it at
the O'Reilly site now and I'm guessing that it's out of date anyway at
this point.
FWIW, I found a newer version of the O'Reilly classes that I'd been using
before at http://www.servlets.com/cos/. This one is dated Dec 26, 2008 so
it is clearly much fresher.
Can anyone point me to a modern example of how to send email with a
servlet, as well as where I can find the jar(s) needed, assuming that
they aren't built into Java somewhere?
I've been googling for examples but most are undated, use the same
O'Reilly jar that I was using (without supplying a working link where
I can get it again), or are very old.

It looks like my old code compiles okay with the new jar although some
things got deprecated since 2002. I'll have to go through the API and see
what code changes I need to make. I'll be back if I can't figure them out.
 
M

Martin Gregorie

Can anyone point me to a modern example of how to send email with a
servlet, as well as where I can find the jar(s) needed, assuming that
they aren't built into Java somewhere?
JavaMail? Its a standard Sun/Oracle package.
 
A

Arne Vajhøj

I'd like to send the occasional email from Java servlets but I'm struggling
to figure out the best way to do that in 2010.

I am trying to get some older servlets working again after a long absence
from Java. One of the tasks that some of my servlets did occasionally was
to send emails. It seems I used to use a jar that I got from the O'Reilly
website, dated 2002, which I have long since lost after a hard drive crash.
I'm not having any luck finding it at the O'Reilly site now and I'm
guessing that it's out of date anyway at this point.

Can anyone point me to a modern example of how to send email with a
servlet, as well as where I can find the jar(s) needed, assuming that they
aren't built into Java somewhere?

I've been googling for examples but most are undated, use the same O'Reilly
jar that I was using (without supplying a working link where I can get it
again), or are very old.

Support for sending email is built into Java EE, so no need
for any third party package at all.

It can be a problem for Java SE apps - they need to get
a separate JavaMail package, but in servlet context you
already have JavaMail.

There are lots of JavaMail examples on the net available, but
if you have a specific problem (multipart, HTML format, attachments
etc.) then ask and I will see if I have an example on the shelf.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,979
Messages
2,570,185
Members
46,728
Latest member
FernMcmull

Latest Threads

Top