I'm sending e-mails through a form I coded and for some reason, for some cases the e-mail address becomes junk, and for other times it works fine.
//on form page
$message = str_replace("@e",$emtemail,$message);
$message is stored in SQL (defined on another page), same for $emtemail. $message is just the body of the e-mail being sent, and I'm replacing all instances of @e
with the e-mail people send payments to. It sends one e-mail to the customer, and one e-mail to me.
//customer e-mail
//the display address might appear as payment52.62gmail.com instead of payment@gmail.com
//my e-mail
//all e-mail addresses formatted properly without error, @ appears as @
Why do e-mail addresses parse strangely? Something to do with encoding?
This is all of the code relevant to sending e-mails I have. I can't pinpoint the problem.
//any variables used in the below but not declared are previously initialized
$em = $userc["email"];
$subject = $emailone["subject"];
$subject = str_replace("@o",$ordernum,$subject);
$subject = str_replace("@u",htmlspecialchars($rn),$subject);
$subject = str_replace("@g",$gt,$subject);
$subject = str_replace("@sl","www.SZVapor.com",$subject);
$subject = str_replace("@ss","SZVapor.com",$subject);
$subject = str_replace("@st","SZVapor",$subject);
$message = nl2br($emailone["message"]);
$message = str_replace("@o",$ordernum,$message);
$message = str_replace("@u",htmlspecialchars($rn),$message);
$message = str_replace("@t",$table,$message);
$message = str_replace("@e",$emtemail,$message);
$message = str_replace("@g",$gt,$message);
$message = str_replace("@a",$addrsubmit,$message);
$message = str_replace("@sl","www.SZVapor.com",$message);
$message = str_replace("@ss","SZVapor.com",$message);
$message = str_replace("@st","SZVapor",$message);
$message = str_replace("@c",$em,$message);
$headers = "MIME-Version: 1.0"."
";
$headers .= "Content-type: text/html; charset=iso-8859-1"."
";
$headers .= "From: no-reply@SZVapor.com";
mail($em, $subject, $message, $headers);
Some examples of e-mail addresses given:
payment62.44gmail.com
payment54.45gmail.com
payment22.59gmail.com
payment25.49gmail.com