Reputation: 17376
would anyone be able to help me with my question..I am not able to send mail using mail() in php..Here is my code:
if (isset($_POST["from"])) {
$from = $_POST["from"]; // sender
$subject = $_POST["subject"];
$message = $_POST["message"];
$message = wordwrap($message, 70);
mail("[email protected]",$subject,$message,"From: $from\n");
echo "Thank you for sending us feedback";
}
while i am running this program in localhost,output showing as "Thank you for sending us feedback" , but not getting any mail in [email protected].
Upvotes: 1
Views: 131
Reputation: 4263
Check your php.ini cofiguration file and add the mail server config:
SMTP = server ; mail server
smtp_port = 25 ; port
sendmail_from = [email protected] ;
Or
Use PHPMailer https://github.com/PHPMailer/PHPMailer to send via gmail, yahoo or any external mail server.
Upvotes: 2