ASP.NET Core 5.0 - SMTP Settings Tester

This article will describe the SMTP Settings Tester utility. I will assume you have downloaded the ASP.NET Core 5.0 - SMTP Settings Tester Project. Registered users can download the source code for free at Manage > Assets.

SMTP Settings Tester Project and Article Series

This project implements Bootstrap v5, Bootstrap Native, and the KenHaggerty. Com. SingleUser NuGet package which provides log in and log out pages for a single user to access the Admin pages. jQuery has been removed. I created a topic, ASP.NET Core 5.0 - SMTP Settings Tester Project for discussions. More details and screenshots at ASP.NET Core 5.0 - SMTP Settings Tester Project. The details page includes the version change log.

Probably the most difficult bit of setting up an email service is the SMTP server settings. This utility loads the runtime EmailSettings and the EmailSettings from appsettings. json and appsettings. development. json. The runtime settings may load from the project's Users Secrets, appsettings. development. json, or appsettings. json. All EmailSettings discovered can be loaded into the generator to test custom settings, runtime settings are loaded by default.

Tester Development Settings.
Tester User Secrets.

You can generate, preview, and attempt to send an email to the AdminEmail or SupportEmail address using the generator settings. The tester will send the email and display a success message for functional settings. Email account passwords are obfuscated in the email if not encrypted but displayed in plain text on the Email Settings Tester. The project with the KenHaggerty. Com. SingleUser NuGet package restricts access to the tester for a single user. If you need the tester in a production environment, you should restrict access to admins only.

Tester Verified Settings.
Tester Verified Details.

The Attempt Details displays the attempt status. If the SmtpClient successfully connects, the SmtpClient Capabilities and Negotiated SSL options are displayed. If the SmtpClient successfully sends the email, the MailKit. ProtocolLogger's log is displayed.

Attempt Details
Settings Verified. 
Check the Admin Email's inbox. 
 
Capabilities:
None: True
Authentication: True
Authentication Mechanisms: LOGIN, PLAIN, XOAUTH2, PLAIN-CLIENTTOKEN, OAUTHBEARER, XOAUTH
BinaryMime: False
Chunking: True
Dsn: False
EightBitMime: True
EnhancedStatusCodes: True
Pipelining: True
RequireTLS: False
Size: True
MaxSize: 35882577.
StartTLS: False
UTF8: True

Negotiated SSL options:
Protocol Version: Tls12
Cipher Algorithm: Aes128
Cipher Strength: 128
Hash Algorithm: Sha256
Hash Strength: 0
Key-Exchange Algorithm: 44550
Key-Exchange Strength: 255

