php - Gmail 不接受包含链接的电子邮件
php - Gmail doesn't accept emails that contains links
我正在使用 PHPmailer 向在我的网站上注册的人发送包含激活码的电子邮件。 Yahoo! 一切正常但不适用于 Gmail。
我的 PHP 脚本没有错误。一切看起来都很好。
我试图从电子邮件文本中删除所有 links 并将其替换为 'rrrrrrr' 之类的随机字符串并且它起作用了,我在我的邮箱中收到了邮件。
这只发生在 Gmail 上。有谁知道如何克服这个问题?
另外,我在 hostinger.com 上托管我的网站,但我目前正在使用 wampserver
在本地主机上测试 PHPmailer
编辑:我的网站是 http://www.pascal-tweaks.esy.es/ 我不认为它看起来像垃圾邮件 link。
我在垃圾邮件文件夹中找到了我的电子邮件,但我必须说两天前它在 Gmail 上运行良好并且我在我的邮箱中收到了它们。我想也许他们最近决定不再相信 link 这样的人了?
我仍然想要另一个解决方案,因为我不想让我网站的用户费心去垃圾邮件文件夹:(
这是我的代码,$email_sent 始终为真:
$toemail = $_SESSION['toemail'];
$nom = $_SESSION['name'];
$email_color = $_SESSION['email_color'];
$email_theme = $_SESSION['email_theme'];
$index = $_SESSION['index'];
$code = $_SESSION['code'];
$smtphost = 'smtp.topnet.tn';
$smtpport = 25;
$dom = 'http://www.mydomain.esy.es';
$from = 'mydomain@support.com';
$fromname = 'mywebsite';
$subj = 'signing in';
$greating = 'Thank you for registering!';
$htmlbody =
'<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>' . $greating . '</title>
</head>
<body style="margin:0;padding:10px 0;">
<div style="width:450px;height:450px;max-height:450px;border:1px solid ' . $email_color . ';border-radius:260px;background-image:url(\'' . $dom . '/cssjs/theme' . $email_theme . '.jpg\');background-size:cover;box-shadow:0 0 22px 2px ' . $email_color . ';margin:30px auto;overflow:hidden;">
<div style="height:78px;max-height:78px;width:350px;color:' . $email_color . ';margin:60px auto 54px auto;text-align:center;font-family:\'Cordia New\', \'Aparajita\';text-shadow:1px 1px 4px gray;">
<div style="font-size:52px;height:52px;max-height:52px;"><a style="text-decoration:none;color:' . $email_color . ';" href="' . $dom . '" target="_blank">My WebSite Name</a></div>
<div style="font-size:26px;height:26px;max-height:26px;">Welcome to my website!</div>
</div>
<div style="text-shadow:0 0 1px gray;background-image:url(\'' . $dom . '/cssjs/t_white.png\');width:429;height:238px;border-radius:8px 8px 260px 260px;padding:10px;font-family:\'Cordia New\', \'Aparajita\';">
<div style="margin:15px auto;font-size:22px;line-height:22px;text-align:center;width:400px;">' . $greating . ' <br/>' . $nom . ' !</div>
<div style="margin:15px auto;font-size:19px;line-height:19px;text-align:center;width:400px;">In order to activate your account, you must follow this link : <a href="' . $dom . '/activate.php?d=' . $index . '" target="_blank">' . $dom . '/activate_account</a><br/>Your activation code :<br/>' . $code . '</div>
</div>
</div>
</body>
</html>';
$altbody = $greating . ' ' . $nom . ' !' . "\r\n" .
'In order to activate your account, you must follow this link :' . "\r\n" .
'Activation link : ' . $dom . '/activate.php?d=' . $index . "\r\n" .
'Activation code : ' . $code;
require_once ($webdir . '/PHPMailer-master/PHPMailerAutoload.php');
$activation_mail = new PHPMailer;
$activation_mail->isSMTP();
$activation_mail->Host = $smtphost;
$activation_mail->Port = $smtpport;
$activation_mail->From = $from;
$activation_mail->FromName = $fromname;
$activation_mail->SetFrom($from, $fromname);
$activation_mail->addAddress($toemail);
$activation_mail->addReplyTo($from, $fromname);
$activation_mail->isHTML(true);
$activation_mail->CharSet = 'UTF-8';
$activation_mail->Subject = $subj;
$activation_mail->Body = $htmlbody;
$activation_mail->AltBody = $altbody;
if($activation_mail->send()){
$email_sent = true;
}
else{
$email_sent = false;
}
1.) 您的网站 http://www.pascal-tweaks.esy.es/ 由免费域名提供商托管。我认为这是在垃圾邮件文件夹中接收邮件的原因之一。
2.) 当你 post 你的网站在 facebook 墙上或者你给任何人发消息时,试试这个,它会询问你安全检查或验证码..
所以也许是因为 gmail 没有显示 link ..
谢谢..
我正在使用 PHPmailer 向在我的网站上注册的人发送包含激活码的电子邮件。 Yahoo! 一切正常但不适用于 Gmail。 我的 PHP 脚本没有错误。一切看起来都很好。 我试图从电子邮件文本中删除所有 links 并将其替换为 'rrrrrrr' 之类的随机字符串并且它起作用了,我在我的邮箱中收到了邮件。 这只发生在 Gmail 上。有谁知道如何克服这个问题? 另外,我在 hostinger.com 上托管我的网站,但我目前正在使用 wampserver
在本地主机上测试 PHPmailer编辑:我的网站是 http://www.pascal-tweaks.esy.es/ 我不认为它看起来像垃圾邮件 link。 我在垃圾邮件文件夹中找到了我的电子邮件,但我必须说两天前它在 Gmail 上运行良好并且我在我的邮箱中收到了它们。我想也许他们最近决定不再相信 link 这样的人了? 我仍然想要另一个解决方案,因为我不想让我网站的用户费心去垃圾邮件文件夹:(
这是我的代码,$email_sent 始终为真:
$toemail = $_SESSION['toemail'];
$nom = $_SESSION['name'];
$email_color = $_SESSION['email_color'];
$email_theme = $_SESSION['email_theme'];
$index = $_SESSION['index'];
$code = $_SESSION['code'];
$smtphost = 'smtp.topnet.tn';
$smtpport = 25;
$dom = 'http://www.mydomain.esy.es';
$from = 'mydomain@support.com';
$fromname = 'mywebsite';
$subj = 'signing in';
$greating = 'Thank you for registering!';
$htmlbody =
'<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>' . $greating . '</title>
</head>
<body style="margin:0;padding:10px 0;">
<div style="width:450px;height:450px;max-height:450px;border:1px solid ' . $email_color . ';border-radius:260px;background-image:url(\'' . $dom . '/cssjs/theme' . $email_theme . '.jpg\');background-size:cover;box-shadow:0 0 22px 2px ' . $email_color . ';margin:30px auto;overflow:hidden;">
<div style="height:78px;max-height:78px;width:350px;color:' . $email_color . ';margin:60px auto 54px auto;text-align:center;font-family:\'Cordia New\', \'Aparajita\';text-shadow:1px 1px 4px gray;">
<div style="font-size:52px;height:52px;max-height:52px;"><a style="text-decoration:none;color:' . $email_color . ';" href="' . $dom . '" target="_blank">My WebSite Name</a></div>
<div style="font-size:26px;height:26px;max-height:26px;">Welcome to my website!</div>
</div>
<div style="text-shadow:0 0 1px gray;background-image:url(\'' . $dom . '/cssjs/t_white.png\');width:429;height:238px;border-radius:8px 8px 260px 260px;padding:10px;font-family:\'Cordia New\', \'Aparajita\';">
<div style="margin:15px auto;font-size:22px;line-height:22px;text-align:center;width:400px;">' . $greating . ' <br/>' . $nom . ' !</div>
<div style="margin:15px auto;font-size:19px;line-height:19px;text-align:center;width:400px;">In order to activate your account, you must follow this link : <a href="' . $dom . '/activate.php?d=' . $index . '" target="_blank">' . $dom . '/activate_account</a><br/>Your activation code :<br/>' . $code . '</div>
</div>
</div>
</body>
</html>';
$altbody = $greating . ' ' . $nom . ' !' . "\r\n" .
'In order to activate your account, you must follow this link :' . "\r\n" .
'Activation link : ' . $dom . '/activate.php?d=' . $index . "\r\n" .
'Activation code : ' . $code;
require_once ($webdir . '/PHPMailer-master/PHPMailerAutoload.php');
$activation_mail = new PHPMailer;
$activation_mail->isSMTP();
$activation_mail->Host = $smtphost;
$activation_mail->Port = $smtpport;
$activation_mail->From = $from;
$activation_mail->FromName = $fromname;
$activation_mail->SetFrom($from, $fromname);
$activation_mail->addAddress($toemail);
$activation_mail->addReplyTo($from, $fromname);
$activation_mail->isHTML(true);
$activation_mail->CharSet = 'UTF-8';
$activation_mail->Subject = $subj;
$activation_mail->Body = $htmlbody;
$activation_mail->AltBody = $altbody;
if($activation_mail->send()){
$email_sent = true;
}
else{
$email_sent = false;
}
1.) 您的网站 http://www.pascal-tweaks.esy.es/ 由免费域名提供商托管。我认为这是在垃圾邮件文件夹中接收邮件的原因之一。 2.) 当你 post 你的网站在 facebook 墙上或者你给任何人发消息时,试试这个,它会询问你安全检查或验证码.. 所以也许是因为 gmail 没有显示 link .. 谢谢..