发送邮件去垃圾邮件文件夹? [英] Sent mail going to spam folder?

查看:152
本文介绍了发送邮件去垃圾邮件文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了这个话题,但对我来说没什么用的。



代码:

  sendActivation($ name,$ user,$ pass,$ activationKey)
{
$ to = $ user;
$ subject ='帐户激活';
$ headers =From:noreply@domain.tld\r\\\
;
$ headers。=MIME-Version:1.0\r\\\
;
$ headers。=Content-Type:text / html; charset = UTF-8\r\\\
;
$ message =< div id ='mail'style ='height:auto; width:500px; background-color:#DDDDDD; font-family:Tahoma,Arial,sans-serif;'> $您的详细资料:< / p>
< p>用户名:$ user< p>
< p> ; / p>
< p>密码:$ pass< / p>
< p>< br />< / p>
< p>一个激活链接,请点击它激活您的帐户
如果您未在24小时内激活您的帐户,您的帐户将被自动删除。< / p>
< p> < a href ='。 BASE_PATH。 / register / activation / $ user / $ activationKey'>激活您的帐户!< / a>< / p>
< / div>;

if(mail($ to,$ subject,$ message,$ headers))
return true;
返回false;
}

错误在哪里?

解决方案

邮件与垃圾邮件很少有很大关系,除非你发送垃圾内容。



http://www.codinghorror。 com / blog / 2010/04 / so-youd-like-to-send-some-email-through-code.html


  1. 确保发送电子邮件的计算机具有反向PTR记录

  2. 在DNS和代码中配置DomainKeys标识的邮件

  3. 设置SenderID记录在您的DNS

您还应该看到您的服务器是否在任何黑名单,使用类似这个黑名单检查器。如果你在一个人,没有任何事情会帮助你清理清单。


I searched this topic but there wasn't anything useful for me.

CODE:

public function sendActivation($name, $user, $pass, $activationKey)
{
    $to = $user;
    $subject = 'Account Activation';
    $headers = "From: noreply@domain.tld\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
    $message = "<div id='mail' style='height: auto; width: 500px;background-color: #DDDDDD; font-family: Tahoma, Arial, sans-serif;'>
    <p>Hello dear $name and thanks for your choise!</p>
    <p>Your details:</p>
    <p>Username: $user</p>
    <p>Password: $pass</p>
    <p><br /></p>
    <p>Here there is an activation link. Please click on it to activate your account.
    If you don't activate your account in next 24 hours, your account will be deleted automaticly.</p>
    <p><a href='" . BASE_PATH. "/register/activation/$user/$activationKey'>Activate Your Account!</a></p>
    </div>";

    if (mail($to, $subject, $message, $headers))
        return true;
    return false;
}

Where is the mistake?

解决方案

Mail going to spam rarely has much to do with the code, unless you're sending spammy content.

http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html

  1. Make sure the computer sending the email has a Reverse PTR record
  2. Configure DomainKeys Identified Mail in your DNS and code
  3. Set up a SenderID record in your DNS

You should also see if your server is on any blacklists, using something like this blacklist checker. If you're on one, nothing you're doing is going to help until you get the listing cleared up.

这篇关于发送邮件去垃圾邮件文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