使用smtp客户端时出错 [英] Error using smtp client

查看:253
本文介绍了使用smtp客户端时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..我是一个junoir开发者..!

i我正在使用以下设置来发送电子邮件使用我的雅虎电子邮件a / c ..但是我发送邮件时出错了

hi.. M a junoir developer..!
i am using following settings for sending email using my yahoo email a/c.. but I am getting time out error when I send mail..

SmtpClient emailClient = new SmtpClient("smtp.mail.yahoo.com", 465);
emailClient.EnableSsl = true;
emailClient.Credentials = ("xyz@yahoo.com","*******");
emailClient.UseDefaultCredentials = false;
mail.To.Add("abc@yahoo.com");
mail.Body =Message_Body.Text;
mail.Subject = Email_Subject.Text;
MailAddress address = new MailAddress("xyz@yahoo.com");
mail.From = address;
emailClient.Send(mail);



请指导我感谢..


Pls guide me thanx..

推荐答案

你好,



根据 MS文档不支持通过端口465的SSL SMTP。尝试使用Mentalis.org上的安全库

这里是另一篇博客文章 ..





问候,
Hello,

As per MS documentation SSL SMTP over port 465 is not supported. try using Security Library from Mentalis.org.
here is an another blog post related to Explicit SSL support by SmtpClient..


Regards,


这适用于我:





MailMessage msg = new MailMessage() ;

msg.From =新邮件地址(developers@gmail.com);

msg.To.Add(txtemail.Text);

msg.Subject =确认注册;

msg.Body =欢迎来到我的网站;



SmtpClient smtp = new SmtpClient();

smtp.Host =smtp.gmail.com;

smtp.Port = 25;

smtp.EnableSsl = true;

smtp.UseDefaultCredentials = true;

smtp.Credentials = new NetworkCredential(developers@gmail.com,password);

smtp.Send(msg);
This Works for me:


MailMessage msg = new MailMessage();
msg.From = new MailAddress("developers@gmail.com");
msg.To.Add(txtemail.Text);
msg.Subject = "Confirm Registration";
msg.Body = "Welcome To My Site";

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 25;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = true;
smtp.Credentials = new NetworkCredential("developers@gmail.com", "password");
smtp.Send(msg);


这篇关于使用smtp客户端时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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