A simple example of a .NET email

zhaozj2021-02-16  65

Using system.web.mail;

MailMessage msgmail = new mailmessage (); msgmail.to = tsendto.text.trim ();

Msgmail.cc = "Webmaster@aspcool.com";

msgMail.From = Tsendfrom.Text.Trim (); msgMail.Subject = "Congraculations!"; msgMail.Priority = MailPriority.High; msgMail.BodyFormat = MailFormat.Html; // add this sentence, you can send html email string strBody = TCONText.Text.trim (); msgmail.body = strbody;

Msgmail.attachments.add (New MailatTachment ("E: //aaa.jpg"); SMTPMAIL.SMTPSERVER = "mail.zhhz.org";

Msgmail.fields.add ("http://schemas.microsoft.com/cdpo/configuration/smtpauthenticate," 1 "); // Basic Authentication Msgmail.fields.add (" http://schemas.microsoft.com/ CDO / Configuration / SenduserName "," MY_USERNAME_HERE "); // set your username Here msgmail.fields.add (" http://schemas.microsoft.com/cdo/configuration/sendpassword "," super_secret "); // set Your Password Here Smtpmail.send (Msgmail); Response.write ("