Log:
Connected to smtps://smtp.gmail.com:465/
S: 220 smtp.gmail.com ESMTP 2sm2347315qka.68 - gsmtp
C: EHLO [192.168.1.6]
S: 250-smtp.gmail.com at your service, [71.196.88.143]
S: 250-SIZE 35882577
S: 250-8BITMIME
S: 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
S: 250-ENHANCEDSTATUSCODES
S: 250-PIPELINING
S: 250-CHUNKING
S: 250 SMTPUTF8
C: AUTH PLAIN AGtlbm5leWhhZ2dlcnR5QGdtYWlsLmNvbQBBYjB5aCE1RG9n
S: 235 2.7.0 Accepted
C: MAIL FROM:<â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– @gmail.com> SIZE=2979 BODY=8BITMIME
C: RCPT TO:<ken@kenhaggerty.com>
S: 250 2.1.0 OK 2sm2347315qka.68 - gsmtp
S: 250 2.1.5 OK 2sm2347315qka.68 - gsmtp
C: DATA
S: 354  Go ahead 2sm2347315qka.68 - gsmtp
C: From: Ken Haggerty <â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– @gmail.com>
C: Date: Wed, 04 Aug 2021 23:04:16 -0400
C: Subject: Generated EmailSettings For localhost:44395
C: Message-Id: <XT33Q27IFEU4.G60SOCC4HAMP1@KEN-ASUS-LAPTOP>
C: To: ken@kenhaggerty.com
C: MIME-Version: 1.0
C: Content-Type: multipart/alternative; boundary="=-bN87sOnj1ml+BW/vHa2nBg=="
C: 
C: --=-bN87sOnj1ml+BW/vHa2nBg==
C: Content-Type: text/plain; charset=utf-8
C: 
C: Email using settings. 
C:  
C: {
C:   "Configured": true,
C:   "Timeout": 30000,
C:   "MailServer": "smtp.gmail.com",
C:   "MailPort": 465,
C:   "SenderName": "Ken Haggerty",
C:   "SenderEmail": "â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– @gmail.com",
C:   "Password": "********",
C:   "PasswordEncrypted": false,
C:   "BannerBackcolor": "#FF0000",
C:   "BannerColor": "#FFFFFF",
C:   "BannerText": "User Secrets",
C:   "EmailSignature": "Ken Haggerty",
C:   "SupportName": "Secret Support",
C:   "SupportEmail": "support@kenhaggerty.com",
C:   "AdminEmail": "ken@kenhaggerty.com"
C: }
C: --=-bN87sOnj1ml+BW/vHa2nBg==
C: Content-Type: text/html; charset=utf-8
C: Content-Transfer-Encoding: 8bit
C: 
C: <!DOCTYPE html>
C: <html>
C: <head>
C:     <meta charset="utf-8" />
C:     <title>Generated EmailSettings For localhost:44395</title>
C: </head>
C: <body style="font-family: Arial, Helvetica, sans-serif;">
C:     <table border="0" cellspacing="0" width="100%">
C:         <tr>
C:             <td></td>
C:             <td width="700">
C:                 <div style="border: 2px solid #FFFFFF; background-color: #FF0000; color: #FFFFFF; width: 90%; margin: 0 auto;">
C:                     <div style="padding: 5px 0; width: 100%; margin: 0 auto; text-align:center; font-size: 28px;">User Secrets</div>
C:                 </div>
C:                 <div style="padding: 10px 10px; width: 90%; margin: 0 auto; font-size: 16px;">
C:                     <p>
C:                         This is a message from the SMTP Settings Tester.
C: 
C:                     </p>
C: 
C:                     <p>
C:                         Generated Settings For localhost:44395
C: <pre style="font-size: 12px;">
C: "EmailSettings": {
C:   "Configured": true,
C:   "Timeout": 30000,
C:   "MailServer": "smtp.gmail.com",
C:   "MailPort": 465,
C:   "SenderName": "Ken Haggerty",
C:   "SenderEmail": "â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– @gmail.com",
C:   "Password": "********",
C:   "PasswordEncrypted": false,
C:   "BannerBackcolor": "#FF0000",
C:   "BannerColor": "#FFFFFF",
C:   "BannerText": "User Secrets",
C:   "EmailSignature": "Ken Haggerty",
C:   "SupportName": "Secret Support",
C:   "SupportEmail": "support@kenhaggerty.com",
C:   "AdminEmail": "ken@kenhaggerty.com"
C: }
C: </pre>
C:                     </p>
C:                     <p>
C:                         Thank you,<br />
C:                         Ken Haggerty
C:                     </p>
C:                 </div>
C:                 <div style="background-color: #FF0000; color: #FFFFFF; padding: 10px 10px; width: 90%; margin: 0 auto; bottom: 10px;">
C:                     © 2021
C:                 </div>
C:             </td>
C:             <td></td>
C:         </tr>
C:     </table>
C: </body>
C: </html>
C: --=-bN87sOnj1ml+BW/vHa2nBg==--
C: .
S: 250 2.0.0 OK  1628132658 2sm2347315qka.68 - gsmtp
C: QUIT
S: 221 2.0.0 closing connection 2sm2347315qka.68 - gsmtp

