Configure Mercury mail transport system for external mail
Usually I develope my projects locally on my pc. Needless to say that you sometimes have to send an email from your script to external mail to check if everything is fine. So you need to configure your system in a way that your local apache webserver is able to send mail to external addresses.
I always use XAMPP for Windows because it contains everything you need for developing PHP applications as well as all the stuff for sending mails: fake sendmail und Mercury Mail Transport System. I reference to XAMPP 1.6.5 (for Windows) and Mercury 4.5 here. Mercury is already pre-configured in XAMPP - all settings that I don't explicitly address stay as they are
I'm writing this because I'm not a mail professional and read a lot of tutorials and none of them really worked. So I extracted what I needed and put it all together. An important assumption for this tutorial is that you have your own SMTP server, for example the one that your webspace hoster provides.
So let's get started:
- start Mercury (using the XAMPP Controlpanel) and then open the admin panel.
- first of all we disable the HTTP server of Mercury so that it doesn't conflict with the apache:
- "Configuration" -> "Protocol modules"
- disable the check "MercuryB HTTP web server"
- I also disabled "Mercury IMAP4rev1 server" because I won't need that one
- leave the window opened, we'll need it immediatly
- to be able to send external mail we have to disable "MercuryE SMTP end-to-end delivery client" in the same dialog and enable "MercuryC SMTP relaying client". Click "OK" and restart Mercury!
- now let's configure Mercury in general:
- "Configuration" -> "Mercury core module", tab "General"
- we want to send from localhost, therefore we check if "localhost" is the value of "internet name for this system" and adjust that if not
- all other settings stay the same as they are already configured, but we'll have a look to the checkboxes beneath:
- disable all but "Send copies of all errors to postmaster"
- check under the tab "Local domains" if the entry "localhost (local host or server) localhost (internet name)" is there, if not, add it
- click "OK" and leave the dialog
- next we focus on the MercuryS SMTP Server for outgoing emails:
- "Configuration" -> "MercuryS SMTP Server"
- choose the tab "General" and add a wonderful name for your SMTP server under "Announce myself as", simply fill in any name, I've chosen "CS SMTP".
- under "Listen on TCP/IP port" fill in "25", that's the SMTP port
- add "127.0.0.1" to "IP interface to use", that's the local IP of your pc. With the IP of the pc within the network (192.168.0.X) it doesn't work (at least for me)
- now we limit the access to the server so that only our local machine can access it:
- under "Connection Control" click on "Add restriction" and add the IP range from "127.0.0.1" till "127.0.0.1" (it's that simple, isn't it?)...
- and select "Allow connections"...
- and leave all checkboxes deselected
- with a click on "OK" we quit the dialog and we're looking forward to the next one
- now let's configure the MercuryP POP3 Server:
- "Configuration"-> "MercuryP POP3 Server", select the tab "General"
- "Listen on TCP port" -> "110" and "IP interface to use" -> "127.0.0.1"
- choose the tab "Connection control" and proceed as already written under 5.5 (see above)
- that's it already, leave the dialog by clicking "OK"
- now we have the important one "MercuryC SMTP Client"
- "Configuration" -> "MercuryC SMTP Client"
- to send mail to external addresses we need to have an external SMTP server. If you're renting webspace somewhere and have mail included then you normally have access to a SMTP server. My webspace is hosted at HostEurope and I'll use the SMTP of my domain. Without such an external server the whole thing won't work because domain names won't be resolved among other things. I've chosen this path because I didn't feel like configuring around the whole day.
- enter the address of your SMTP under "Smart host name", for example "mail.meinedomain.com"
- depending on the way you access the server fill the values under "Connection port/type":
- for a "normal" SMTP that would probably be port 25 and "Normal (no SSL encryption)"
- I access my SMTP via SSL, that would be port 465 and "SSL encryption using direct connection"
- if you have other parameters simply try around a little
- we finally fill in the "Login username" and the "Password" that normally is supplied by your webhost and we've nearly finished...
- let's check the Mercury users that are normally pre-configured:
- "Configuration"-> "Manage local users"
- there should be at least the users "Admin" and "postmaster", both with administrative rights. If not you have to add them.
- now we finished with Mercury, but we still need to configure PHP for sending mail with our scripts:
- we search and open the appropriate php.ini, using XAMPP you find it under "xampp/php/php.ini" in newer version and under "xampp/apache/bin/php.ini" in older versions
- we search for "[mail function]"...
- and we add/adjust the following:
- "SMTP = localhost"
- "smtp_port = 25"
- "sendmail_from = postmaster@localhost"
- save the php.ini and restart the Apache
- now everything should work! But we'll test it first:
- within Mercury choose "File" -> "Send mail message" and send an email for testing purposes, I've chosen to send it to my googlemail account
- if the windows in Mercury are at sixes and sevens, choose "Window" -> "Tile" enjoy the view
- within the window "Mercury Core Prozess" we'll see our test mail at first:
- "13:38:41 JOB XXXXXX: from postmaster@localhost (local) To: XXX@googlemail.com (non-local) (JOB XXXXXX) -OK"
- the mail was received in Mercury and processed, after some seconds the window "Mercury SMTP client (relay version)" should show some actions:
- "05 Jan 2008 13:39, Servicing job XXXXXX ...OK"
- if you see this message, everything went fine and the mail was sent!
- if you don't get the message you have to find out why, possible reasons could be:
- wrong connection values for the SMTP server
- SMTP server doesn't allow relaying (from your host)
- now we'll test the whole thing from a PHP script and we'll write a wonderful one-liner into a PHP file:
- "mail('xxx@googlemail.com', 'Mercury test mail', 'If you can read this, everything was fine!');"
- call the PHP file within your browser, a command window should pop up shortly (or maybe not), it's from the fake sendmail of XAMPP, and focus back on Mercury:
- the produre is the same as above only that the SMTP server receives the mail from php before everything else happens
- you can watch this in the window "Mercury SMTP Server" and should see something like this: Mercury SMTP
I hope that worked for you, if not, feel free to leave a comment but as I already said, I'm not a professional but I'll help you as far as I can!
EDIT:
If you get the error message "SMTP server response: 553 We do not relay non-local mail, sorry." while sending from PHP go to Mercury under MercuryS -> Connection Control -> "Uncheck Do not Permit SMTP relaying to non-local mail" an check this option. Should fix the problem. Thanks to ron!

