Loading...

2013年4月24日


Configure Mercury mail transport system for external mail

I develop my web site projects and set up web server xampp locally on my pc. Using XAMPP for Windows because it contains everything I need for developing PHP applications as well as all the stuff, such as sending mails: fake sendmail and Mercury Mail Transport System. The environment is XAMPP 1.8.1 (for Windows) and Mercury/32 4.62 here. Mercury is already pre-configured in XAMPP - all settings that I don't explicitly address stay as they are.  

While I set mercury up and use thunderbird Email client, reading 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 DNS server, for example the one that your webspace hoster provides.
So let's get started:

  1. start Mercury (using the XAMPP Control panel) and then open the mercury admin panel.
  2. 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".
    • disabled "Mercury IMAP4rev1 server" because I won't need that one.
    • make sure  "MercuryE SMTP end-to-end delivery client" is enable. 
  3. now let's configure Mercury in general:
    • "Configuration" -> "Mercury core module", tab "General"
    • we want to send from local PC, therefore we enter local domain name (such as mydomain.com) for value of "internet name for this system". If not, change that.
    • all other settings stay the same as they are already configured.
    • open "Local domains" tab. Click on add new domain, then add local domain name, this example mydomain.com to (local host or server) and mydomain to (internet name). 
    • click "OK" and leave the dialog.
  4. 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 "mydomain.com".
    • under "Listen on TCP/IP port" fill in "25", that's the SMTP port
    • add local PC IP, such as "192.x.x.x" to " to IP interface to use", that's the local IP of your pc.
5         5.    now we limit the access to the server so that only our local machine can access it. If allowing
               other PSs to access, skip this step and go to the next step:
    • 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.
6         6.    allow my other PCs to access mercury, so that other PSs can access:
    • under "Connection Control" click on "Add restriction" and add a specific IP or range of IPs, for instance from "192.x.x.1" till "192.x.x.255".
    • and select "Allow connections"...
    • At the bottom of tab, find “AUTH Password file”.  Enter any name you like, then click on Edit to open “passwords for authenticated SMTP” window. 
    • Add a user name and password with space between them.  This is the email user account that I will use to receive Email by Email client, such as thunderbird.
  1. now let's configure the MercuryP POP3 Server:
    • "Configuration"-> "MercuryP POP3 Server", select the tab "General".
    • "Listen on TCP port" -> "110" and enter local pc IP to "IP interface to use" -> "192.x.x.x".
    • choose the tab "Connection control" and proceed as already written under step 5 or 6.
    • that's it already, leave the dialog by clicking "OK".
    • At the bottom of tab, find “POP3 login Aliasing file”.  Enter any name you like, then click on Edit to open “POP3 login aliases” window. 
    • Add a user name and password with space between them.  This is the email user account which was added in step 6.
  1. now  configure "MercuryE SMTP Client":
    • "Configuration" -> "MercuryE 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 "identify myself as", for example "mydomain.com"
  1. 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.
    10. finally fill in the "Login username" and the "Password" that normally is supplied by your webhost:
    • "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.
    • Add another user which you add in step 6 and 7.
  1. now we finished with Mercury, but we still need to configure PHP for sending mail with our scripts:
    • 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.
    • search for "[mail function]"...
    • then replace localhost to local PC IP and comment out sendmail_from as following:
    • "SMTP = 192.x.x.x".
    • "smtp_port = 25".
    • "sendmail_from = postmaster@localhost" (put ; in front of this line).
    • save the php.ini and restart the Apache.
  1. 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 gmail account.
   13. Final open thunderbird and add the email user account.  Thunderbird can send and receive 
          Email now.
1       14.  While sending a test email, go to Mercury:
  • within the window "Mercury Core Process" we'll see our test mail at first:
    • "xx:xx:xx JOB XXXXXX: from postmaster@localhost (local) To: XXX@gmail.com (non-local) (JOB XXXXXX) -OK"
  • the mail was received in Mercury and processed, after some seconds the window "Mercury SMTP client" should show some actions:
    • "05 Jan 20xx xx:xx, 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)
I hope that worked for you, if not, feel free to leave a comment and try my best to help!


0 意見:

張貼留言