I am sending activation and verification emails from my domain : https://www.monstermmorpg.com/
Recently I have moved to a new installation
The new server is : Windows Server 2019
How can I set a proper DKIM?
Moreover, gmail tells that the message is not encrypted
How can I encrypt messages?
I have thoroughly searched the internet and I couldn't find how to send email by SMTP when SSL is enabled
Looking for help thank you
This is my current C# code to send email
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";
}
}
}
}
The received email source code from 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
The
Received: ... with Microsoft SMTPSVC(10.0.17763.1697);
suggests you are using IIS SMTP.As IIS SMTP is from IIS 6.0 (code name "Duct Tape", included with Windows Server 2003) and not updated since, it does not support DKIM, which has been produced afterwards (released in 2005, first RFC from 2007).
The outboud TLS encryption (which is not a message but a transit encryption!) is feasible through:
However, it would be much better to let a fully functional email server like Microsoft Exchange or Postfix handle both DKIM and TLS. Without the intermediate IIS SMTP, using the SmtpClient Class, you could either send the message unencrypted on a local network or utilize STARTTLS from the SmtpClient.EnableSsl Property: