SteveH Posted January 5, 2008 Share Posted January 5, 2008 Hello I have an online form which, when completed, should send me an email with the details of that user, that is, his name, email address, business, country, and message. When I receive the message in my inbox, however, it looks like this: http://www11.brinkster.com/stevehigham/error.html It does not show the name of the person who completed the form, or his email address. It is also showing email 'From' as [email protected] when it should show [email protected]. To complicate matters, it uses 'education' (in the above link) as the Subject and it does not send the user a copy of what he has input into the form. What am I doing wrong, please? The code looks like this: <?php //create short variable names $name=$_POST['name']; $email=$_POST['email']; $business=$_POST['business']; $country=$_POST['country']; $message=$_POST['message']; $name=trim($name); $email=trim($email); $business=StripSlashes($business); $country=StripSlashes($country); $message=StripSlashes($message); /*######### modify the next line with your own email address ###########*/ $toaddress='[email protected]'; mail("$toaddress","$business","$country","$message","From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n"); //clear the variables $name=''; $email=''; $business=''; $country=''; $message=''; exit; ?> Thank you. Steve Link to comment https://forums.phpfreaks.com/topic/84672-php-problem-with-email-help-appreciated/ Share on other sites More sharing options...
phpknight Posted January 6, 2008 Share Posted January 6, 2008 Steve, Hard code some values in there before you get into the $_POST part. But, you are going to want to check all that post stuff before just sending it. Also, I found that Yahoo mail for me was a little buggy, but when I changed the \r\n to just \n that solved a few problems. Link to comment https://forums.phpfreaks.com/topic/84672-php-problem-with-email-help-appreciated/#findComment-431509 Share on other sites More sharing options...
phpknight Posted January 6, 2008 Share Posted January 6, 2008 Also, I am not sure you should be putting a return-path in there manually. Link to comment https://forums.phpfreaks.com/topic/84672-php-problem-with-email-help-appreciated/#findComment-431511 Share on other sites More sharing options...
ifis Posted January 6, 2008 Share Posted January 6, 2008 It looks like you have an extra entry with $country. This code might work. $subject=$business; $subject=$country; $headers=From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n; $mailsnd=mail("$toaddress","$subject","$message","$headers"); Link to comment https://forums.phpfreaks.com/topic/84672-php-problem-with-email-help-appreciated/#findComment-431575 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.