Error sending email by external access. Internal access works

1

Error sending email. I have a form that sends email with attachments. When run from within the company, it works perfectly. When called from outside, that is, when called by the published project, it generates the error of the image below. We already validated port, host, credentials and everything is okay. Is there any configuration in web.config or somewhere else that might be blocking it?

public ActionResult EnviaEmail(string destinatario, string assunto, string mensagem, IEnumerable<HttpPostedFileBase> fileUploader)
            {
            SmtpClient client = new SmtpClient();
            if (Convert.ToString(Session["tipo_usuario"]) == "externo")
            {
                client.Host = "email.empresa.com.br";
            }
            else
            {
                client.Host = "exchange.empresa.local";
            }

            client.Port = 25;
            client.EnableSsl = false;
            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential("empresa\jeferson", "10180485");

            System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
            mail.From = new System.Net.Mail.MailAddress("[email protected]");
            mail.To.Add(new System.Net.Mail.MailAddress(destinatario));
            mail.Subject = assunto;
            mail.Body = mensagem;

 mail.Priority = MailPriority.High;

            client.Send(mail);



            return RedirectToAction("Index", "Home");
        }

When processed from within the company, sending the email works perfect. When published and processed the sending of the email from outside the network. Generate this error below:

    
asked by anonymous 26.06.2018 / 22:12

0 answers