I'm building a PHP/MySQL driven website for my department at work (installed via XAMPP). I need to be able to send mail to outside e-mail addresses (e.g., Yahoo, Hotmail, etc.) using the PHP mail() function. As I see it I have to solutions:

  1. Configure the SMTP directive in php.ini to the server running at my work.

  2. Configure/run a mail server that can send e-mails outside of localhost (I'm trying Mercury because it comes installed with XAMPP).

Here are problems I've come up against:

  1. I took a guess at our SMTP server name, and when calling PHP mail(), I get the error

    SMTP server response: 530 5.7.1 Client was not authenticated

    I can't be sure, however, the SMTP name is correct (I can't get help from our IT guys because of politics).

  2. I have tried to use mercury mail. Mercury seems to be picking up the request, but it doesn't want to forward the e-mail to the outside. I keep getting a Temporary error 240 (temporary MX resolution error).

I've searched high and low but still can't find a definitive answer on how to send e-mails outside of localhost.

Any help is greatly appreciated.

link|improve this question
feedback

migrated from stackoverflow.com Mar 10 '10 at 23:46

This question came from our site for professional and enthusiast programmers.

2 Answers

Regarding number 1, the message means that your outgoing mail server expects the clients connecting to it to use SMTP-AUTH. Since a big part of your problem is interdepartmental politics, find someone "who matters" from your department and have him ask/demand from IT that your server is excluded from such a policy. Should they refuse to change their policies, have that "someone who matters" ask/demand that they setup a separate relay server just for your service that has to work as you might expect.

I've also found that a cheerful smile combined with asking for help and permission, together with a cup of coffee helps find out the policy exceptions (or other suitable solution) that you need.

Regarding Mercury, mail does not get through because the DNS servers that it queries do not respond with valid MX records, so it does not know where to send submitted email to.

Your best bet is to either bypass politics by being someone in need of help, or use someone who can overpower them.

link|improve this answer
feedback

Why not using PHP PEAR extension to sent out mails. It is a lot easier than using fsocketopen or the php mail function. You can check the link below for detailed instructions. http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm

link|improve this answer
feedback

Your Answer

 
or
required, but never shown