从asp.net页面发送电子邮件 [英] sending email from asp.net page
问题描述
你好,
我有以下编码从本地和服务器发送电子邮件。
   MAILMESSAGE消息=新MAILMESSAGE(); 强>
<强>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; message.From = new MailAddress(" xx@skyscribe.co.in ");
message.To.Add(新邮件地址(" yy@gmail.com " ));
message.Subject = QUOT;您好英寸; 强>
<强>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; message.Body = QUOT;你好小时ü英寸; 强>
<强>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; SmtpClient客户端=新的SmtpClient();
client.Host = QUOT; smtpout.secureserver.net英寸; //我使用godaddy的服务器
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; client.Port = 25 ;
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; client.EnableSsl = true;
client.Credentials =新System.Net.NetworkCredential(QUOT; XX"," YY");
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; client.Send(message);
; lblError.Text =" Message Sent";
我收到此类错误消息。
系统。 Net.Mail.SmtpException:服务器不支持安全连接。在System.Net.Mail.SmtpConnection.GetConnection(字符串主机的Int32端口)在System.Net.Mail.SmtpTransport.GetConnection(字符串主机的Int32端口)在System.Net.Mail.SmtpClient.GetConnection()在System.Net .Mail.SmtpClient.Send(消息MAILMESSAGE)在EmailTest.btnSend_Click(对象发件人,EventArgs e)在d:\hosting\vojus24com\saagar\EmailTest.aspx.cs:线134 强>
谢谢你merlin
&NBSP;
有一个潜在的&NBSP;事实之间的不一致您正在设置:
client.EnableSsl = TRUE;
和client.Port = 25;
传统上,普通SMTP使用端口25,但SSL over SSL使用端口465.我不知道godaddy的策略,但我建议您查看其网站上的设置。
HTH
--mc
hello,
i having following coding to send the email from my local as well as server.
MailMessage message = new MailMessage();
message.From = new MailAddress("xx@skyscribe.co.in");
message.To.Add(new MailAddress("yy@gmail.com"));
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
There is a potential inconsistency between the fact that you are setting:
client.EnableSsl = true;
and
client.Port = 25;
Traditionally, plain SMTP uses port 25, but SMTP over SSL uses port 465. I'm not aware of godaddy's policies, but I would recommend that you review the settings on their site.
HTH
--mc
这篇关于从asp.net页面发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!