通过Yahoo发送邮件时出错?

时间:2011-08-17 13:04:42

标签: c# email gmail yahoo

从雅虎发送电子邮件时出错。我尝试过端口25,995,465,587!我现在没有选择了。如果有人能告诉我问题是什么,我将非常感激。雅虎现在不是smtp!我在某处读到这是一项付费服务​​或其他什么?这是正确的,因为它,我无法通过服务器!我可以成功发送来自我的Gmail帐户的电子邮件,其中To和From相同,我也发送了一封邮件从gmail发送到雅虎,但反过来不起作用!

 MailMessage mail = new MailMessage();
 mail.From = new MailAddress(something@yahoo.co.in);
 //***Enter recievers Email here (TVC)
 mail.To.Add(new MailAddress("something@gmail.com"));
 mail.Subject = "This is some text";
 mail.Body = "This is the body";
 SmtpClient client = new SmtpClient("plus.smtp.mail.yahoo.com",995);
 client.Credentials = new System.Net.NetworkCredential("somehting@yahoo.co.in", "pass");
 client.EnableSsl = true;
 client.Send(mail);
 MessageBox.Show("Mail Sent Successfully!", "Success", MessageBoxButtons.OK);

我收到以下异常

System.Net.Mail.SmtpException was unhandled
Message=Failure sending mail.
Source=System
StackTrace:
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at WindowsFormsApplication1.frmSelfAssessment.mailToTVC()
   at WindowsFormsApplication1.frmEnterEmail.button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at WindowsFormsApplication1.frmSelfAssessment.btnSubmit_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at WindowsFormsApplication1.Program.Main()
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
   InnerException: System.IO.IOException
   Message=Unable to read data from the transport connection: net_io_connectionclosed.
   Source=System
   StackTrace:
        at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
        at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
        at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
        at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
        at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
        at System.Net.Mail.SmtpClient.GetConnection()
        at System.Net.Mail.SmtpClient.Send(MailMessage message)
   InnerException:

使用try catch块后,这就是我得到的

System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at WindowsFormsApplication1.frmSelfAssessment.mailToTVC() 

3 个答案:

答案 0 :(得分:2)

除非你是雅虎,否则我认为你不能这样做。加上账户持有人。

阅读本文:http://help.yahoo.com/l/us/yahoo/mail/classic/mailplus/pop/pop-08.html

这是链接:Time out Error in send mail
(OP从来没有相信它,所以没有标记为答案。请注意,另一个答案也没有标记,这意味着OP没有得到解决方案)

P.S:我刚检查过通过“smtp.yahoo.com”端口465发送邮件。它也被强制关闭。截至目前,它也无法正常工作。

希望这有帮助。

答案 1 :(得分:0)

一个好的起点是尝试手动完成。只需使用telnet连接到端口25上的服务器,请按照此page中所述的命令进行操作。

通过这种方式,你可以看到在它破裂之前你能走多远。

答案 2 :(得分:0)

如果您将代码包装在try / catch块中并调试异常,您将收到更有意义的消息,告诉您问题所在。