Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 792 Bytes

send-email-465.md

File metadata and controls

28 lines (20 loc) · 792 Bytes

send email 465

send email with implict ssl is not a standard and not supported by the SmtpClient standard library

if you can't use other authentication system a solution, compatibile with net core, is to use MailKit

example

var message = new MimeMessage();
message.From.Add(new MailboxAddress("fromname", "[email protected]"));
message.To.Add(new MailboxAddress("toname", "[email protected]"));
message.Subject = "subj";

var html = new TextPart(TextFormat.Html);
html.Text = "<b>bold</b> normal";
message.Body = html;

using (var client = new MailKit.Net.Smtp.SmtpClient())
{
    client.Connect("smtps.example.com", 465, true);

    client.Authenticate("fromuser", "frompass");

    client.Send(message);
    client.Disconnect(true);
}