PHP Anthology send mail -SMTP server response: 550 Access denied - Invalid HELO name

I’m trying to use some code from the PHP Anthology book. I’m having trouble sending mail using the simple method from pg 180:

<?php
mail(’
you@yourdomain.com
', ‘Howdy’, ‘Glad to meet you.’,
'From:
me@mydomain.com
');
?>

and also the Pear version from 180/181:

<?php
// to remove the E_STRICT errors created by the PHP4 code in Mail
error_reporting(E_ALL);
// include Mail class
require ‘Mail.php’;
// choose which backend type we want
$mail = Mail::factory(‘mail’);
// some headers we want to send
$headers = array(
‘From’ => ‘me@mydomain.com’,
‘Subject’ => ‘Howdy’
);
// send the email
$succ = $mail->send(‘you@yourdomain.com’, $headers, ‘Glad to meet you.’);
// Check for sending errors
if (PEAR::isError($succ))
{
echo 'Email sending failed: ’ . $succ->getMessage();
}
else
{
echo ‘Email sent succesfully’;
}
?>

Here is the full error message:
Warning: mail() [function.mail]: SMTP server response: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1) in C:\pear\pear\Mail\mail.php on line 153

I’m guessing that I have setup my php.ini file mail settings incorrectly, but not sure how to make a fix.

I’ve made these changes to the ini:

SMTP = mail.mydomain.com
smtp_port = 25
sendmail_from = me@mydomain.com

Any help is appreciated.

  • Stan.

you are trying to connect to mail.mydomain.com to send the email. try sending it from your machine instead.

SMTP = localhost
smtp_port = 25

Thanks for your help. I’ve changed SMTP and the port. Now I receive the following message:

Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in…

you need a mail server that listens to port 25

Thanks. That appears to be the problem. I’ve installed “Free SMTP Server” and I can run limited testing with it, but only limited. Any suggestions on a good (free) SMTP Server to run on windows?