2013-11-24 55 views
0

我通过我编码的表单发送电子邮件,出于某种原因,某些情况下电子邮件地址变成垃圾邮件,并且在其他时间工作正常。电子邮件解析垃圾邮件地址

//on form page 
$message = str_replace("@e",$emtemail,$message); 

$ message存储在SQL(定义在另一页上),与$ emtemail相同。 $ message只是正在发送的电子邮件的正文,我将用人们发送付款的电子邮件替换@e的所有实例。它向客户发送一封电子邮件,并向我发送一封电子邮件。

//customer e-mail 
//the display address might appear as payment52.62gmail.com instead of [email protected] 
//my e-mail 
//all e-mail addresses formatted properly without error, @ appears as @ 

为什么电子邮件地址解析奇怪?与编码有关吗?

这是与发送电子邮件相关的所有代码。我无法找出问题所在。

//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"."\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1"."\r\n"; 
$headers .= "From: [email protected]"; 
mail($em, $subject, $message, $headers); 

给出的电子邮件地址的一些例子:

payment62.44gmail.com 
payment54.45gmail.com 
payment22.59gmail.com 
payment25.49gmail.com 

回答

1

http://php.net/manual/en/function.mail.php

邮件的第一个参数条目的电子邮件地址。

上面的代码不会$ EM

顺便说做任何事情,我认为最后的标题行应该是这样的:

$headers .= "From: [email protected]" . "\r\n"; 
+0

$ em确实在之前的代码中定义,这只是我用来替换字符串的东西的复杂。这段代码中有一个问题,不管前面定义的$ em,$ rn等。用户收到电子邮件(因为定义了$ em),它只是在电子邮件正文中显示电子邮件。 – gator

0

我解决了这个问题,它是我的错误。我用变量替换了某些字符组合的所有实例。

@g = replaced with grand total 
@e = replaced with payment e-mail 
@o = replaced with order number 
etc 

我做他们就是这样,我取代@e与电子邮件[email protected],然后替换为总计所有@g顺序,以支付* @g * mail.com成为"payment".$grandtotal."mail.com"