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

查看:103
本文介绍了通过我的应用程序发送电子邮件的代码中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我实现了发送电子邮件的代码,并且可以正常工作.但是有时也行不通.
为什么会发生这种情况.为什么代码不起作用
任何解决此问题的方法

请检查我的代码


Hi
I implemented code to send email and its working fine.But the same not works for sometimes.
why like this happening.why the code is not working
Any solution for this problem

please check my code


System.Net.Mail.MailMessage msgMail = new System.Net.Mail.MailMessage("xxxx@xxxxx.com", txtEmail.Text);

       string mailid = "xxxx@bexxxx.com";
       string Pasword = xxxxx;

       string msg = null;
       string mTo = To;
       string mFrom = mailid;


       msgMail.Subject = Registration Confirmation;
       System.Text.StringBuilder SB = new System.Text.StringBuilder();
       System.IO.StringWriter Sw = new System.IO.StringWriter(SB);


       string mMsg = "hi"

       mMsg = mMsg + SB.ToString();

       try
       {
           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



Thanks in Advance
Amrutha

推荐答案

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

谢谢
--RA
Check my answer Here
error in asp.net code to send email[^]

Thanks
--RA


这篇关于通过我的应用程序发送电子邮件的代码中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