With the strong support of the .NET Framework, we can easily use emails to send this function. The premise of this feature is that your mailbox must open the SMTP function
Usually in an email, there is the following content:
From: Sending the address
TO: Acceptable Food Address
BodyFormat: Text content type, we use html format here
Bodyencoding: The content of the text, the default coding is used here: DEFAULT
Subject: The theme of the letter, that is, the title
Body: The content of the letter, that is, the text
SMTPSERVER: The address of the SMTP server is used to send emails
The following code pieces illustrate how to use this function
using system.web.mail;
Elastic
Mailmessage msg = New Mailmessage ();
// Send the address
msg.from = [email protected];
// The receiver address
msg.to = [email protected];
// The content of the text
msg.bodyFormat = Mailformat.html;
// The content of the text
msg.bodyencoding = System.Text.encoding.default;
//theme
msg.subject = liucsoft to ask you hello;
//content
msg.body = <html> <head> <meta content = zh-cn http-equiv = content-laanguage> <meta http-eQUIV = 'Content-Type' Content = 'Text/HTML; Charset = gb2312 '> </ head> <body> This is a test email, no need to reply </body> </html>;
// Set to user verification
msg.fields.add (http://schemas.microsoft.com/cdo/configuration/smtpauthenticate, 1); 1); 1); 1); 1); 1); 1); 1); 1); 1); 1); 1);
// Set the verification user name
msg.fields.add (http://schemas.microsoft.com/cdo/configuration/sendusername, liucsoft);
// Set the verification password
msg.fields.add (http://schemas.microsoft.com/cdo/configuration/sendpassword, 123456);
// Email server address (such as smtp.163.com)
Smtpmail.smtpserver = smtp.163.com;
//send
Smtpmail.send (msg);
Elastic