本文介绍了从asp.net页面发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


       我有以下编码从本地和服务器发送电子邮件。


            MAILMESSAGE消息=新MAILMESSAGE();






谢谢你merlin


 


 

解决方案


hello,

        i having following coding to send the email from my local as well as server.

           MailMessage message = new MailMessage();

            message.From = new MailAddress("[email protected]");

            message.To.Add(new MailAddress("[email protected]"));

            message.Subject = "Hi ";

            message.Body = "hello h r u";

            SmtpClient client = new SmtpClient();
           client.Host = "smtpout.secureserver.net";// i using godaddy server
           client.Port = 25;
            client.EnableSsl = true;
            client.Credentials = new System.Net.NetworkCredential("xx", "yy");
            client.Send(message);


            lblError.Text = "Message Sent";

 i got this kind of error message.


 System.Net.Mail.SmtpException: Server does not support secure connections. at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) at EmailTest.btnSend_Click(Object sender, EventArgs e) in d:\hosting\vojus24com\saagar\EmailTest.aspx.cs:line 134


thank you
merlin

解决方案


这篇关于从asp.net页面发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:01