通过我的应用程序发送电子邮件的代码问题[英] Problem in code to send email through my application

问题描述


我实现了发送电子邮件的代码,它工作正常.但有时同样不起作用.
为什么会发生这种情况.为什么代码不起作用
这个问题的任何解决方案

请检查我的代码


System.Net.Mail.MailMessage msgMail = new System.Net.Mail.MailMessage("xxxx@xxxxx.com", txtEmail.Text);string mailid = "xxxx@bexxxx.com";string 密码 = xxxxx;string msg = null;字符串 mTo = To;字符串 mFrom = mailid;msgMail.Subject = 注册确认;System.Text.StringBuilder SB = new System.Text.StringBuilder();System.IO.StringWriter Sw = new System.IO.StringWriter(SB);string mMsg = "hi"mMsg = mMsg + SB.ToString();试试{msgMail.To.Add(mTo);msgMail.From = new System.Net.Mail.MailAddress(mFrom);msgMail.IsBodyHtml = true;msgMail.Body = mMsg;msgMail.Priority = System.Net.Mail.MailPriority.High;System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();smtp.Host = "mymail.brinkster.com";smtp.Port = 25;smtp.Credentials = new System.Net.NetworkCredential(mFrom, Pasword);smtp.EnableSsl = true;smtp.Send(msgMail);}


提前致谢
Amrutha

推荐答案

在这里查看我的答案
用于发送电子邮件的 asp.net 代码错误[^]

谢谢
--RA

本文地址:https://www.itbaoku.cn/post/1394860.html