Forum Moderators: coopster
I also tried it without the extra 'X-Mailer: PHP/' . phpversion(), not sure why these are necessary at all. But the result is the same.
When the email comes through it says, in the 'from' field: "Sou@subdomain.hostingprovider.com; Desade@subdomain.hostingprovider.com"
I substituted subdomain.hostingprovider for the real address for the purposes of this post. The subdomain showed isn't even mine, but for the provider's account manager. I am new to PHP, do you know how I can get it to show "Sou Desade" in the from field? I tried 'From: "Sou Desade"' with the " signs, but it just showed up as "Sou Desade"@subdomain.hostingprovider.com
I contacted the provider in case it was an issue with the settings of the server but they said the issue was with the script and didn't offer much more help than that.
Any ideas? If so, thanks a lot :)
For the From header field you must also supply an email address like in the reply-to field. You can add your name if you wish, but an email address is required.
Use something like:
$mailheader = 'From: "Sou Desade" <address@email.co.uk>' . "\r\n" .
'Reply-To: address@email.co.uk' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
I would actually remove that line. All it does is put your version # of php in there, I have never been a fan of adding extra headers that don't do anything, though I have had this in some of my mail scripts when I needed to do some things.
also the line is not properly terminated anyway, it should look like this
$mailheader = 'From: "Sou Desade" <address@email.co.uk>' . "\r\n" .
'Reply-To: address@email.co.uk' . "\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n";
each line in the header needs to end in \r\n