Se me esta presentando este error al enviar un correo via smtp:
Message="Error al enviar correo."
Source="System"
StackTrace:
en System.Net.Mail.SmtpClient.Send(MailMessage message)
en WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e)
en System.Windows.Forms.Control.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ButtonBase.WndProc(Message& m)
en System.Windows.Forms.Button.WndProc(Message& m)
en
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
en
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
en
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
en System.Windows.Forms.Application.Run(ApplicationContext context)
en
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
en
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
en
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
en WindowsApplication1.My.MyApplication.Main(String[] Args)
en System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
en System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.IOException
Message="No se puede escribir datos de en la conexión de transporte:
Se ha forzado la interrupción de una conexión existente por el host remoto."
Source="System"
StackTrace:
en System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
en System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset,
Int32 count)
en System.Net.BufferedReadStream.Read(Byte[] buffer, Int32
offset, Int32 count)
en
System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller,
Boolean oneLine)
en
System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
en System.Net.Mail.SmtpConnection.GetConnection(String host,
Int32 port)
en System.Net.Mail.SmtpTransport.GetConnection(String host,
Int32 port)
en System.Net.Mail.SmtpClient.GetConnection()
en System.Net.Mail.SmtpClient.Send(MailMessage message)
InnerException: System.Net.Sockets.SocketException
ErrorCode=10054
Message="Se ha forzado la interrupción de una conexión existente
por el host remoto"
NativeErrorCode=10054
Source="System"
StackTrace:
en System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32
offset, Int32 size, SocketFlags socketFlags)
en System.Net.Sockets.NetworkStream.Read(Byte[] buffer,
Int32 offset, Int32 size)
InnerException:
Acá el código que se está ejecutando:
Dim mail As New MailMessage()
mail.From = New MailAddress("faqui...@yahoo.es")
mail.To.Add("faqu...@hotmail.com")
mail.Subject = "This is an email"
mail.Body = "this is a sample body"
Dim smtp As New SmtpClient("smtp.correo.yahoo.es")
smtp.Port = 465
smtp.Credentials = New NetworkCredential("my_user", "my_pass")
smtp.Send(mail)
Que me falta por hacer?
Gracias
¿Por qué estás usando con yahoo el puerto 465, que es el que usa gmail?
El servidor smtp.correo.yahoo.es contesta correctamente en el puerto
standard (25), pero cierra inmediatamente la conexión si te conectas al 465,
que coincide precisamente con lo que te está informando el mensaje de error.
Si ya habia probado con el puerto 25, pero cuando uso ese puerto me da otro
error:
El servidor SMTP requiere una conexión segura o el cliente no se autenticó.
La respuesta del servidor fue: authentication required - "for help go to
http://help.yahoo.com/help/us/mail/pop/pop-11.html"
Al ir a la pagina que menciona el error se muestra la configuracion para el
yahoo, de hecho en mi outlook lo tengo configurado con puerto 465 y funciona
bien.
Si establezco smtp.EnableSsl = True entonces el error que da es: El
servidor no admite conexiones seguras.
Que crees que falte ? Estoy haciendo mal la autenticacion ?
Gracias