这几天做到发送邮件的功能,代码如下: 

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 here";
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 here
mail.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 );


中间出现过could not access 'cdo.message' object 异常。

后来检查发送的验证不通过导致的

相关文章:

  • 2021-11-21
  • 2022-02-26
  • 2021-10-10
  • 2022-12-23
  • 2021-12-10
  • 2021-08-29
  • 2021-08-08
猜你喜欢
  • 2021-10-04
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2020-04-23
  • 2021-08-07
相关资源
相似解决方案