ASP. Net email instance code
- 2020-06-15 08:00:38
- OfStack
public static void SendEmail()
{
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
// Used here QQ If it is another mailbox, please send the test according to another mailbox POP3/IMAP/SMTP Services to set
client.Host = "smtp.qq.com";
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("6 Your email www.ofstack.com", "*** password ***");
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("60** your *www.ofstack.com"541** The recipient's www.ofstack.com");
message.Subject = " The theme ";
message.Body = " content ";
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
}
catch
{
}
}