I’m trying to use the mail() function on my computer so I can test the web application’s system emails that I’m building for someone. In the php.ini file I changed sendmail_sender to my email address. The SMTP settings in php.ini are as follows:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.comcast.net
; http://php.net/smtp-port
smtp_port = 25
When I try sending mail with PHP, I get this error:
Warning: mail() [function.mail]: SMTP server response: 550 5.1.0
Authentication required in C:\wamp\www\register.php on line 28
Here is my PHP mail code:
$url = "http://localhost/activate.php?key=".$key;
$email_body = "Dear ".$name.",
Thank you for registering on Yamma.org! To activate your account, please click on the following URL:
".$url."
If the above URL is not clickable, please copy the FULL URL and paste it into your browser's address bar.
Sincerely,
The Yamma Team
http://www.yamma.org";
mail($email, $settings['activate_email_subject'], $email_body, "From: ".$settings['emails_sent_from']);
Does anyone have any idea of why I could be getting this error? I don’t think Comcast’s SMTP server needs authentication, or does it?
Apparently it does or it wouldn’t be saying that :). To do authentication, you will need to use a library like PHPMailer, SwiftMailer, or Zend_Mail.