Java: Sending mails using Java Mail

b4u

Golden Member
Nov 8, 2002
1,380
2
81
Hi,

I have to do some tests with Java MailSession connection to an SMTP and SMTP authenticated server.

At this point, I only have a local web server, which doesn't have access to the SMTP servers (my local IP does not have access).

Is there any software around that can emulate an SMTP server (authenticated and non-authenticated one)?

Something that can work on my local machine, and I would point my MailSession to localhost.

Thank you.
 

Tea Bag

Golden Member
Sep 11, 2004
1,575
3
0
If your webserver's on a *nix variant, you could use SendMail.

If not, I've used James Server to do it, it's a Java-based SMTP server. It's fairly easy to install and configure, you can set it to send to localhost and even sink the messages so they don't spam a bunch of people when you've got huge distribution lists while testing.

EDIT: on more of a 'emulation' tangent - you could try taking a look at this Mock-JavaMail, this looks like it might be better for testing quickly, but as a disclaimer I haven't tried it.