发送电子邮件时出错

时间:2013-07-01 14:09:37

标签: c# asp.net .net

我有一个Web应用程序。 我无法发送电子邮件。我有超时错误。 这个应用程序在我的PC(localhost)中运行。 SMTP的主机和凭据是可以的! 我没有看到错误!

MailMessage objEmail = new MailMessage();
        objEmail.From = new MailAddress("x2@br.x.com");
        objEmail.To.Add(row.Cells[7].Text);
        objEmail.Priority = MailPriority.High;
        objEmail.IsBodyHtml = true;
        objEmail.Subject = "System NDRSecurity - Novas Requisições.";
        objEmail.Body = "Olá! Você tem novas requisições de acesso para serem avaliadas. Favor acessar o link abaixo:" + "x/NDriveSecurity/ManageTickets.aspx";
        objEmail.SubjectEncoding = Encoding.GetEncoding("ISO-8859-1");
        objEmail.BodyEncoding = Encoding.GetEncoding("ISO-8859-1");
        SmtpClient objSmtp = new SmtpClient();
        objSmtp.Host = "outlook.x.com";
        objSmtp.Credentials = new NetworkCredential("x@br.x.com", "XXX");
        objSmtp.Send(objEmail);

0 个答案:

没有答案