DrTrans Posted May 5, 2010 Share Posted May 5, 2010 basically emailing form responce: I have my ini_set above variable Message [code ] ini_set("sendmail_from", "[email protected]"); $message = "Here are your results"; $mailsubject = "Online Request from website"; $headers = "From: Elitecarolinas.com<$mainemail>\r\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $who = "[email protected]"; $sendmail = mail("[email protected]",$mailsubject,$message,$headers); echo "Sent Mail" Why would this not send mail? Quote Link to comment https://forums.phpfreaks.com/topic/200797-mail-using-php/ Share on other sites More sharing options...
Muddy_Funster Posted May 5, 2010 Share Posted May 5, 2010 is there a reason that you are assigning the mail() to a variable? Quote Link to comment https://forums.phpfreaks.com/topic/200797-mail-using-php/#findComment-1053604 Share on other sites More sharing options...
DrTrans Posted May 5, 2010 Author Share Posted May 5, 2010 yeah for this echo echo "<BR/>mail() returned: " . ($sendmail? "TRUE" : "FALSE") . "<BR/>"; Quote Link to comment https://forums.phpfreaks.com/topic/200797-mail-using-php/#findComment-1053606 Share on other sites More sharing options...
DrTrans Posted May 5, 2010 Author Share Posted May 5, 2010 The responce of that echo statement comes back "True" however i dont recieve any mail Quote Link to comment https://forums.phpfreaks.com/topic/200797-mail-using-php/#findComment-1053610 Share on other sites More sharing options...
Muddy_Funster Posted May 5, 2010 Share Posted May 5, 2010 What happens if you set it like this? mail("[email protected]",$mailsubject,$message,$headers); $sendmail = mail("[email protected]",$mailsubject,$message,$headers); echo "Sent Mail"; If that fails also I would have a look at the server SMTP settings you have set up I have this setup on a server and it works fine: $to = $address; $subject = 'Mail From : '.$sitename; $message = $body; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'Content-type:text/html;charset=iso-8859-1' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" ; mail($to, $subject, $message, $headers); /php] Feel free to copy and change/butcher for your own uses - even if it's just to test. Quote Link to comment https://forums.phpfreaks.com/topic/200797-mail-using-php/#findComment-1053630 Share on other sites More sharing options...
mbeals Posted May 5, 2010 Share Posted May 5, 2010 I've fought with this on more than a few occasions. The issue is always with the server's configuration. ****I'm assuming Linux server here....no idea how to work it on a windows machine********** open up a second terminal and 'tail -f /var/log/syslog' then run the script. You should get some errors that point you in the right direction. Are you attempting to use sendmail or postfix? have you modified your php.ini file? Are you behind a firewall that blocks stmp traffic? I've had the most luck using postfix to relay the mail out. Quote Link to comment https://forums.phpfreaks.com/topic/200797-mail-using-php/#findComment-1053654 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.