如何通过c#
中的smtp发送邮件答案 0 :(得分:3)
System.Net.Mail.MailMessage与System.Net.Mail.SmtpClient一起
MailMessage mail = new MailMessage();
mail.From = new MailAddress("from address");
mail.Subject = "subject";
mail.Body = "body";
mail.IsBodyHtml = IsHtml;
mail.To.Add("targetaddress");
SmtpClient mailClient = new SmtpClient("smtphost");
mailClient.Credentials = new NetworkCredential("username", "password", "domain");
try
{
mailClient.Send(mail);
}
catch (Exception ex)
{
throw ex;
}
finally
{
mailClient = null;
}
答案 1 :(得分:2)
答案 2 :(得分:0)
查看System.Net.Mail.SmtpClient参考。它应该是你要找的东西