Because the core does not take smpt
So with Mimekit
Take 163 mailboxes as an example
var message = new MimeMessage ();
Message. From.add (New Mailboxaddress ("Wang Dazhao", "[email protected]");
Message. To.add (New Mailboxaddress ("Wang Zhao", "[email protected]");
Message. To.add (New Mailboxaddress ("Yang Xisi", "[email protected]");
Message. Subject = "Work report of the Week";
Textpart BODY = new Textpart (textformat.html)
{
Text = "Send this week's work report"
};
using (smtpclient client = new SmtpClient ())
{
SMTP server
Client. Connect ("smtp.163.com", +, FALSE);
Log in, send
In particular, for the server side of the Chinese corresponding, exception coding problems, display garbled
Client. Authenticate ("Registered mailbox", "Authorized authentication Code");
Client. Send (message);
Disconnect
Client. Disconnect (TRUE);
Console.WriteLine ("Send mail Success");
}
ASP. NET Core Mail send