I am having trouble sending emails with PHP. Can you see any problems in my code?
php.ini mail settings:
[mail function]
SMTP = mail.ntserv.co.in
smtp_port = 26
Code:
<?php
$to = "vijay@gmail.com";
$subject = "Test mail";
$message = "hi, How r u";
$from = "vijay@ntserv.co.in";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Output:
Warning: mail() [function.mail]: SMTP server response: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail. in C:\xampp\htdocs\vijay\demo\msg.php on line 7 Mail Sent.