【问题标题】:PHPMailer mails goes straight to Spam [duplicate]PHPMailer邮件直接进入垃圾邮件[重复]
【发布时间】:2017-02-03 11:29:32
【问题描述】:

情况:

使用 PHPMailer 在 php 中编写一个函数,用于为网站发送帐户激活邮件。

问题:

我所有的邮件都直接进入垃圾邮件文件夹而不是收件箱。只有 gmail 地址才能正确接收我的邮件。

我的代码:

<?php 
 /********************************************************************************************************************************
File:   sendmail.php
Author: Burtscher Florian
Date:   02.02.2017
Description:
    This file contains the sendmail functions for mailing noreply messages to EmailClients.
***************************************************************************************************************************/

require 'PHPMailer-master/PHPMailerAutoload.php';


$result = sendmail('asdf','asdf','asdf','asdf');

if(!$result){
   echo $result;
}


function sendmail($to,$subject,$message,$name){
  $mail = new PHPMailer;

  //$mail->SMTPDebug = 3;

  $mail->isSMTP();    // Set mailer to use SMTP
  $mail->Host = 'smtp.world4you.com';                //'smtp1.example.com;smtp2.example.com';      // Specifay main and backup SMTP server 
  $mail->SMTPAuth = true;                                                                    // Enable SMTP authentication
  $mail->Username = 'activation@scritex.com';
  $mail->Password = '*************';
  $mail->SMTPSecure = 'tls';
  $mail->Port = 587;                                                                   // TCP port to connect

  $mail->setFrom('activation@scritex.com', 'Activation');
  $mail->addAddress('mytestmail1111@dkimvalidator.com', 'Florian Burtscher');         // Add a recipient
  $mail->addReplyTo('activation@scritex.com', 'Office');                              // Add Reply To

  $mail->isHTML(true);

  $mail->Subject = 'Here is a Subject';
  $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

  $mail->DKIM_domain = 'scritex.com';
  $mail->DKIM_private = '.htkeyprivate';
  $mail->DKIM_selector = 'dkim11';
  $mail->DKIM_passphrase = '1486107933';

  if(!$mail->send()){
    return $mail->ErrorInfo;
  }else{
    return true;
  }
}
?>

结果:

我不知道该怎么做。 有谁知道这个问题吗?

我所有的邮件都通过 hotmail、outlook、yahoo、gmx、aon、msn 发送到 spam

【问题讨论】:

标签: php email phpmailer spf dkim


【解决方案1】:

发件人服务域被列入黑名单。尝试使用另一个 smtp 服务。如果这样做没有帮助,您正在使用的域 (scritex.com) 可能会被列入黑名单。从那里有 2 种可能的解决方案: 1. 将您的域列入白名单(有几个服务可以做到这一点,但这是一个漫长而烦人的过程)。 2. 使用另一个域

【讨论】:

    猜你喜欢
    • 2013-05-19
    • 2014-07-23
    • 2011-08-22
    • 1970-01-01
    • 2014-02-18
    • 2020-09-17
    • 2013-05-29
    • 1970-01-01
    • 2013-08-02
    相关资源
    最近更新 更多