电子邮件将发送到垃圾邮件

问题描述 投票:1回答:2

我一直在我的应用程序中使用这个SDK来发送电子邮件。

我尝试在hotmail中向我的私人电子邮件地址发送电子邮件,但已发送给垃圾邮件。

<?php
// If you are using Composer
require 'vendor/autoload.php';

$from = new SendGrid\Email(null, "[email protected]");
$subject = "Hello World from the SendGrid PHP Library";
$to = new SendGrid\Email(null, "[email protected]");
$content = new SendGrid\Content("text/plain", "some text here");
$mail = new SendGrid\Mail($from, $subject, $to, $content);

$apiKey = getenv('SENDGRID_API_KEY');
$sg = new \SendGrid($apiKey);

$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body();

但是,如果我将发件人地址更改为“[email protected]”,则可能会将其发送到收件箱。为什么会这样?

谢谢。

sendgrid
2个回答
1
投票

我注意到gmail在将内容放入垃圾邮件文件夹方面更加积极。 SendGrid具有包含DKIM记录的设置。我建议你确认你的设置是否正确。

https://sendgrid.com/docs/Glossary/dkim.html


0
投票

这很可能是由于Microsoft强制执行比Gmail更严格的DMARC政策。您的原始IP地址不允许代表hotmail.com发送电子邮件,因为hotmail.com SPF和DKIM记录不包含它。这会导致DMARC失败,这意味着严格的策略会丢弃或破坏电子邮件。电子邮件接收者之间的趋势是实施严格的DMARC政策以打击网络钓鱼。一般来说,从您无法控制的域发送电子邮件并不是一个可行的长期策略。

© www.soinside.com 2019 - 2024. All rights reserved.