通过邮件服务器发送邮件 [英] Send email by mail server
问题描述
我创建了一个通过服务器邮件发送电子邮件的项目。但是,我发送邮件得到错误:
Quote:服务器不支持安全连接。在System.Net.Mail.SmtpConnection.GetConnection(String host,Int32 port)处System.Net上的System.Net.Mail.SmtpClient.GetConnection()上的System.Net.Mail.SmtpTransport.GetConnection(String host,Int32 port) .Mail.SmtpClient.Send(MailMessage消息)
我的代码落后:
SmtpClient smtp = new SmtpClient();
MailMessage msg = new MailMessage();
string host = smtp.newwave。 COM跨度>;
int port = 25 ;
NetworkCredential loginInfo = new NetworkCredential( acb@newwave.com.vn, Abcd1234);
msg.From = new MailAddress( abc@newwave.com)
msg.To.Add( new MailAddress( abc@gmail.com.vn);
msg.Body = 测试发送邮件;
msg.IsBodyHtml = true ;
SmtpClient client = new SmtpClient(host);
client.Port = port;
client.EnableSsl = true ;
client.UseDefaultCredentials = true ;
client.Credentials = loginInfo;
client.Send(msg);
我telnet到我的服务器邮件,没关系:telnet smtp.newwave.com 25 - > 220 SERVER12.home ESMTP MailEnable服务,版本:8.53--准备好了01/29/15 1
:18:08
请帮助我!
在您的服务器中,似乎没有为安全连接配置SSL。
在这种情况下,你需要设置client.EnableSsl = false;
。
否则,在服务器上配置SSL设置。 / blockquote>
查看以下链接。它为您提供同样问题的解决方案。
http://forums.asp.net/t/1091403.aspx
大家好!
我已经解决了。
我设置:client.EnableSsl = false =>它的工作原理
谢谢大家^^
I create a project to send email through server mail. But wheren I send mail get error:
Quote: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)
My code behind:
SmtpClient smtp = new SmtpClient(); MailMessage msg = new MailMessage(); string host = "smtp.newwave.com"; int port = 25; NetworkCredential loginInfo = new NetworkCredential("acb@newwave.com.vn", "Abcd1234"); msg.From = new MailAddress("abc@newwave.com") msg.To.Add(new MailAddress("abc@gmail.com.vn"); msg.Body = "Test send mail"; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient(host); client.Port = port; client.EnableSsl = true; client.UseDefaultCredentials = true; client.Credentials = loginInfo; client.Send(msg);I telnet to my server mail, it's ok: telnet smtp.newwave.com 25 --> 220 SERVER12.home ESMTP MailEnable Service, Version: 8.53-- ready at 01/29/15 1
:18:08
Help me, Please!解决方案Seems like, in your Server SSL is not configured for Secure Connections.
In that case, you need to setclient.EnableSsl = false;
.
Otherwise, configure SSL settings on Server.
check out the following link. which provides you solution for the same problem.
http://forums.asp.net/t/1091403.aspx
Hi all!
I've solved.
I set: client.EnableSsl = false => it's worked
Thanks all of you ^^
这篇关于通过邮件服务器发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!