The SmtpClient Capabilities and Negotiated SSL options for my production email server indicate no TLS support.

Attempt Details
Capabilities:
None: True
Authentication: True
Authentication Mechanisms: LOGIN, CRAM-MD5
BinaryMime: False
Chunking: False
Dsn: False
EightBitMime: True
EnhancedStatusCodes: False
Pipelining: False
RequireTLS: False
Size: True
MaxSize: 31457280.
StartTLS: False
UTF8: False

Negotiated SSL options:
Protocol Version: None
Cipher Algorithm: 
Cipher Strength: 
Hash Algorithm: 
Hash Strength: 
Key-Exchange Algorithm: 
Key-Exchange Strength: 

I sent a test email to my gmail address and used the browser Gmail app to analyze the relays in the Original Message. My web server connects to the email server with an internal ip which relays to a secure email server. I verified my emails are using TLS for the last external relay.

Gmail Show Original.
Gmail Original Message.
Original Message
Delivered-To: â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– @gmail.com
Received: by 2002:a2e:b523:0:0:0:0:0 with SMTP id z3csp1569134ljm;
        Sun, 1 Aug 2021 18:38:42 -0700 (PDT)
X-Google-Smtp-Source: ABdhPJzQO51xBwIj9c7fMC+B7dS+bcSnQlxvR+gr4Nwo6J0Y5ImUt8tXIImcio2Qa7YAlf5KDn8/
X-Received: by 2002:a17:906:fa12:: with SMTP id lo18mr13920973ejb.288.1627868322291;
        Sun, 01 Aug 2021 18:38:42 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1627868322; cv=none;
        d=google.com; s=arc-20160816;
        b=awHvM/55NpbiE5zytbpQXcV8pIn6RP+EnEn4ixzXE09g3Tte85EW4hMfNkle0Gzwh/
         B9HYc9R8nOOIZpBIiacvMdvyts5+ar4CVAbKbjd/oY7fHAHx12c65ft2lXkDzkIlbjqz
         jmVu7sqnifoHC6jMt+IX/5+baLaEeiC7neFgclDERJe5SfzhLXhBjs2IldaJVe0bYsOr
         rCKcb1g517G03v63qqybIfFy8u2EfOkOBAS/ZFKPxmKz/Ugg9wdIytLjEIiGQdS+cQ7x
         DviC4x4Zz4luYXSHVZTeI5IUmheKCibfj06icPgUVA+Jpifr7rNp3A4116Ui3+vd5h+f
         1D9Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=mime-version:to:message-id:subject:date:from;
        bh=5PDJQCGK7R293+m6ezXxsSg3wYRkGTzyOtfpmAVY/q4=;
        b=TEsU0O5XEm0+eRoBnpbmzHWxChGMn5mGEf1FTba/FmIeopTobTnHjcs9zzdoHBCwkE
         vIoJoFAnmS037ElYaLu/TbRzW0PS2uXpt3+QRSCh7MxGa1kRkxm3Xlb03T7NW5mBMZaV
         /+8DqVtyrhJa05SRyaca+8tAr5wsSsJF2Dr6biDqHkE5bULh++kPcq+JV9jxBijAyMo2
         MwO60h5Wc2qXVIIC5QOP2Wwbrw9M0zE7g80GMZd8ouJVME9niyzK2kcGvodIiULboMVt
         oMK4CaU2jUik9E2wcR/kyPoDM+3pwQr2uE4vbt6ac78hPz9xeImSGzD8xhdX0r9CZnwv
         GU7A==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of support@kenhaggerty.com designates 14.1.23.2 as permitted sender) smtp.mailfrom=support@kenhaggerty.com
