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? Quote Link to comment Share on other sites More sharing options...
btherl Posted December 2, 2010 Share Posted December 2, 2010 Can you please post your code. Quote Link to comment 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."; } ?> Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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.