如何在 Windows Server 2019 上启用 DKIM 电子邮件验证,以便通过 SMTP 服务发送经过 DKIM 验证的电子邮件?

如何在 Windows Server 2019 上启用 DKIM 电子邮件验证,以便通过 SMTP 服务发送经过 DKIM 验证的电子邮件?

我正在从我的域发送激活和验证电子邮件:https://www.monstermmorpg.com/

最近我搬到了一个新装置

新的服务器是:Windows Server 2019

我如何设置正确的 DKIM?

此外,gmail 表示该邮件未加密

我如何加密消息?

我彻底搜索了互联网,但找不到如何在启用 SSL 的情况下通过 SMTP 发送电子邮件

寻求帮助谢谢

这是我当前用于发送电子邮件的 C# 代码

            using (MailMessage Email = new MailMessage(new MailAddress("[email protected]", srFrom), new MailAddress(srEmailAddress)))
        {
            Email.IsBodyHtml = true;
            Email.SubjectEncoding = Encoding.UTF8;
            Email.BodyEncoding = Encoding.UTF8;
            Email.Subject = srSubject;
            Email.ReplyTo = new MailAddress("[email protected]", "MonsterMMORPG Administrator");
            using (AlternateView textPart = AlternateView.CreateAlternateViewFromString(srBodyText, Encoding.UTF8, "text/plain"))
            {
                using (AlternateView htmlPart = AlternateView.CreateAlternateViewFromString(srBodyHTML, Encoding.UTF8, "text/html"))
                {
                    textPart.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
                    Email.AlternateViews.Add(textPart);

                    htmlPart.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
                    Email.AlternateViews.Add(htmlPart);

                    using (SmtpClient smtpClient = new SmtpClient("127.0.0.1", 25))
                    {
                        smtpClient.Send(Email);                            
                        return "True";
                    }
                }
            }
        }

来自 gmail 收到的电子邮件源代码

    Delivered-To: [email protected]
Received: by 2002:a2e:3217:0:0:0:0:0 with SMTP id y23csp506469ljy;
        Fri, 14 May 2021 09:06:00 -0700 (PDT)
X-Google-Smtp-Source: ABdhPJzjZd6rMp/pnpxKsq1L06bwDvzbj8muKWN6+nFTLZU75Q7umGzQxkkil5RdVKUXcPvQCYe+
X-Received: by 2002:a67:f612:: with SMTP id k18mr36628964vso.14.1621008359976;
        Fri, 14 May 2021 09:05:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1621008359; cv=none;
        d=google.com; s=arc-20160816;
        b=MfAvouyS6gARsLUkbkExyiliKm5JTjKiQyJneWOJ+ClrDqYnHYAnOR9+sd5DGHqAHQ
         B1uFRt+e8zPmi9BjiMrlzmU6vbBduXIe5XqpuZln9iUj6p3UvzM5RYwLfLgWru2kiU7L
         4JHw/qL0+u7EU2/7ONHY5OtzU6ky8y2zgHiBC+cymThrA/yrgf248TWxAjQ0kHbKggbD
         EeXPUmBEwZTYAYlI1BfRxeb3vMDd6fxddDuE9H2caU6FHmD2xZ/kqBsVYbAKIlb2kZsn
         wvL8cPoGL8PhoH+zW/SqSzjLdb4lxHqdmucUYlQDOKXhtYOWrmwGbTv5p3U5QvgBG7+R
         +0Qg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=message-id:subject:date:reply-to:to:from:mime-version;
        bh=pl1glJA514sUYwdSYbJnqcj6IappZiIhLxbY8IS1skY=;
        b=gMouTK8xFFFUh2FegtyhVHu6EDZetSBQpyXKGTkzekmkQAMyv7GS3id5eC1hpxkOPI
         mMogftz7u7zVWHXxJld5AZwmdXAEyngNSQpRd1ejYPnLLihZ+4vnC25TMOSlDR4XSrV/
         EPfLkTAASP/+nMeNMBOkaZ04BHobfE4YOWaelRDdKJMfsIv/Q7kUlD2+x8sYIP5gYH1A
         IH3nxYIvc1krQhQiFapzplAaLTuw45JU514M2UHwxv48uqZsSo6xvM/66PVL8a4AM9QY
         oMZRFrNZbVs/jHOmfo7NmbhQKspmU6piBeikxXc62gEZrZscTjj1CnF1ExDOBYU4VTaR
         rClA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of [email protected] designates 198.154.81.18 as permitted sender) [email protected]
Return-Path: <[email protected]>
Received: from WIN-NKJ7NU5TC3R ([198.154.81.18])
        by mx.google.com with ESMTP id w2si4313304uau.70.2021.05.14.09.05.59
        for <[email protected]>;
        Fri, 14 May 2021 09:05:59 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates 198.154.81.18 as permitted sender) client-ip=198.154.81.18;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of [email protected] designates 198.154.81.18 as permitted sender) [email protected]
Received: from WIN-NKJ7NU5TC3R ([127.0.0.1]) by WIN-NKJ7NU5TC3R with Microsoft SMTPSVC(10.0.17763.1697);
     Fri, 14 May 2021 16:05:59 +0000
MIME-Version: 1.0
From: MonsterMMORPG <[email protected]>
To: [email protected]
Reply-To: MonsterMMORPG Administrator <[email protected]>
Date: 14 May 2021 16:05:59 +0000
Subject: MonsterMMORPG Email Verification - Account Activation
Content-Type: multipart/alternative; boundary=--boundary_0_1f9b8fcb-6eb3-4f2d-903e-a44c9cf7ecbf
Return-Path: [email protected]
Message-ID: <WIN-NKJ7NU5TC3RaJiR00000002@WIN-NKJ7NU5TC3R>
X-OriginalArrivalTime: 14 May 2021 16:05:59.0129 (UTC) FILETIME=[077B7C90:01D748DB]

----boundary_0_1f9b8fcb-6eb3-4f2d-903e-a44c9cf7ecbf
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

CeFurkan Welcome to MonsterMMORPG

在此处输入图片描述

答案1

Received: ... with Microsoft SMTPSVC(10.0.17763.1697);正在使用邮件传输协议

  • 由于 IIS SMTP 来自 IIS 6.0(代号“Duct Tape”,包含在 Windows Server 2003 中),并且自此之后没有更新,因此不支持 DKIM,之后生成(2005 年发布2007 年的第一个 RFC)。

  • 出站 TLS 加密(不是消息,而是过境加密!)可通过以下方式实现:

    1. Internet 信息服务 (IIS) 6.0 管理器
    2. [SMTP 虚拟服务器 #1] 属性
    3. 送货
    4. 出站安全...
    5. [x] TLS 加密

    IIS SMTP 出站 TLS

然而,让 Microsoft Exchange 或 Postfix 等功能齐全的电子邮件服务器同时处理 DKIM 和 TLS 会更好. 无需中间 IIS SMTP,使用SmtpClient 类,您可以在本地网络上发送未加密的消息,也可以利用来自SmtpClient.EnableSsl 属性

using (SmtpClient smtpClient = new SmtpClient("smtp.example.com", 25))
{
    smtpClient.EnableSsl = true;
    smtpClient.Send(Email);                            
    return "True";
}

相关内容