Forum Moderators: coopster
I have a few sections on my site that send me email when a user submitts various forms. I use the mail() function.
This is an example:
$sendto = "me@mysite.com";
$email = "replay@mysite.com";
$message = "Message from user.";
$subject = "Website Feedback - " . date("m/d/y");
$headers = "From: \"Online-Website-Feedback\" <****@mysite.com>\r\n";
$headers .= "Reply-To: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit;\r\n\r\n";
$headers .= stripslashes($input);
$headers .= "\r\n";
mail($sendto, $subject, $message, $headers);
For some reason though not all emails are sent to me. I setup a little database action that everytime a user views my feedback form it adds to the database that a use viewed the form at this time. Then I set it so whenever a user submits the form it adds his info to the database, emails me, and adds to the database that a user submitted the form. So I have a few inserts in my database that say a few people have submitted the form, but I have no email from my site about their feedback.
I was curious if the mail() function is a good function to use or if there is a better way to send mail. I am also using this function for order confirmations with my shopping cart and if some emails arent being sent that will give me problems down the road with orders not being completed.
So in basic terms what is the easiest, most secure, most reliable way of sending email from a website in php?
Thanks in advance for your help :)
Wes
Yes it does go through fine without any erros. When I have error reporting enabled I get an error about $input not being assigned anything, but the email still goes fine. But that is also on my server here and not online. Once its online I don't have error reporting (none at all - stupid ISP) but the email goes through fine. It is just the random one that takes forever to actually get the recipient or it never comes.
I just find it odd because sometimes I receive the email sometimes I don't
Wes