我想使用 asp.net 发送电子邮件,我已经配置了我的 SMTP 服务并添加了 127.0.0.1 作为中继。我以前在家里申请成功了,但是我在办公室安装它不能发送电子邮件,为什么?
这是C#代码
MailMessage objemail = new MailMessage();
objemail.To.Add(new MailAddress("apthodisiac@gmail.com"));
objemail.From = new MailAddress(Request.Form["inputEmail"].ToString());
objemail.Subject = Request.Form["inputSubject"].ToString();
objemail.Body = "Dari: " + Request.Form["inputName"].ToString() + "\n\n" +
"Phone: " + Request.Form["inputPhone"].ToString() + "\n\n" +
Request.Form["inputMsg"].ToString();
objemail.IsBodyHtml = true;
objemail.Priority = MailPriority.Normal;
SmtpClient objSmtpClient = new SmtpClient();
objSmtpClient.Send(objemail);
这是 web.config 配置
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="127.0.0.1" port="25" userName="yyyy" password="xxxxx" />
</smtp>
</mailSettings>
</system.net>
我的办公室使用代理,是我无法发送电子邮件的问题吗?请指教