Use the SMTP server that needs to verify the user to send an email

zhaozj2021-02-16  51

Use the SMTP server that needs to verify the user to send a message occasionally, I feel that it is still useful for some people, turn over ....

using System.Web.Mail; private void Page_Load (object sender, System.EventArgs e) {MailMessage mail = new MailMessage (); mail.To = "me@mycompany.com"; mail.From = "you@yourcompany.com "; Mail.Subject =" this is a test email. "; Mail.body =" some text goes "; mail.fields.add (" http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ", "1"); // Basic Authentication Mail.fields.add ("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); // set your username hemail.fields.add ( "http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); // set your password here

SMTPMAIL.SMTPSERVER = "mail.mycompany.com"; // Your real server goes here smtpmail.send (mail);

转载请注明原文地址:https://www.9cbs.com/read-20586.html

New Post(0)