Return-Path: <support@kenhaggerty.com>
Received: from gw22.site4now.net (gw22.site4now.net. [14.1.23.2])
        by mx.google.com with ESMTPS id lr6si11063291ejb.129.2021.08.01.18.38.40
        for <â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– @gmail.com>        
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 01 Aug 2021 18:38:41 -0700 (PDT)
Received-SPF: pass (google.com: domain of support@kenhaggerty.com designates 14.1.23.2 as permitted sender) client-ip=14.1.23.2;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of support@kenhaggerty.com designates 14.1.23.2 as permitted sender) smtp.mailfrom=support@kenhaggerty.com
X-SmarterMail-Authenticated-As: bypass
Received: from mail5002.site4now.net (UnknownHost [10.10.28.28]) by gw22.site4now.net with SMTP;
   Sun, 1 Aug 2021 18:38:29 -0700
X-SmarterMail-Authenticated-As: support@kenhaggerty.com
Received: from [10.10.28.171] (UnknownHost [10.10.28.171]) by mail5002.site4now.net with SMTP;
   Sun, 1 Aug 2021 18:38:16 -0700
From: KenHaggerty Support <support@kenhaggerty.com>
Date: Sun, 01 Aug 2021 18:38:15 -0700
Subject: Test email from kenhaggerty.com
Message-Id: <8NXK403JEEU4.UWZ0WRLBYFA83@win5087>
To: â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– @gmail.com
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="=-BKYQYUfRvwzM0gFN0G1X3g=="
X-Antivirus: Avast (VPS 210801-10, 08/01/2021), Outbound message
X-Antivirus-Status: Clean
X-Exim-Id: 8NXK403JEEU4.UWZ0WRLBYFA83
X-Antivirus: Avast (VPS 210801-10, 08/01/2021), Outbound message
X-Antivirus-Status: Clean

--=-BKYQYUfRvwzM0gFN0G1X3g==
Content-Type: text/plain; charset=utf-8

This is a simple email message as text. 
 

--=-BKYQYUfRvwzM0gFN0G1X3g==
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Test email from kenhaggerty.com</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif;">
    <table border="0" cellspacing="0" width="100%">
        <tr>
            <td></td>
            <td width="700">
                <div style="border: 2px solid #00008B; background-color: #6495ED; color: #00008B; width: 90%; margin: 0 auto;">
                    <div style="padding: 5px 0; width: 100%; margin: 0 auto; text-align:center; font-size: 28px;">KenHaggerty.Com</div>
                </div>
                <div style="padding: 10px 10px; width: 90%; margin: 0 auto; font-size: 18px;">
                    <h3>Test email from kenhaggerty.com</h3>
                    <p>
                        This is a simple email message as <strong>HTML</strong>.
                    </p>
                    <p>
                        Thank you,<br />
                        Ken Haggerty
                    </p>
                    <p>
                        This is an automated message.
                    </p>
                </div>
                <div style="background-color: #6495ED; color: #00008B; padding: 10px 10px; width: 90%; margin: 0 auto; bottom: 10px;">
                    © 2021
                </div>
            </td>
            <td></td>
        </tr>
    </table>
</body>
</html>
--=-BKYQYUfRvwzM0gFN0G1X3g==--

Common Errors

Failure messages include the error. The unknown host error may indicate no internet connection, mx record issues, or invalid Mail Server setting. Search "mx record check" for online utilities to verify the mx record.

Settings Not Configured
Tester Failed Not Configured.
Mail Server Not Found
Tester Failed Unknown Host.
Mail Port Invalid
Tester Failed Bad Port.
Sender Email Or Password Invalid
Tester Failed Bad Credentials.
Ken Haggerty
Created 08/07/21
Updated 08/07/21 01:20 GMT

Log In or Reset Quota to read more.

Article Tags:

Email Json Modal Model
Successfully completed. Thank you for contributing.
Contribute to enjoy content without advertisments.
Something went wrong. Please try again.

Comments(0)

Loading...
Loading...

Not accepting new comments.

Submit your comment. Comments are moderated.

User Image.
DisplayedName - Member Since ?