Skip to content

Email via MailKit

List of all supported services: Services

This service is in a separate nuget package: Naprise.Service.MailKit.
It uses MailKit to send emails.

dotnet add package Naprise.Service.MailKit
# or
Install-Package Naprise.Service.MailKit

You will need to register the service in ServiceRegistry before using it.

Naprise.DefaultRegistry.AddMailKit();

email URL Format

As a quick way to send emails from your personal email account to yourself, you can use the email URL format.

email://{user}:{pass}@{domain}
  • user: The name of your email account.
  • pass: The password or application-secret of your email account.
  • domain: The domain of your email account.

Examples:

email://john:myS3cr5t@gmail.com
email://aoi:somePassword@yahoo.co.jp
email://123456:furageoupjhjygto@qq.com

See the table below for a list of supported domains.

smtp and smtps URL Format

If your email service is not supported by email URL, or you want to send emails from a custom email server, you can use the smtp and smtps URL formats.

smtp://{smtp_host}:{smtp_port}/{from}/{to}
smtps://{smtp_host}:{smtp_port}/{from}/{to}
smtp://{smtp_host}:{smtp_port}/{username}/{password}/{from}/{to}
smtps://{smtp_host}:{smtp_port}/{username}/{password}/{from}/{to}
  • smtp://: Connect to the SMTP server using unencrypted plain text or STARTTLS.
  • smtps://: Connect to the SMTP server using encrypted SSL/TLS.
TLDR: Use smtp:// for port 25 and 587, and smtps:// for port 465.

Some email providers' documentation refer STARTTLS as just TLS, which technically is not the same thing.

SSL now days in the context of SMTP often means TLS 1.2 is being used, even if it's being called SSL and not TLS. The client will establish a SSL/TLS connection first just like HTTPS, and then start the SMTP protocol. The standard port for SMTP over SSL/TLS is 465.

STARTTLS on the other hand, is a SMTP command that tells the SMTP server to switch to TLS encryption after the connection is established. The client will establish a plain text connection first, and then send the STARTTLS command to the SMTP server, if both parties support it, the SMTP server will switch to TLS encryption. The most common port for SMTP with STARTTLS support is 587.

  • smtp_host: The SMTP host of your email server.
  • smtp_port: The SMTP port of your email server, always required.
  • username: The username of your email account.
  • password: The password or application-secret of your email account.
  • from: The email address of the sender.
  • to: The email address of the recipient.

If the username and password are not provided, it's assumed that the SMTP server does not require authentication, which might be the case for self-hosted local SMTP servers.

Examples:

smtps://smtp.gmail.com:465/jone@gmail.com/JoneDoe1234/jone@gmail.com/friend@outlook.com
smtp://smtp.local:25/homeserver/password/homeserver@local/admin@local

Supported Domains

The following table lists the supported domains for email URLs and their corresponding SMTP settings. If your domain is not listed here, you can still use the smtp or smtps URL formats to send emails.

