Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SMTP Live.com“;发送邮件失败“;_C#_Email_Smtp_Send - Fatal编程技术网

C# SMTP Live.com“;发送邮件失败“;

C# SMTP Live.com“;发送邮件失败“;,c#,email,smtp,send,C#,Email,Smtp,Send,这些代码有什么问题?它总是抛出异常“{”发送邮件失败。“}”!我不知道为什么。请帮帮我 编辑:内部异常:{“无法连接到远程服务器”} 按以下方式发送邮件时使用关键字删除: smtp.Credentials = new NetworkCredential(emailFrom, password); smtp.EnableSsl = enableSSL; smtp.Send(mail); 发件人: 致: 拆下大括号,如下所示: smtp.Credentials = new NetworkCrede

这些代码有什么问题?它总是抛出异常“{”发送邮件失败。“}”!我不知道为什么。请帮帮我

编辑:内部异常:{“无法连接到远程服务器”}


按以下方式发送邮件时使用关键字删除:

smtp.Credentials = new NetworkCredential(emailFrom, password);
smtp.EnableSsl = enableSSL;
smtp.Send(mail);
发件人:

致:

拆下大括号,如下所示:

smtp.Credentials = new NetworkCredential(emailFrom, password);
smtp.EnableSsl = enableSSL;
smtp.Send(mail);

检查是否存在具有更多信息的内部异常内部异常:{“无法连接到远程服务器”}Internet正常工作。{“由于连接方在一段时间后没有正确响应,连接尝试失败,或者由于连接的主机未能响应MyiPadRese,建立的连接失败”}与您的代码无关的东西…防火墙?尝试telnet。检查相同的错误:无法连接到服务器!
SmtpClient smtpClient = new SmtpClient();
smtp.Credentials = new NetworkCredential(emailFrom, password);
smtp.EnableSsl = enableSSL;
smtp.Send(mail);