ASP.NET Core + Amazon SES: The remote certificate is invalid according to the validation procedure -
i trying send email using asp.net core, mailkit , amazon ses:
using (smtpclient client = new smtpclient(new protocollogger("smtp.log"))) { client.connect("email-smtp.us-east-1.amazonaws.com", 587, securesocketoptions.starttls); client.authenticate("myusername", "mypassword"); await client.sendasync(message); client.disconnect(true); }
i keep getting error "the remote certificate invalid according validation procedure.".
and log file shows:
connected smtp://email-smtp.us-east-1.amazonaws.com:587/?starttls=always s: 220 email-smtp.amazonaws.com esmtp simpleemailservice-1737464811 qt5bxhigvsejahpspjp4 c: ehlo [127.0.0.1] s: 250-email-smtp.amazonaws.com s: 250-8bitmime s: 250-size 10485760 s: 250-starttls s: 250-auth plain login s: 250 ok c: starttls s: 220 ready start tls
what missing?
you need provide own client.servercertificatevalidationcallback
method verify server certificate. can simple returning true or can check fingerprint against known fingerprint server or number of other possibilities.
for more information, see http://www.mimekit.org/docs/html/p_mailkit_mailservice_servercertificatevalidationcallback.htm
Comments
Post a Comment