I have a problem when sending mail with php form. If the code it looks like this it works perfect: $headers .= 'From: Birthday Reminder <admin@eva.com> ' . "\r\n"; but the problem is the email is not a variable ... if i try to put : $headers .= 'From: Birthday Reminder $email ' . "\r\n"; where $email=$_POST['email']; in the mail it appears FROM: " <Birthday@yahoo.com> i have no ideea from where appears @yahoo.com i also tryed with $email=$_GET['email'] and $email=$_REQUEST['email'] if i put: $headers .= 'From: Birthday Reminder <$frome> ' . "\r\n"; in email it appers: FROM:Birthday Reminder <$frome@srv31.host.com> :| i just only want to appear From: Birthday Reminder $ email any ideea?
Looks like you just need to use double quotes. ie: $headers .= "From: Birthday Reminder $email " . "\r\n"; Code (markup): instead of: $headers .= 'From: Birthday Reminder $email ' . "\r\n"; Code (markup): Or just use the concat operator $headers .= 'From: Birthday Reminder ' . $email . ' . "\r\n"; Code (markup): Of course that depends of how the email looks when coming from the form. You might have to add the <>: $headers .= "From: Birthday Reminder <$email> " . "\r\n"; Code (markup):
one more Q. don't want to start another topic. after the mail is send i have the echo "Mail send $to"; but if i refresh the page the mail is send again... every time i refresh.. i also have set if (isset($_POST['Send'])) { // Mail it mail( $to, $subject, $message, $headers); echo "Mail send to $to "; }