File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Mail server on localhost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Mail server on localhost" Watch "Mail server on localhost" New topic

Mail server on localhost

Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
I am writing a program that sends emails. It works on production where email server is setup. In my program I have
localhost as the I would like this program to work on the tomcat server installed on my desktop so I can debug and make some changes. Is there any way I can use some other smtp servers (like to send emails so it works on my development environment? Or is there any way I can install and use something like Java E-mail Server or any other email servers on my localhost. Any suggestions highly appreciated.
Thank you very much.
Krithika Srinath
Ranch Hand

Joined: Apr 11, 2006
Posts: 52
Tomcat is a Web Server with its main functionality as Servlet container. If you are looking for SMTP services, then you might need to configure mail server for these services. Take a look at Apache's james server.

Hope this helps.
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
Thanks. I am going to give james a try. Hope they have the installation and setup instructions.
siva kumar
Ranch Hand

Joined: May 02, 2004
Posts: 120

I happen to use apache james for testing in one of my earlier projects.

It is really cool and the instructions are very easy and simple. You should'nt have problem running it.

Also you can use other trial version mailservers from net but I forgot their name

But James is really kool and does support task like multilingual mails ect which I had problems with other trial versions.

James is free and fully functional and cannot be any better.
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
Thanks for all the posts. It is very encouraging. I downloaded James and going thru the documentation. The configuration section says:
"James needs to have access to a DNS server for domain resolution. The out of the box configuration assumes that there is a DNS server on localhost."
But I don't have a DNS server on my localhost. What to do? Any suggestions appreciated.
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
dns name listed when
>ipconfig /all
should be fine I guess. I will let you know how it goes.
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
I am having trouble setting up james server. I am able to startup the server. I am able to create users.
I am getting the following message when I startup:
James Mail Server 2.3.1
Remote Manager Service started plain:4555
POP3 Service started plain:110
SMTP Service started plain:25
NNTP Service started plain:119
FetchMail Disabled

When I am trying to telnet james I am getting the following message:
C:\>telnet james-server 25
Connecting To james-server...Could not open connection to the host, on port 25: Connect failed

Anybody know what is wrong?

Given below is my dns server and servernames configuration:


<!-- Change autodiscover to false if you would like to turn off autodiscovery -->
<!-- and set the DNS servers manually in the <servers> section -->

<!-- Maximum number of entries to maintain in the DNS cache -->

siva kumar
Ranch Hand

Joined: May 02, 2004
Posts: 120
Hi Alex,

Sorry I couldnt help on your problem.... but do you really need a DNS server for your mail-server to bind upon, your localhost setting should do the trick,

in fact I didn't configure anything in my computer for DNS setting I just following the instructions provided in the following wiki and it seems to work perfectly on my computer
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
I did follow the exact same doc. But when I do
telnet localhost 25
I am not getting the result explained in the document. Instead this is what I am getting
220 machneName SMTP Server (JAMES SMTP Server 2.3.1) ready Mon, 1 Oct 2007 16:03:29 -0400 (EDT)
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

That seems like a perfectly reasonable response for an SMTP server to send. Why do you think it is a problem?
It is sorta covered in the JavaRanch Style Guide.
subject: Mail server on localhost
Similar Threads
SocketException with JavaMail
Aspirin Cannot Send Mails
free smtp service
What if i don't have any SMTP email Server
Hi, trying to get spring-struts example to work...