Authentication credentials to send mail from C #

0

I have a server where I send and receive messages, create an app from C # where I can send emails but do not recognize the credentials that I tell you, they tell me they are false:

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


                SmtpClient client = new SmtpClient("web.local.com", 443);


                using (client)
                {
                    client.Credentials = new NetworkCredential("[email protected]", "xxxx");
                    client.EnableSsl = true;
                    client.Send(correo);
                }
                try
                {
                    correo.Dispose();
                    MessageBox.Show("Email was successfully sent. ", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error sending email. " + ex, "", MessageBoxButtons.OK, MessageBoxIcon.None);
                }

I do not know if other ports are used because they are local. The problem is that the user does not recognize.

    
asked by use2105 31.01.2017 в 17:22
source

1 answer

0

You have already tried adding the following UseDefaultCredentials parameter in the client block.

            using (client)
            {
                client.UseDefaultCredentials = false; // o true dependiendo el caso de acceso
                client.Credentials = new NetworkCredential("[email protected]", "xxxx");
                client.EnableSsl = true;
                client.Send(correo);
            }
    
answered by 31.01.2017 в 20:33