我知道已经有人质疑为什么邮件会被发送到垃圾邮件。但我看到的所有答案都是他们需要首先验证他们的域名。
如果我们在我们的域中登录webmail并直接从那里发送电子邮件,那么它会进入接收者的收件箱。但是当我们从第三方应用程序发送电子邮件时,例如php邮件程序。它将被发送到垃圾邮件中。
我们使用mailchimp对我们的域进行身份验证,但我们的电子邮件仍然是垃圾邮件。我们使用了一个简单的phpmailer设置示例。
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Load composer's autoloader
require 'src/Exception.php';
require 'src/PHPMailer.php';
require 'src/SMTP.php';
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
$mail->SMTPDebug = 2;
$mail->ismail();
$mail->Host = 'localhost'; // Specify main and backup SMTP servers
//Recipients
$mail->setFrom('info@homecentra.com');
$mail->addAddress('receiver.homecentra@gmail.com'); // Add a recipient
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the 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->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
哦,仅仅是为了获取信息,该电子邮件仅向Gmail用户发送垃圾邮件,如果它发送给雅虎或其他电子邮件提供商,它仍会发送到收件箱。我们的电子邮件仅在最近发送垃圾邮件,在我们使用相同的东西之前,即使没有对mailchimp进行身份验证,它也会进入收件箱。我们希望您能给我们一个解决方案
此处证明我们的域名已经过验证 enter image description here