使用 SMTP 服务器延迟接收电子邮件
我已经在芝加哥服务器上部署了我开发的电子邮件服务。菲律宾时间上周五晚上 11:30,我测试了发送,运行正常,但是当我检查电子邮件时,收件箱中没有消息或垃圾邮件。然后,周六凌晨 1:30,我注意到我收到了上周五测试的消息。
请大家给我建议!谢谢!
我的问题是:
a.) 我是否需要在服务器上配置某些内容才能实时接收电子邮件?
这是我的代码:
//send email
MailMessage objEmail = new MailMessage(new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()), new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()));
objEmail.Subject = "Test";
objEmail.Body = "CODE:" + _Message;
objEmail.Priority = MailPriority.High;
SmtpClient SmtpMail = new SmtpClient();
SmtpMail.Host = "localhost";
SmtpMail.Send(objEmail);
I already deployed the Email Service I developed on the Chicago Server. Last Friday 11:30pm in Philippine time, I tested the sending and it run's properly, but when I checked my email there's no message in inbox or spam. And then, Saturday 1:30am, I've noticed that I received the message that I tested last Friday.
Please advice me guys! thanks!
My Questions is:
a.) Do I need to configure something on the Server to make the real time receiving on emails?
here's my code:
//send email
MailMessage objEmail = new MailMessage(new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()), new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()));
objEmail.Subject = "Test";
objEmail.Body = "CODE:" + _Message;
objEmail.Priority = MailPriority.High;
SmtpClient SmtpMail = new SmtpClient();
SmtpMail.Host = "localhost";
SmtpMail.Send(objEmail);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将以下内容添加到您的代码中:
SmtpMail.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
另外,在 SMTP 服务器上配置允许 120.0.0.1/localhost 的中继限制。
最后,配置防火墙并服务器上的端口转发。
我希望这会帮助你..
Put this one on your code:
SmtpMail.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
And also, configure the relay restrictions on the SMTP server that will allow your 120.0.0.1/localhost..
Last, configure the firewall and port forwarding on the server.
I hope this will help you..