Hallo ich habe ein problem und zwar zeigt mir mercury an ds die email erfolgreich verschickt worden ist aber sie kommt nie auf meine email adresse , woran kann es liegen ?
Hallo Alex,
Ganz vielen Dank, dass du dir die Mühe gemacht hast, alles zusammenzuschreiben und zu erklären. Deine Anleitung ist wirklich die beste weit und breit. Nach 3 Tagen Recherche im Internet ist deine Seite eine wahre Erlösung gewesen.
Jetzt kann ich endlich mit dem starten, was ich eigentlich machen wollte, nämlich eine neue Website!
Liebe Grüße aus Österreich,
Michaela
Hm, erlaubt dein Emailanbieter das Versenden von externen Emails?
Hallo,
ich habe beim PHP Mailversand ein Problem: Mercury reagiert überhaupt nicht. Der direkte Versand über Mercury funktioniert jedoch.
D.h. im Mercury wird gar nichts angezeigt? Mit welcher PHP-Methode versendest du Emails?
It’s the best tutorial on this subject I have found on web. Thanks a lot!
Regarding step 7 of the procedure , I do know the name of my SMTP server. How do I find it?
You need to have web- or emailspace somewhere (some hoster, e.g. hosteurope, webfaction etc.) and they can tell you the name of the smtp.
Thank you very much for this guide.I ve been looking for smt like this for the past6 hours.
That really helped me out and now I can send mails through phps using xampp console.
What a great tutorial!!
Great tutorial! I’m in your dept, sir! Thank you.
Superb, this worked a treat. Now i can test out my websites as they should be and not panic about not being able to test my mail scripts properly.
I’ve yet to test with phpmailer, but am fairly sure it will work.
Many thanks.
I think I have set up according to your instruction. I can see no error on the Mercury Core Process. It actually says, to email address (non-local) -OK. However, I don’t receive the message back. I tested and sent the message to the above email address. If you can help further, I would appreciate.
Are there no errors in the other windows of mercury? Maybe the mail was put into spam?
Thank you very much!!! The best manual ever!!
hallo ich habe ein problem… ich kann emails versenden und auch emfangen aber ich kann keinen mail client auf meine addresse von mercury benutzen ich bekomme nir eine verbindung… am anfang hat es geklappt und nach ca einer stunde oder nach ein neustart geht es nicht mehr
Hi,
I followed the instructions and when I got to stage 10 and tried to send a test email, Mercury froze, and now every time I try to restart it, it just crashes immediately.
any suggestions?
Thanks.
@taverne
Hm, Mailclient auf ein lokales Mercury habe ich noch nicht probiert. Stimmen IP und Port?
@Yakon
Never encountered to me, you should possibly try to reinstall mercury as it seems that it is somehow broken.
nicht auf local sondern vom internet aus statt ip habe ich die domain eingegeben etc wie gesagt er sendet und emfängt die mails von außerhalb mit einen mailclient konnte ich auch rauf connecten aber jetzt kann ich nicht mehr mit einen emailclient connecten das ist das problem…
I am getting a message from the SMTP client(relay version) : :sender address rejected, not owned by use
thanks a lot!
Probably you try to access an email account you don’t own?
Sir ..can u explain following steps further…and i cannot send mail from my joomla site
5.now we’ll test the whole thing from a PHP script and we’ll write a wonderful one-liner into a PHP file:
1.”mail(‘xxx@googlemail.com’, ‘Mercury test mail’, ‘If you can read this, everything was fine!’);”
2.call the PHP file within your browser, a command window should pop up shortly (or maybe not), it’s from the fake sendmail of XAMPP, and focus back on Mercury:
1.the produre is the same as above only that the SMTP server receives the mail from php before everything else happens
2.you can watch this in the window “Mercury SMTP Server” and should see something like this: Mercury SMTP
Hello I am configuring it with my xampp mercury to send mail from my localhost to any mail like example@gmail.com. I am using this mail domain server mail.site4test.x10.bz but it doesn’t seems to work. I follow every instruction which this article wrote but it having problem on connecting to this outgoing mail server mail.site4test.x10.bz I have tried it on Outlook and the error is this.
ERROR: Send test e-mail message: Outlook cannot connect to your outgoing (SMTP) e-mail server. If you continue to receive this message, contact your server administrator or Internet service provider (ISP).
This is great.. Thanks a lot for posting such detailed instructions.. Works perfectly.
Your blog post is help a lot and save my jobs!
Great man, thank you! You know, I set things up quite well by following an excellent video >>
http://www.youtube.com/watch?v=zO2p3uX9poY
Then I tried to use a PHP function send mail test and only got the mail back to local server.
The only changes I made were you php.ini settings and
“Configuration” -> “MercuryS SMTP Server”.
Then veulla! All is well. Will be able to fully use the email outgoing!
oops! with this set-up could only send to external but not receive from external.
Had to revert the MercuryS set-up back to the initial one! Now can both send and
receive.
Thanks a ton for this. It worked amazingly.
FYI for the above user who was getting a “sender address rejected” message in Mercury. I had the same issue and it turned out I just needed to set the “From” address to a real email address when sending out from Mercury’s “send mail message…” command.
Tolle Anleitung!! Leider funktioniert es bei mir noch nicht ganz richtig, d.h. beim Testsenden einer Mail von mercury aus. Eine Fehlermeldung wäre diesmal erwünscht xD, jedoch steht bei mir im Mercury Core Process lediglich, dass der “outgoing job with ID xxxx” OK ist. Dann passiert nichts mehr. Ich habs mit mehreren Adressen versucht, die relayfähig sind.
PS: Die jobs im MCProcess werden auch als completed angezeigt.
@zyntax
Das klingt aber, als ob die Mail versendet wird, aber vielleicht irgendwo unterwegs verloren geht. Hast du mal deinen TCP-Traffic überwacht, ob da eine Verbindung mit dem Mailserver hergestellt wird?
Great help.
Success at one try using gmail account. Just used the following in SMTP Client:
smtp.gmail.com with port 587
Thanks a lot…
Works!
I also had the issue where in php.ini the sender adress had to be an excisting adress.
Thanks!
Sir.Your tutorial is great but when i tried to sent mail in the mercury SMTP client(relay version)says”failed Error FF servicing queue job”what should i do ? can you sent a detailed tutorial to my email id.please Sir i need your help.
And it worked just fine.
I used XAMPP version 2.5 , Mercury/32 V4.62
Thanks.
OK. i get the logic in all this…. My question is. After doing all that will i still be able to send mails to my localhost (as in within my own self from my own self)……..
Thanks.
Very useful information. Thank you so much…
I have got a problem.. Can u plz help me out..
Mercury SMTP client (relay version) I am not getting OK message…
SMTP server information is right… What is the solution if SMTP server doesn’t allow relaying (from your host).
@Aloo Chizy
Mercury will be able to receive mails, but you have to ensure your pc will receive them by some DNS stuff or so. I don’t really know, just needed it for sending mails.
@Akshay
Try MercuryS -> Connection Control -> “Uncheck Do not Permit SMTP relaying to non-local mail”.
If it still does not work, you’re stuck, sorry.
Thank You Alex…
I got the output… Once again Thanks Alex…
well i dont have any webspace or something.i just want to to try to send email from localhost to yahoomail..i stopped at 7.2 T_T
is there any other way?please.thanks
Super HowTo – thanks Alex
But – may be I was special silly: Don’t forget : File>Leave offline mode . I needed 3 hours to see, that my Mercury was not in online mode.
hi all,
I’m having an error below in my Mercury SMTP Client (relay version) window:
failed.
Error FF servicing queue job.
More details
XAMPP
1.7.7
[PHP: 5.3.8]
can someone help me with this?
many thanks
perfect tutorial, thank you very much
Hi, I have followed the tutorial but the mail doesn’t get sent and I am getting in the Mercury SMTP Client (relay version) window:
501 Syntax error in arguments
@Paul Moss
Sounds like one of the config files of mercury has a sytnax error. Have you tried to reinstall mercury and start it and check if the error occurs? Then adjust the config as I have written and check again. Normally syntax error directly in mercury shouldn’t happen.
perfect one. i worked.
You are simply awesome.