I need to send mail to the users of my website using php script. I have tried using mail function in php.
My code is as follows:
$to = "myweb@gmail.com";
$subject = "Test mail";
$message = "My message";
$from = "webp@gmail.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
When I try running the program this is what I get:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set().
Please tell me what address to include in the $from variable. Do I need a smtp server for this? How do I send mails using a localhost? Please tell me what exactly to edit in the php.ini file
I am new to all this.. Please help me..
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…