invictusBob Posted December 2, 2010 Share Posted December 2, 2010 I'm taking a message submitted by the user and sending it via mail() to the site owner. I don't apply any conversions to the string except stripslashes() before mailing. This has worked well except that when anyone uses an @, what gets sent is Å (capital A with ring above). Can I fix this in the PHP script or is the problem on the client side? Link to comment https://forums.phpfreaks.com/topic/220505-unexpected-characters-in-user-message/ Share on other sites More sharing options...
btherl Posted December 2, 2010 Share Posted December 2, 2010 Can you please post your code. Link to comment https://forums.phpfreaks.com/topic/220505-unexpected-characters-in-user-message/#findComment-1142401 Share on other sites More sharing options...
invictusBob Posted December 3, 2010 Author Share Posted December 3, 2010 Thanks for the response, code below: <?php foreach ($_POST as $key => $value) { $currField = ""; switch ($key) { case 'message': $currField = $value."\n\n"; break; case 'name': $currField = "From: ".$value."\n\n"; $fromName = $value; break; case 'email': $currField = "Email: ".$value; $fromEmail = $value; break; } $message = $currField.$message; } $message = stripslashes($message); $to = "info@*******.co.uk"; $subject = "Message from ******* website"; $additional_headers = 'From: '.$fromName.' <'.$fromEmail.">\r\n".'Bcc: ***@*******.co.uk'; $mailOK = mail($to, $subject, $message, $additional_headers); if ($mailOK) { echo 'Message=Thank you, your message has been received.'; }else{ echo "Message=Sorry, your request couldn't be sent at this time, please try later."; } ?> Link to comment https://forums.phpfreaks.com/topic/220505-unexpected-characters-in-user-message/#findComment-1142574 Share on other sites More sharing options...
btherl Posted December 5, 2010 Share Posted December 5, 2010 That code looks ok to me.. is the "@" getting converted in the body of the email? Or is it in the headers? Link to comment https://forums.phpfreaks.com/topic/220505-unexpected-characters-in-user-message/#findComment-1143379 Share on other sites More sharing options...
invictusBob Posted December 7, 2010 Author Share Posted December 7, 2010 I've only seen in the body. Link to comment https://forums.phpfreaks.com/topic/220505-unexpected-characters-in-user-message/#findComment-1143920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.