timmah1 Posted December 17, 2008 Share Posted December 17, 2008 I set the $from variable depending on how sent the mail, and I have the $from in the header $from = "Vegas D Sports <[email protected]>"; $headers = "Content-Type: text/html; charset=\"iso-8859-1\""; $headers .= "Content-Transfer-Encoding: 7bit"; $headers .= "From: $from\r\n"; //options to send to cc+bcc $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; mail($to, $subject, $message, $headers); Right now, the from field always shows up as the server address, not what I have declared. How can I fix this? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/137356-solved-send-mail/ Share on other sites More sharing options...
phpian Posted December 17, 2008 Share Posted December 17, 2008 give this a shot mate. haven't tested it though. $from = '"Vegas D Sports" <[email protected]>'; $headers = "Content-Type: text/html; charset=\"iso-8859-1\""; $headers .= "Content-Transfer-Encoding: 7bit"; $headers .= 'From: ' . $from . "\r\n"; //options to send to cc+bcc $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; mail($to, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717680 Share on other sites More sharing options...
timmah1 Posted December 17, 2008 Author Share Posted December 17, 2008 It still comes up from the server I tried this as well $headers .= 'From: {$from}' . "\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717688 Share on other sites More sharing options...
phpian Posted December 17, 2008 Share Posted December 17, 2008 here's the exact headers i've used in a script that works: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'FROM: "Your Name" <[email protected]>' . "\r\n"; may be it has something to do with that. Quote Link to comment https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717701 Share on other sites More sharing options...
DimitriDV Posted December 17, 2008 Share Posted December 17, 2008 $Name = "Da Duder"; //senders name $email = "[email protected]"; //senders e-mail adress $recipient = "[email protected]"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; ini_set('sendmail_from', '[email protected]'); //Suggested by "Some Guy" mail($recipient, $subject, $mail_body, $header); //mail command Quote Link to comment https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717799 Share on other sites More sharing options...
timmah1 Posted December 17, 2008 Author Share Posted December 17, 2008 Thank you DimitriDV, that worked perfect! Quote Link to comment https://forums.phpfreaks.com/topic/137356-solved-send-mail/#findComment-717916 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.