php not sending email?
I'm on a godaddy hosting account and my emails were sent fine until today. It seems as though all the emails form my site stopped sending.
<?php
$to = "myemail";
$subject = "Client Question";
$msg = "From: {$_POST['name']} \n Email: {$_POST['email']} \n Phone: {$_POST['phone']} \n Msg: {$_POST['message']}";
$headers = "From: myemail";
mail("$to", "$subject", "$msg", "$headers");
echo "<p style='color: green'>Your message was sent!<开发者_StackOverflow社区;/p>";
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
I'm still a newbie in sending emails so I'm not so sure why is used to send however isn't anymore. Any advice on how to make it work/faster
The messages are sending I'm not receiving them though. But this is not a problem with my email since I can still receive emails from GMAIL/Yahoo
I wouldn't expect it to be the source of your problem, but you needn't enclose variables in quotes like
mail("$to", "$subject", "$msg", "$headers");
// instead...
mail($to, $subject, $msg, $headers);
Well, the following things come to my head:
- It could be (most likely is) a problem with the SMTP server.
- Even though headers aren't malformed or anything, it might have something to do with them.
- Last but not least, your mail might be blocked by the receiving SMTP server (uhm, maybe it uses a whitelist or something like that)
精彩评论