Error sending mail from asp.net c #

0

I have an application asp.net c# , which sends emails to a fixed address, such as outgoing mail use hotmail and send it a gmail . When I run the application in local mode I have no problems, but when I upload it to server iis 6 it gives me this:

  

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Error sending mail.

This is the method I use to send:

public string nombre;
        public string para;
        public string asunto;
        public string cuerpo;
        public MailMessage correo;

        public void enviaCorreo()
        {
            //correo.IsBodyHtml = true;

            correo = new MailMessage();
            correo.To.Add(new MailAddress(this.para));
            correo.From = new MailAddress("[email protected]");
            correo.Subject = asunto;
            correo.Body = cuerpo;
            correo.IsBodyHtml = false;

            //SmtpClient client = new SmtpClient("smtp-mail.outlook.com", 587);
            SmtpClient client = new SmtpClient("smtp.live.com", 587);
            using (client)
            {
                client.Credentials = new System.Net.NetworkCredential("[email protected]", "xxxx");
                client.EnableSsl = true;
                client.Send(correo);
            }
        }

How can I fix it?

    
asked by rvp.- 03.08.2016 в 22:07
source

0 answers