dare87 Posted March 7, 2008 Share Posted March 7, 2008 I am trying to send a message using php, but my server keeps overriding the header. I try and it is changed $headers = "From: [email protected] \r\n"; but if I try I get Parse error: syntax error, unexpected T_STRING $headers = "From: "test" <[email protected]> \r\n"; am I missing something? Thanks Link to comment https://forums.phpfreaks.com/topic/94825-solved-mail-help/ Share on other sites More sharing options...
SkullzY88 Posted March 7, 2008 Share Posted March 7, 2008 this shuld help you out take a look at this code and then either use instead of your own or use it to help fix your own wot ever you decide <?PHP $to = "YOUR EMAIL ADDRESS HERE"; $subject = $_POST["title"]; $name = $_POST["name"] $message = $_POST["message"]; $messagesent = "From: $name Message: $message"; $from = $_POST["email"]; $headers = "From: $from"; mail($to,$subject,$messagesent,$headers); echo "Your message has been sent, thank you."; ?> Link to comment https://forums.phpfreaks.com/topic/94825-solved-mail-help/#findComment-485759 Share on other sites More sharing options...
rameshfaj Posted March 7, 2008 Share Posted March 7, 2008 be known that different mail servers use different headers for sending mail and dont rely only on one type of header patterns,ex the header that worked for yahoomail may not work for hotmail and so on. Link to comment https://forums.phpfreaks.com/topic/94825-solved-mail-help/#findComment-485888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.