gomowireless Posted February 18, 2014 Share Posted February 18, 2014 I have built a web form that send to my email from another email in my system, mail goes through just fine, however, the From header in the received email shows my server address instead of the proper from address. Here is the script. ini_set("sendmail_from","[email protected]"); $subject = 'Device Purchase Alert: '.$_POST['manufacturer'].' '.$_POST['model']; $message = 'Hello, '.$_POST['name'].' has received a '.$_POST['manufacturer'].' '.$_POST['model'].' for '.$_POST['carrier'].' in '.$_POST['condition'].' condition. This item was a '.$_POST['type'].' for the amount of $'.$_POST['amount'].'. The ESN/MEID of this device is '.$_POST['meid'].'.<br><br>Comments: '.$_POST['comments'].'<br><hr><br><i>This email is intended for employees and management of Gomo Wireless. If you are not one of these people, please delete this email immediately. Thank you</hr></i>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Purchasing' . "\r\n"; $headers .= 'From: [email protected]' . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); mail("[email protected]", $subject, $message, $headers, "-f [email protected]"); not sure what I am doing wrong. Link to comment https://forums.phpfreaks.com/topic/286278-problems-with-from-address-in-php-mail-script/ Share on other sites More sharing options...
jazzman1 Posted February 18, 2014 Share Posted February 18, 2014 To use Gmail,Yahoo (not sure for others mail servers) to send from your other email addresses you need to add that mail address you own to the external mail server. Link to comment https://forums.phpfreaks.com/topic/286278-problems-with-from-address-in-php-mail-script/#findComment-1469326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.