Re: email authentication

From: Date: Sat, 22 Dec 2007 18:22:46 +0000
Subject: Re: email authentication
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-266228@lists.php.net to get a copy of this message
Afan Pasalic wrote:
I have to develop a little registration form. after the form is submitted confirmation email has to be sent to registrant. I use this function to send an email: function send_plain_email($to, $subject, $body) {
    $headers =    "MIME-Versin: 1.0\n" . "Content-type: text/plain; charset=ISO-8859-1; format=flowed\n" . "Content-Transfer-Encoding: 8bit\n" .
    "Reply-To: Registration <registration@mydomain.com>\n".
    "From: Registration <registration@mydomain.com>\n" .
    "X-Mailer: PHP" . phpversion();           mail($to, $subject, $body, $headers) or die(mysql_errno());
} Though, I'm getting the following error: Warning: mail() [function.mail]: SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server. in D:\Sites\CWIPanel\Accounts\mydomain.com\wwwroot\reservation.php on line 34 Never get such a error using LAMP.
I'm assuming from that comment that you're running this under Windows of some variety? This is not a PHP problem. The mail server PHP is configured to use (see php.ini) requires authentication. The built-in mail function doesn't support that so you'll need to use something like PHPMailer (Google for it). -Stut -- http://stut.net/

« previous php.general (#266228) next »