为什么 SMTP API 可以使用任意发件人地址?如何将我的电子邮件列入黑名单?

Why can SMTP APIs use any from address? How can I blacklist my email?

我正在使用 SendGrid 的 SMTP API,我意识到我可以将发件人地址设置为任何电子邮件。

我觉得这很令人担忧。很明显,任何拥有 SMTP API 的人都可以开始假装我发送电子邮件。

有什么方法可以将我的电子邮件或一组电子邮件添加到 "SMTP Blacklist"?

from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

message = Mail(
    from_email='any@from.email',
    to_emails='any@to.email',
    subject='Title',
    html_content='Hello world')
try:
    sg = SendGridAPIClient('FREE_API_KEY')
    response = sg.send(message)
    print(response.status_code)
    print(response.body)
    print(response.headers)
except Exception as e:
    print(e.message)

阅读 DMARC 和 SPF 记录。这两个 "solutions" 使未经授权的电子邮件更难成功发送。

编辑:另请阅读 DKIM。