无法从服务器发送邮件 [英] Unable to send mail from server
本文介绍了无法从服务器发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用我的真实帐户发送邮件,我的代码在localhost上工作正常,但在服务器上提供了例外:
邮箱不可用。服务器响应为:5.7.3
请求的操作中止;用户未经过身份验证
以下是我的代码:
I am sending mails using my live account and my code works fine on localhost but gives an exception on server:
Mailbox unavailable. The server response was: 5.7.3
Requested action aborted; user not authenticated
Below is my code:
public static string SendEmail(string receivermailid, string subject, string body)
{
MailMessage MyMailMessage = new MailMessage("xyz@live.com", receivermailid, subject, body);
MyMailMessage.IsBodyHtml = true;
NetworkCredential mailAuthentication = new
NetworkCredential("xyz@live.com", "xxxx");
SmtpClient mailclient = new SmtpClient("smtp.live.com", 25);
mailclient.EnableSsl = true;
mailclient.UseDefaultCredentials = false;
mailclient.Credentials = mailAuthentication;
try
{
mailclient.Send(MyMailMessage);
return "Sent successfully";
}
catch (SmtpException ex)
{
return ex.Message;
}
推荐答案
我的猜测是默认凭证或SSL,但我们很难说;我们无法访问您的服务器...
也可能是防火墙问题!
祝你好运!
My guess is either the default credentials or SSL, but it's hard for us to say; We don't have access to your server...
Could be firewall trouble as well!
Good luck!
这篇关于无法从服务器发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文