0
votes

I am trying to send email using following PHP code.But I get the following error:

Warning: mail(): SMTP server response: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257

<?php
    $to = "[email protected]";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "[email protected]";
    $headers = "From:" . $from;
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
?>
1

1 Answers

0
votes

It is pretty obvious that your SMTP server requires you to authenticate. Use a more powerful tool for sending mail, such as PHPMailer.