1655789370482077_个人页

个人头像照片 1655789370482077
0
1
0

个人介绍

暂无个人介绍

擅长的技术

  • 前端开发
获得更多能力
通用技术能力:

暂时未有相关通用技术能力~

云产品技术能力:

暂时未有相关云产品技术能力~

阿里云技能认证

详细说明
暂无更多信息
正在加载, 请稍后...
暂无更多信息
  • 回答了问题 2019-07-17

    C#调用邮箱smtp

    static string accountName = System.Configuration.ConfigurationManager.AppSettings['mailAccountName']; static string password = System.Configuration.ConfigurationManager.AppSettings['mailPassword']; static string smtpServer = System.Configuration.ConfigurationManager.AppSettings['mailSmtpServer']; static int smtpPort = int.Parse(System.Configuration.ConfigurationManager.AppSettings['mailSmtpPort']); static string displayName= System.Configuration.ConfigurationManager.AppSettings['mailDisplayName']; static string userState= System.Configuration.ConfigurationManager.AppSettings['mailUserState']; static public void SendMail(string sendTo, string subject, string body) { try { // Command line argument must the the SMTP host. SmtpClient client = new SmtpClient(smtpServer, smtpPort); client.UseDefaultCredentials = true; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Credentials = new NetworkCredential(accountName, password); // Specify the e-mail sender. // Create a mailing address that includes a UTF8 character // in the display name. MailAddress from = new MailAddress(accountName, displayName, System.Text.Encoding.UTF8); // Set destinations for the e-mail message. MailAddress to = new MailAddress(sendTo); // Specify the message content. MailMessage message = new MailMessage(from, to); message.Body = body; // Include some non-ASCII characters in body and subject. string someArrows = '(请勿回复这封邮件)'; message.Body += Environment.NewLine + someArrows; message.BodyEncoding = System.Text.Encoding.UTF8; message.Subject = subject; message.SubjectEncoding = System.Text.Encoding.UTF8; client.Send(message); message.Dispose(); client.Dispose(); } catch { } }
    踩0 评论0
正在加载, 请稍后...
滑动查看更多
正在加载, 请稍后...
暂无更多信息