unkwntech Posted February 9, 2009 Share Posted February 9, 2009 I have the following code //There were no emails so we need to send the email to Jarrod and tell the user it was sucessful. $message = 'A quote was requested from your website today (' . date('D, JS') . 'of' . date('F Y') . ' at ' . date('g:i A') . ".\r\n"; $message .= 'Name: ' . $_POST['firstName'] . ' ' . $_POST['lastName'] . ".\r\n"; $message .= $_POST['firstName'] . ' can be contacted at ' . $_POST['phoneNumber'] . ".\r\n"; $message .= 'The best time to contact this person is between ' . $_POST['time1'] . ' and ' . $_POST['time2'] . ".\r\n"; $message .= "They said they need:\r\n" . $_POST['body'] . "\r\n\r\n"; $headers = 'From: EMAIL-REMOVED' . "\r\n" . 'Reply-To: EMAIL-REMOVED'; if(mail('EMAIL-REMOVED', 'Quote Requested', $message, $headers)) { echo 'Message sent'; } else { echo 'Message failed'; } I have already validated the post values at this point, and I am seeing message sent but the message has not arrived at either email address specified, did I miss something? Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/ Share on other sites More sharing options...
phpdragon Posted February 9, 2009 Share Posted February 9, 2009 Give this a try but with your code $to=enter_email_var_here; $subject="enter subject here"; $name="enter var name here"; $message="Hi<br><br> ".$_REQUEST['name']." has requested info.<br><br>Thank you."; mail("$to","$subject","$message","From: $name <$email>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"); header("Location: thanks.php"); Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758120 Share on other sites More sharing options...
unkwntech Posted February 9, 2009 Author Share Posted February 9, 2009 Same result, but not surprising as the only difference between yours and mine was the content-type header. Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758123 Share on other sites More sharing options...
phpdragon Posted February 9, 2009 Share Posted February 9, 2009 as a test just try that small bit of code i gave you with hand entered variables and see if it sends your message Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758126 Share on other sites More sharing options...
unkwntech Posted February 9, 2009 Author Share Posted February 9, 2009 Same result, but not surprising as the only difference between yours and mine was the content-type header. ^-- Same result Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758128 Share on other sites More sharing options...
phpdragon Posted February 9, 2009 Share Posted February 9, 2009 strange I use that exact bit of code on a lot of sites and it works fine, maybe there is another underlying issue that may be server configuration related? its sent to it from a form as I assume you are doing, the only difference i see is I am using $_REQUEST instead of $_POST as you are, altho I am not entirely sure if thats the issue. Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758133 Share on other sites More sharing options...
PFMaBiSmAd Posted February 9, 2009 Share Posted February 9, 2009 A TRUE returned by the mail() function only means that the mail server that php has been configured to use exists and it accepted the email for sending without returning an error. It does not mean that the email was sent. Due to outgoing spam/virus scanning that occurs after an email has been accepted, your email might not be sent. Also, because of scripts probing mail servers to find out server and user information, a lot of mail servers have been configured to "silently" accept emails that might violate relaying restrictions or have other problems without returning a failure status but that the mail server has no intention of sending. And if your email is being sent by your sending mail server, the receiving email server might discard it if your sending mail server does not have proper DNS records associated with it or if you are doing something like using a From: address that is not hosted at the domain corresponding to the sending mail server or if there is not an SPF record at the domain in the From: address that says that your sending mail server is authorized to send email for that domain or if your sending mail server has been banned by the receiving mail server. Here is a list of things to check - Is the mail() function even enabled? Are you meeting any relaying and SMTP authorization restrictions that your web host has set up? Check the mail server logs and any outgoing spam/virus scanner logs to see what is happening with your email. Is the To: address hosted at the sending mail server? Edit: are you sending this to a mail server at the web host or are you sending this to an external address? Is the From: address hosted at the sending mail server? Does the sending mail server have proper DNS records? You can check at dnsreport.com/dnsstuff.com Has the sending mail server been banned by the receiving mail server or does the sending mail server appear on any of the spam databases? Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758136 Share on other sites More sharing options...
unkwntech Posted February 9, 2009 Author Share Posted February 9, 2009 I have a SMF Forum on the server and whenever an error occurs over there (quite frequently as I had disabled its access to the DB) I get an email from SMF via mail(), using the default SMTP settings, telling me about the error. Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758143 Share on other sites More sharing options...
PFMaBiSmAd Posted February 9, 2009 Share Posted February 9, 2009 So, what mail settings and mail configuration is your SMF forum using? You would need to match that in your php script. Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758146 Share on other sites More sharing options...
unkwntech Posted February 9, 2009 Author Share Posted February 9, 2009 So far as I can tell they are using the server defaults. Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758159 Share on other sites More sharing options...
FD_F Posted February 9, 2009 Share Posted February 9, 2009 try use this class phpmailer: http://phpmailer.codeworxtech.com/ Quote Link to comment https://forums.phpfreaks.com/topic/144480-mail-help/#findComment-758170 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.