Tuesday, May 3, 2011

Configuring Mercury in XAMPP

So you have finally reached the point in your programming life where you need to set up your computer as a webhost using XAMPP, and would like to configure Mercury 32 to interact with your SMTP server. This is easier said than done for many reasons--and there are many MANY tutorials out there claiming to hold a solution. Most end in the dreaded error 550, 503 or just leave you with messages that your server does not allow relays...

Assuming you have an SMTP server (if you do not, there is still a work-a-round test you can do that we will discuss later*) try the following configuration:

1. Start Mercury (using XAMPP).
2. Go to "Configuration" and then "Protocol modules"
3. Uncheck the "MercuryB HTTP web server" box.
4. Uncheck the "Mercury IMAP4rev1 server"
5. Uncheck the "MercuryE SMTP end-to-end delivery client"
6. Check the "MercuryC SMTP relaying client".
7. Click "OK" then restart Mercury
8. Open Mercury again and go back to "Configuration"
9. Go to"Mercury core module" and click the "General" heading
10. Since we want to send from our computer, we make sure that "localhost" is the value of "internet name for this system."
11. Uncheck all boxes except "Send copies of all errors to postmaster"
12. Look under the heading "Local domains." Make sure that "localhost (local host or server) localhost (internet name)" is added.
13. Click "OK"
14. Go back to "Configuration" and chose "MercuryS SMTP Server." Make sure you uncheck the "Do not Permit SMTP relaying to non-local mail" or you will get the dreaded 553 error that 'we do not relay mail.'
15. Open the "General" tab and name for your SMTP server under "Announce myself as." It does not matter what name you chose.
16. Under "Listen on TCP/IP port" enter "25"
17. Enter "127.0.0.1" to "IP interface to use."
18. Under "Connection Control" select "Add restriction" and enter the range "127.0.0.1" to "127.0.0.1" to restrict access to our server.
19. Check "Allow connections." All other checkboxes should be unchecked.
20. Click "OK"
21. Go back to "Configuration" and chose "MercuryP POP3 Server", select the "General" tab.
22. Under "Listen on TCP port" add "110"
23. The "IP interface to use" should be "127.0.0.1"
24. Open the "Connection control" tab and again select "Add restriction" and enter the range "127.0.0.1" to "127.0.0.1.
25. Click "OK"
26. Next go to"Configuration" then "MercuryC SMTP Client" This is the point where we need an external SMTP server. If you do not have one, never fear--you can still test your PHP email functions by setting up a resident SMPT server inside your machine. We will discuss this feature later on.
27. Enter the address of your SMTP under "Smart host name", for example "mail.comcast.com"
28. The fields below the SMTP depend on the way you access your server. The port is most likely 25. "Login username" and the "Password" are usually given to you by your webhost.
29. Next, go back to "Configuration" and then "Manage local users"
30. Make sure there are at least two users "Admin" and "postmaster", both set as admin.
31. Now we need to hack the php.ini file in XAMPP a bit. It should be at"xampp/php/php.ini" or "xampp/apache/bin/php.ini"
32. Inside the php.ini file search for "[mail function]" It should be about half way down.
33. Add "SMTP = localhost", "smtp_port = 25" and uncomment "sendmail_from = postmaster@localhost"
34. Save php.ini restart Apache

To test and see if Mercury's configuration worked, open up Mercury and from the file option, create a new email message...

And the work-a-round if you do not have an outside SMTP server or cannot get outside the network? Set up one on your machine! PostCast is a good free server that I use. It can be found at http://www.postcastserver.com/ Leave all settings the same in Mercury. PostCast will name your SMTP after your computer. Even if your network has blocked port 25 (which happened to me), PostCast will still capture your emails--and while it cannot send them if port 25 is blocked, it can allow you to see if Mercury is working, give you a testing ground to continue your PHP, HTML mail function development in the meanwhile...

No comments:

Post a Comment