【问题标题】:Sending emails as company domain from SendGrid从 SendGrid 以公司域的形式发送电子邮件
【发布时间】:2016-03-01 19:35:03
【问题描述】:

我拥有一个域 example.com。我想从我的 webapp 发送电子邮件,它显示来自 info@example.comsupport@example.com

我过去在我的网站中使用过很多 SendGrid,但我总是能够通过编辑 From 类的 From 属性来填写电子邮件的来源,并且它只是以这种方式出现在客户身上。

sendgrid 是否有官方方式/API 来使用我拥有的域?是什么阻止我或其他人使用 sendgrid API 输入他们想要的任何域?

【问题讨论】:

    标签: c# azure sendgrid


    【解决方案1】:

    为您的域设置 DNS 记录以允许对您的电子邮件进行身份验证以及验证您对域的所有权的过程在 SendGrid 中称为whitelabeling。在此过程之后,SPF 和 DKIM 记录将可供接收服务器检查。

    SPFDKIM 确保允许发起 IP 代表相关域发送电子邮件,并分别从本质上验证电子邮件的内容没有被篡改。

    阻止其他人从您的域发送的东西称为DMARC。 yahoo、aol 和很快 google 拥有的域名都执行严格的政策;声称来自这些域但不是来自这些域的电子邮件将永远不会被传递。许多其他域很快就会跟随这一趋势并实施 DMARC。

    【讨论】:

    • 非常感谢。因此,当我输入一个非常流行的已知域(如 whitehouse.gov)并将其发送给内部的同事时,它可以正常工作,因为我们的邮件服务器没有执行 DMARC?
    • 之所以有效,是因为您使用的域 (whitehouse.gov) 没有实现 DMARC,或者该域的 DMARC 记录指定了 p=none 策略,因此失败的 SPF 和 DKIM 无关紧要
    【解决方案2】:

    https://azure.microsoft.com/en-us/documentation/articles/sendgrid-dotnet-how-to-send-email/ 的代码示例显示了如何执行此操作:

    // Create the email object first, then add the properties.
    var myMessage = new SendGridMessage();
    
    // Add the message properties.
    myMessage.From = new MailAddress("john@example.com");
    
    // Add multiple addresses to the To field.
    List<String> recipients = new List<String>
    {
        @"Jeff Smith <jeff@example.com>",
        @"Anna Lidman <anna@example.com>",
        @"Peter Saddow <peter@example.com>"
    };
    
    myMessage.AddTo(recipients);
    
    myMessage.Subject = "Testing the SendGrid Library";
    
    //Add the HTML and Text bodies
    myMessage.Html = "<p>Hello World!</p>";
    myMessage.Text = "Hello World plain text!";
    

    【讨论】:

    • 我可能遗漏了您所指的内容,但我试图具体说明我的一个问题,What's to stop me or someone else from typing any domain they want using the sendgrid API?。我可以简单地在From 中输入obama@whitehouse.gov。我正在寻找比这更合适(?)的东西。
    • 对不起;我完全误解了你的问题。
    • 一切顺利!我可能不是很清楚。感谢您抽出时间提供帮助。我很感激!
    猜你喜欢
    • 1970-01-01
    • 2014-04-28
    • 2020-06-28
    • 1970-01-01
    • 2018-11-08
    • 1970-01-01
    • 1970-01-01
    • 2018-08-09
    • 1970-01-01
    相关资源
    最近更新 更多