phpMailer不发送邮件到hotmail帐户 [英] phpMailer doesn't send emails to hotmail account

查看:271
本文介绍了phpMailer不发送邮件到hotmail帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHPMailer发送电子邮件。我正在尝试向Hotmail帐户发送电子邮件,但如果收件人的发件人处于联系人中,则会收到该邮件。如果收件人没有联系人的发件人,则它不会收到电子邮件。

I'm using PHPMailer to send emails. I'm trying to send an email to an Hotmail account but if the recipient has the sender in contacts, it receives the email. If the recipient doesn't have the sender in contacts, it doesn't receive the email.

为什么?什么事?

PHPMailer不显示任何错误。

PHPMailer doesn't show any errors.

我已经尝试了很多解决方案在网络中提出没有任何结果。

I have tried a lot of solutions proposed in the network without any result.

这是我使用的代码:

public static function invia_email_bis($p_nome_mitt, $p_mitt, $p_dest, $p_ccn, $p_oggetto, $p_header, $p_mess) {

    //Se siamo in sviluppo, le email non devono partire. L'ambiente lo rileviamo dal DB
    $config =& JFactory::getConfig();
    if ($config->getValue( 'config.db' ) == 'fantaonl_dev') {
        return;
    }

    $email_par = email::get_parameter(costanti::actaccount);

    //Creazione dell'oggetto PHPMAILER
    $messaggio = new PHPmailer();

    //Abilitiamo SMTP
    $messaggio->IsSMTP();

    //Abilitiamo l'autenticazione
    $messaggio->SMTPAuth = true;  

    //Abilitiamo il protocollo SSL 
    if ( $email_par['PORTA'] == 587 ) {         
        $messaggio->SMTPSecure = "tls";
    }

    if ( $email_par['PORTA'] == 465 ) {         
        $messaggio->SMTPSecure = "ssl";
    }

    //Server SMTP
    $messaggio->Host = $email_par['SMTP'];      
    $messaggio->Username = $email_par['USERNAME'];
    $messaggio->Password = $email_par['PASSWORD'];

    //Porta 
    $messaggio->Port = $email_par['PORTA'];

    //Definiamo le intestazioni e il corpo del messaggio
    $messaggio->FromName = $p_nome_mitt;
    $messaggio->From = $p_mitt;

    //$messaggio->SMTPDebug  = 1;
    //$messaggio->Debugoutput = 'html';

    //DESTINATARIO
    if ($p_ccn == false) {      
        for ($t = 0; $t < count($p_dest); $t++) {
            if ($p_dest[$t]['EMAIL'] != '') { $messaggio->AddAddress($p_dest[$t]['EMAIL']); }
            elseif ($p_dest[$t]['email'] != '') { $messaggio->AddAddress($p_dest[$t]['email']); }
        }
    }
    else {
        for ($t = 0; $t < count($p_dest); $t++) {
            if ($p_dest[$t]['EMAIL'] != '') { $messaggio->AddBCC($p_dest[$t]['EMAIL']); }
            elseif ($p_dest[$t]['email'] != '') { $messaggio->AddBCC($p_dest[$t]['email']); }
            }
    }



    //DESTINATARIO IN CCN
    //$mail->AddBCC($p_dest);

    //MITTENTE
    $messaggio->AddReplyTo($p_mitt, $p_nome_mitt); 

    //OGGETTO MESSAGGIO
    $messaggio->Subject=$p_oggetto;

    //Il Messaggio Ë in HTML
    $messaggio->IsHTML(true);                               
    $path_html = $_SERVER['DOCUMENT_ROOT'] . '/jumi_includes/class/template_email.html';
    $message_body = file_get_contents($path_html);

    $message_body = str_replace('%titolo%', $p_header, $message_body);      
    $message_body = str_replace('%messaggio%', $p_mess, $message_body);


    $path_img = $_SERVER['DOCUMENT_ROOT'] . '/templates/sitodefinitivodue/images/header.jpg';
    //Path immagine da caricare
    $messaggio->AddEmbeddedImage($path_img, 'header', 'header.jpg', 'base64', 'image/jpeg');                

    //CORPO MESSAGGIO       
    $messaggio->MsgHTML($message_body);
    $messaggio->AltBody = $p_mess;


    //Definiamo i comportamenti in caso di invio corretto 
    //o di errore
    if(!$messaggio->Send()){ 
        $esito =  4;
        //echo $messaggio->ErrorInfo;
    }else{ 
        $esito = 0;
    }

    //chiudiamo la connessione
    $messaggio->SmtpClose();
    unset($messaggio);
    return $esito;
}


推荐答案

这是hotmails spamfilter谁踢今天你不能只是发送电子邮件,认为它会一路走来。
要躲避Hotmails / gmails垃圾邮件过滤器,您必须:

It's hotmails spamfilter who kicks in. Nowdays you can't just starting send e-mails and think it will get all the way. To dodge hotmails/gmails spam filter you must:


  • 不符合美国2003年CAN-SPAM法案:

  • Oblige to USA's CAN-SPAM Act of 2003 witch includes:


  • 不要使用欺骗性标题,来自名称,回覆或主题行。

  • 您必须始终提供取消订阅链接。

  • 在10个工作日内从列表中删除收件人。

  • 取消订阅链接必须至少工作30发送后的天数。

  • 您必须包含您的实际邮寄地址。要了解更多信息,请访问ftc.gov。

  • Never use deceptive headers, from-names, reply-tos, or subject lines.
  • You must always provide an unsubscribe link.
  • Remove recipients from your list within 10 business days.
  • The unsubscribe link must work for at least 30 days after sending.
  • You must include your physical mailing address. To learn more, go to ftc.gov.

从正确的服务器发送,如果您使用的SMTP服务器没有任何与您使用的域名的东西将被阻止。如果你发送一个no-reply@test.com并且不使用正确的smtp,它将被阻止,如果你继续你的smtp服务器可以是列入黑名单,如果你使用ISP或任何其他服务器他们不会很高兴。

Send from the correct server, if the SMTP-server you are using dosn't have anything with the domain name you are using it will be blocked. If you send a no-reply@test.com and don't use the correct smtp it will be blocked, and if you continue your smtp server can be blacklisted and if you use an ISP or any other server they will not be happy about it.

垃圾邮件过滤器不是垃圾邮件,现在分析文本,并尝试确定您的邮件是否是垃圾邮件。如果您发送大量相同的按摩只需要小的文本更改,您的邮件将得分更高。喜欢:你好[Mike],看看我们的新产品等等。避免使用常见的垃圾邮件词,如e点击这里!或免费!立即购买!等等或明亮的颜色,许多感叹号,vad html等。

Not be "spam", spamfilter nowdays analyses the text and tries to figure out if your mail is spam. If you send alot of the same massage with just small text changes your mail will score higher. Like: Hello [Mike], look at our new products etc etc. Avoid using common spam words like e CLICK HERE! or FREE! BUY NOW! etc or bright colors, lots of exclamation, vad html etc.

没有bulletproff的方式来避免垃圾邮件过滤器如果您的收件箱将不会被垃圾邮件填满。

There is no bulletproff way to avoid a spam filter, if it would your inbox would be filled with spam in no time.

Will Weatons规则适用于此(与SEO一样):不要是家伙。

Will Weatons rule apply here (as with SEO): Don't be a dick.

这篇关于phpMailer不发送邮件到hotmail帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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