SlayrNeo Posted March 8, 2010 Share Posted March 8, 2010 Hi, I have been working on a script to send en email. Everything works, but the problem is that the sender sees the wrong address. The mail I receive from the script is perfect, I see the name and email adres in the from-section. But the mail the sender receives is wrong. He sees in the from-section: [email protected] instead of [email protected] The jk????? is the accountname on the webhosting. Could someone point me in the right direction on how to fix this? I have added the script as attachment. Thanks in advance, Nick [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/194483-php-mail-script-sends-via-the-wrong-adres/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 8, 2010 Share Posted March 8, 2010 The From: address in the header must be a valid mail box at the sending mail server. I'm guessing the email that is the problem is the 'copy' you are sending to the visitor? If so, the $headers variable being used for it should probably just be the same as that being used in the main email that is being set to you (without the multipart/mixed; boundary= being used to attach the uploaded file to the email.) Quote Link to comment https://forums.phpfreaks.com/topic/194483-php-mail-script-sends-via-the-wrong-adres/#findComment-1022950 Share on other sites More sharing options...
SlayrNeo Posted March 8, 2010 Author Share Posted March 8, 2010 Yeah, the problem is the mail sending to the visitor. The code is now: // If Sending a copy to visitor is checked and the field from where to get the visitor email // address is selected we send a copy to the visitor if ( ($FCopyToSender == 1) && ($FMesFromT ==2) AND ($Spam == 0) ) { $headers = "From: $FFirstName <[email protected]>\r\n"; $headers = "Reply-to: $FFirstName <$FEmail>\r\n"; $subject = 'Uw aanvraag is ontvangen.'; The header was first: $headers = "From: $FFirstName <$FEmail>\r\n"; The mail-adres doest exist at the hosting server, but it still choses [email protected]. And from what I can see in thecode, it should be [email protected] Or am I missing something? Quote Link to comment https://forums.phpfreaks.com/topic/194483-php-mail-script-sends-via-the-wrong-adres/#findComment-1022954 Share on other sites More sharing options...
PFMaBiSmAd Posted March 8, 2010 Share Posted March 8, 2010 The second $headers line is missing a concatenation dot ., so the first line is being completely replaced - $headers .= "Reply-to: $FFirstName <$FEmail>\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/194483-php-mail-script-sends-via-the-wrong-adres/#findComment-1022955 Share on other sites More sharing options...
SlayrNeo Posted March 8, 2010 Author Share Posted March 8, 2010 That's fast! Thanks it works flawlessly now!! Quote Link to comment https://forums.phpfreaks.com/topic/194483-php-mail-script-sends-via-the-wrong-adres/#findComment-1022957 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.