Domain Name SMTP Server Encryption
gmail.com Gmail smtp.gmail.com:465 SSL/TLS
outlook.com Outlook smtp.office365.com:587 NONE/STARTTLS
hotmail.com Outlook smtp.office365.com:587 NONE/STARTTLS
live.com Outlook smtp.office365.com:587 NONE/STARTTLS
outlook.jp Outlook smtp.office365.com:587 NONE/STARTTLS
hotmail.co.jp Outlook smtp.office365.com:587 NONE/STARTTLS
live.jp Outlook smtp.office365.com:587 NONE/STARTTLS
icloud.com iCloud smtp.mail.me.com:587 NONE/STARTTLS
yahoo.co.jp Yahoo メール smtp.mail.yahoo.co.jp:465 SSL/TLS
ymail.ne.jp Yahoo メール smtp.mail.yahoo.co.jp:465 SSL/TLS
zoho.com Zoho Mail smtp.zoho.com:465 SSL/TLS
zohomail.com Zoho Mail smtp.zoho.com:465 SSL/TLS
qq.com QQ Mail smtp.qq.com:465 SSL/TLS
vip.qq.com QQ Mail smtp.qq.com:465 SSL/TLS
foxmail.com QQ Mail smtp.qq.com:465 SSL/TLS
163.com Netease Mail smtp.163.com:465 SSL/TLS
126.com Netease Mail smtp.126.com:465 SSL/TLS
yeah.net Netease Mail smtp.yeah.net:465 SSL/TLS
vip.163.com Netease Mail smtp.vip.163.com:465 SSL/TLS
vip.126.com Netease Mail smtp.vip.126.com:465 SSL/TLS
188.com Netease Mail smtp.188.com:465 SSL/TLS
139.com 139 Mail (China Mobile) smtp.139.com:465 SSL/TLS
189.cn 189 Mail (China Telecom) smtp.189.cn:465 SSL/TLS
wo.cn Wo Mail (China Unicom) smtp.wo.cn:465 SSL/TLS
sohu.com Sohu Mail smtp.sohu.com:465 SSL/TLS
vip.sohu.com Sohu Mail smtp.vip.sohu.com:25 NONE/STARTTLS
sina.com Sina Mail smtp.sina.com:465 SSL/TLS
sina.cn Sina Mail smtp.sina.cn:465 SSL/TLS
vip.sina.com Sina Mail smtp.vip.sina.com:465 SSL/TLS
vip.sina.cn Sina Mail smtp.vip.sina.cn:465 SSL/TLS
tom.com Tom Mail smtp.tom.com:465 SSL/TLS
vip.tom.com Tom Mail smtp.tom.com:465 SSL/TLS
163.net Tom Mail smtp.tom.com:465 SSL/TLS
163vip.com Tom Mail smtp.tom.com:465 SSL/TLS
yandex.com Yandex Mail smtp.yandex.com:465 SSL/TLS
yandex.net Yandex Mail smtp.yandex.com:465 SSL/TLS
ya.ru Yandex Mail smtp.yandex.com:465 SSL/TLS
yandex.ru Yandex Mail smtp.yandex.com:465 SSL/TLS
yandex.by Yandex Mail smtp.yandex.com:465 SSL/TLS
yandex.kz Yandex Mail smtp.yandex.com:465 SSL/TLS
yandex.uz Yandex Mail smtp.yandex.com:465 SSL/TLS
yandex.fr Yandex Mail smtp.yandex.com:465 SSL/TLS
narod.ru Yandex Mail smtp.yandex.com:465 SSL/TLS
mail.ru Mail.ru smtp.mail.ru:465 SSL/TLS
inbox.ru Mail.ru smtp.mail.ru:465 SSL/TLS
list.ru Mail.ru smtp.mail.ru:465 SSL/TLS
bk.ru Mail.ru smtp.mail.ru:465 SSL/TLS
yahoo.com Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
myyahoo.com Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
ymail.com Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
y7mail.com Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
rocketmail.com Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.ar Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.au Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.br Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.co Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.hk Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.hr Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.mx Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.my Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.pe Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.ph Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.sg Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.tr Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.tw Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.ua Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.ve Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.com.vn Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.id Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.il Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.in Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.kr Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.nz Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.th Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.uk Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.co.za Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.at Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.be Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.bg Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.ca Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.cl Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.cz Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.de Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.dk Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.ee Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.es Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.fi Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.fr Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.gr Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.hu Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.ie Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.in Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.it Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.lv Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.nl Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.no Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.pl Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.pt Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.ro Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.se Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
yahoo.sk Yahoo Mail smtp.mail.yahoo.com:465 SSL/TLS
123mail.org Fastmail smtp.fastmail.com:465 SSL/TLS
150mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
150ml.com Fastmail smtp.fastmail.com:465 SSL/TLS
16mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
2-mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
4email.net Fastmail smtp.fastmail.com:465 SSL/TLS
50mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
airpost.net Fastmail smtp.fastmail.com:465 SSL/TLS
allmail.net Fastmail smtp.fastmail.com:465 SSL/TLS
cluemail.com Fastmail smtp.fastmail.com:465 SSL/TLS
elitemail.org Fastmail smtp.fastmail.com:465 SSL/TLS
emailcorner.net Fastmail smtp.fastmail.com:465 SSL/TLS
emailengine.net Fastmail smtp.fastmail.com:465 SSL/TLS
emailengine.org Fastmail smtp.fastmail.com:465 SSL/TLS
emailgroups.net Fastmail smtp.fastmail.com:465 SSL/TLS
emailplus.org Fastmail smtp.fastmail.com:465 SSL/TLS
emailuser.net Fastmail smtp.fastmail.com:465 SSL/TLS
eml.cc Fastmail smtp.fastmail.com:465 SSL/TLS
f-m.fm Fastmail smtp.fastmail.com:465 SSL/TLS
fast-email.com Fastmail smtp.fastmail.com:465 SSL/TLS
fast-mail.org Fastmail smtp.fastmail.com:465 SSL/TLS
fastem.com Fastmail smtp.fastmail.com:465 SSL/TLS
fastemailer.com Fastmail smtp.fastmail.com:465 SSL/TLS
fastest.cc Fastmail smtp.fastmail.com:465 SSL/TLS
fastimap.com Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.cn Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.co.uk Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.com Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.com.au Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.de Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.es Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.fm Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.fr Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.im Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.in Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.jp Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.mx Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.net Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.nl Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.org Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.se Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.to Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.tw Fastmail smtp.fastmail.com:465 SSL/TLS
fastmail.uk Fastmail smtp.fastmail.com:465 SSL/TLS
fastmailbox.net Fastmail smtp.fastmail.com:465 SSL/TLS
fastmessaging.com Fastmail smtp.fastmail.com:465 SSL/TLS
fea.st Fastmail smtp.fastmail.com:465 SSL/TLS
fmail.co.uk Fastmail smtp.fastmail.com:465 SSL/TLS
fmailbox.com Fastmail smtp.fastmail.com:465 SSL/TLS
fmgirl.com Fastmail smtp.fastmail.com:465 SSL/TLS
fmguy.com Fastmail smtp.fastmail.com:465 SSL/TLS
ftml.net Fastmail smtp.fastmail.com:465 SSL/TLS
hailmail.net Fastmail smtp.fastmail.com:465 SSL/TLS
imap-mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
imap.cc Fastmail smtp.fastmail.com:465 SSL/TLS
imapmail.org Fastmail smtp.fastmail.com:465 SSL/TLS
inoutbox.com Fastmail smtp.fastmail.com:465 SSL/TLS
internet-e-mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
internet-mail.org Fastmail smtp.fastmail.com:465 SSL/TLS
internetemails.net Fastmail smtp.fastmail.com:465 SSL/TLS
internetmailing.net Fastmail smtp.fastmail.com:465 SSL/TLS
jetemail.net Fastmail smtp.fastmail.com:465 SSL/TLS
justemail.net Fastmail smtp.fastmail.com:465 SSL/TLS
letterboxes.org Fastmail smtp.fastmail.com:465 SSL/TLS
mail-central.com Fastmail smtp.fastmail.com:465 SSL/TLS
mail-page.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailas.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailbolt.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailc.net Fastmail smtp.fastmail.com:465 SSL/TLS
mailcan.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailforce.net Fastmail smtp.fastmail.com:465 SSL/TLS
mailhaven.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailingaddress.org Fastmail smtp.fastmail.com:465 SSL/TLS
mailite.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailmight.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailnew.com Fastmail smtp.fastmail.com:465 SSL/TLS
mailsent.net Fastmail smtp.fastmail.com:465 SSL/TLS
mailservice.ms Fastmail smtp.fastmail.com:465 SSL/TLS
mailup.net Fastmail smtp.fastmail.com:465 SSL/TLS
mailworks.org Fastmail smtp.fastmail.com:465 SSL/TLS
ml1.net Fastmail smtp.fastmail.com:465 SSL/TLS
mm.st Fastmail smtp.fastmail.com:465 SSL/TLS
myfastmail.com Fastmail smtp.fastmail.com:465 SSL/TLS
mymacmail.com Fastmail smtp.fastmail.com:465 SSL/TLS
nospammail.net Fastmail smtp.fastmail.com:465 SSL/TLS
ownmail.net Fastmail smtp.fastmail.com:465 SSL/TLS
petml.com Fastmail smtp.fastmail.com:465 SSL/TLS
postinbox.com Fastmail smtp.fastmail.com:465 SSL/TLS
postpro.net Fastmail smtp.fastmail.com:465 SSL/TLS
proinbox.com Fastmail smtp.fastmail.com:465 SSL/TLS
promessage.com Fastmail smtp.fastmail.com:465 SSL/TLS
realemail.net Fastmail smtp.fastmail.com:465 SSL/TLS
reallyfast.biz Fastmail smtp.fastmail.com:465 SSL/TLS
reallyfast.info Fastmail smtp.fastmail.com:465 SSL/TLS
rushpost.com Fastmail smtp.fastmail.com:465 SSL/TLS
sent.as Fastmail smtp.fastmail.com:465 SSL/TLS
sent.at Fastmail smtp.fastmail.com:465 SSL/TLS
sent.com Fastmail smtp.fastmail.com:465 SSL/TLS
speedpost.net Fastmail smtp.fastmail.com:465 SSL/TLS
speedymail.org Fastmail smtp.fastmail.com:465 SSL/TLS
ssl-mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
swift-mail.com Fastmail smtp.fastmail.com:465 SSL/TLS
the-fastest.net Fastmail smtp.fastmail.com:465 SSL/TLS
the-quickest.com Fastmail smtp.fastmail.com:465 SSL/TLS
theinternetemail.com Fastmail smtp.fastmail.com:465 SSL/TLS
veryfast.biz Fastmail smtp.fastmail.com:465 SSL/TLS
veryspeedy.net Fastmail smtp.fastmail.com:465 SSL/TLS
warpmail.net Fastmail smtp.fastmail.com:465 SSL/TLS
xsmail.com Fastmail smtp.fastmail.com:465 SSL/TLS
yepmail.net Fastmail smtp.fastmail.com:465 SSL/TLS
your-mail.com Fastmail smtp.fastmail.com:465 SSL/TLS