使用system.net.mail(SMTP)发送邮件失败 [英] failure sending mail using system.net.mail(SMTP)

查看:147
本文介绍了使用system.net.mail(SMTP)发送邮件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

失败发送邮件错误发生在以下代码中该代码中的错误...

Failure Sending mail error is occurred in following code whats wrong in that code...

string ActivationUrl;

            try
            {

                MailMessage message = new MailMessage();

                message.From = new MailAddress("XXXX@gmail.com");

                message.To.Add(txtemail.Text);

                message.Subject = "Verification Email";

                ActivationUrl = Server.HtmlEncode("http://localhost:9525/Important_Testing/Verification.aspx?USER_ID=" + GetUserID(txtemail.Text));

                message.IsBodyHtml = true;

                message.Body = "<a href="" + ActivationUrl + "">Click Here to verify your acount</a>";

                SmtpClient smtp = new SmtpClient();

                smtp.Credentials = new System.Net.NetworkCredential("XXXX@gmail.com", "XXXX");

                smtp.Host = "smtp.gmail.com";

                smtp.Port = 587;

                smtp.EnableSsl = true;

                smtp.Send(message);

            }

            catch (Exception)
            {
                throw;
            }

推荐答案

查看此链接希望这对您有所帮助。



C#中的简单SMTP电子邮件发件人...控制台应用程序 [ ^ ]



C#中的简单SMTP电子邮件发件人...控制台应用程序 [ ^ ]
Check this link hope this will help you.

Simple SMTP E-Mail Sender in C#… Console application[^]

Simple SMTP E-Mail Sender in C#… Console application[^]


这篇关于使用system.net.mail(SMTP)发送邮件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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