Hola. Tengo un problema al momento de mandar datos a un email con C#. Hice una pequeña aplicacion en el cual al momento de presionar un boton me mande los datos a un email. Este es el codigo que implemento dentro del boton:
try
{
MailMessage correo = new MailMessage();
correo.From = new MailAddress("xxxxxxxxxx@gmail.com");
correo.To.Add( "xxxxxxxxx@hotmail.com");
correo.Subject = "Prueba";
correo.Body = "Hola soy un email que enviaron desde c#";
correo.IsBodyHtml = false;
correo.Priority = MailPriority.Normal;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.hotmail.com"; //ip o host
//smtp.Credentials = new System.Net.NetworkCredential("xxxxxxxxxx@hotmail.c om", "********");
smtp.Send(correo);
label1.Text = "Se enviaron los datos corectamente";
}
catch (Exception ex)
{
//MessageBox(ex.ToString);
Console.WriteLine("Tipo de excepcion: {0}", ex);
}
Cuando el programa ya esta en ejecucion y presiono el boton este es el error que me aparece:
Excepción del tipo 'System.Net.Mail.SmtpException' en System.dll
y este es el que me aparece cuando termino el programa:
Tipo de excepcion: System.Net.Mail.SmtpException: El buzón de correo no está disponible. La respuesta del servidor fue: DY-001 Mail rejected by Windows Live Hotmail for policy reasons. We generally do not accept email from dynamic IP's as they are not typically used to deliver unauthenticated SMTP e-mail to an Internet mail server. http://www.spamhaus.org maintains lists of dynamic and residential IP addresses. If you are not an email/network admin please contact your E-mail/Internet Service Provider for help. Email/network admins, please visit http://postmaster.live.com for email delivery information and support
en System.Net.Mail.MailCommand.CheckResponse(SmtpStat usCode statusCode, String response)
en System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
en System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
en System.Net.Mail.SmtpClient.Send(MailMessage message)
en mandarEmail.Form1.button1_Click(Object sender, EventArgs e) en D:\Visual Studio 2005\Projects\mandarEmail\mandarEmail\Form1.cs:lín ea 34
¿Sera que tenga algo k ver k no tenga instalado el ISS? o ¿Cual es el error?
:-) Saludos