对 SMTP / IIS 以及通过 ASP 发送电子邮件实际发生的情况感到困惑
我有一台 Windows 2003 / IIS 6.5 机器,运行一个经典的 ASP 站点。
该网站本身会发送电子邮件(“忘记密码”等),我还在计算机上运行脚本来发送电子邮件新闻通讯。
我在发送方面没有真正的问题...但我对电子邮件的实际工作方式感到困惑。
当我从我的网站发送邮件时(我不提供任何登录信息),SMTP 服务器 (IIS) 是否与我的电子邮件提供商(gmail for Business)进行通信?我的 IIS SMTP 服务器是否只是将电子邮件发送出去(也许对目标进行 MX 查找?)? DNS 记录中的 SPF 记录允许这样做吗?
我刚刚重建了我们的服务器(灾难后)并将我们的电子邮件移至 gmail...所以,我现在正在设置这一切...我可以阅读所有“操作方法”文章 - 但除非我理解一些简单的概念,我真的不知道自己在做什么。
谢谢!
I have a windows 2003 / IIS 6.5 machine running a classic ASP site.
The site itself sends emails ('forgot password', etc.) and I also run scripts on the machine to send email newsletters.
I don't have a real problem sending... but I am confused about how emailing actually works.
Is the SMTP server (IIS) ever communicating with my email provider (gmail for business) when I send from my website (I don't provide any login info)? Does my IIS SMTP server just blast emails out (maybe doing an MX lookup for the target?)? Is it the SPF record in the DNS records that allows this?
I just rebuilt our server (after disaster) and moved our email to gmail... so, I am setting this all up now... I can read all the 'how-to' articles - but unless I understand a few simple concepts, I won't really know what I am doing.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
向某人发送邮件时,会涉及两个 SMTP 服务器。
基本上,当您从邮件客户端发送邮件时,您的邮件客户端会将邮件发送到您自己的 SMTP 服务器,然后该服务器将邮件发送到收件人 SMTP 服务器。出现此(跃点)的原因是因为服务器可能会关闭/速度缓慢/等等,而您自己的服务器现在的责任是尝试(通常)在 48 小时内递送邮件。
要找出收件人拥有的 SMTP 服务器,发件人 SMTP 会查找收件人域的 MX 记录:
如您所见,可以为一个域指定多个 SMTP 服务器(用于冗余),并且发件人SMTP 将根据优先级选择一个(有效的)。然后邮件被发送到该服务器。
并且(如果不使用网络邮件)收件人邮件客户端可以使用 POP3 或 IMAP 协议下载该邮件。
现在,当您从 ASP.NET 发送邮件时,发件人 SMTP 服务器通常是本地 IIS SMTP服务,而不是您所在域的常用 SMTP 服务器(您自己用来发送邮件的服务器;在您的实例中为 Gmail)。
SPF 记录是添加到您的 DNS 的记录,用于指定允许哪些 SMTP 服务器从您的域发送邮件。通常,如果您指定它们,接收方 SMTP 服务器会强制将发件人 SMTP 服务器列在发件人地址中的域的 SPF 记录中。但是,如果您没有指定它们,邮件通常会被允许通过,并且其他垃圾邮件归档程序会介入。
无论如何,希望这有助于澄清事情......
When sending a mail to someone, there's two SMTP servers involved.
Basically, when you send a mail from your mailclient, your mailclient sends the mail to your own SMTP server, which then sends the mail to the recipients SMTP server. The reason for this (hop) is because servers may be down/slow/etc and your own server's responsibility is now to try and deliver the mail for (usually) within 48 hours.
To find out what SMTP server the receipient has, the MX-records are looked up, by the sender SMTP, for the recipients domain:
As you can see, multiple SMTP servers can be specified for a domain (for redundancy), and the sender SMTP will pick one based on priority (one that works). The mail is then sent to that server.
And (if not using a webmail) the recipients mailclient may download that mail using e.g. POP3 or IMAP protocols.
Now, when you send a mail from ASP.NET the sender SMTP server is usually the local IIS SMTP service, and not the usual SMTP server for your domain (the one that you yourself use to send mail; in your instance Gmail).
SPF-records are records added to your DNS to specify what SMTP servers are allowed to send mail from your domain. Usually, IF you specify them, the receiver SMTP servers force that the the sender SMTP server is listed in the SPF record for the domain in the from-address. If you don't specify them however, mail is usually let though anyway, and other SPAM-filers kick in.
Anyway, hope this helps to clarify things...
开箱即用,IIS 6 将使用内置的 SMTP 服务器发送,经典 ASP 通常默认使用拾取目录 x:\inetpub\mailroot\pickup\。 ASP 在这里创建一个电子邮件文件,当 SMTP 服务检测到它时,邮件就会被移动以进行处理。如果您停止“简单邮件传输协议”服务,您应该会看到文件备份在此处,再次启动将使它们全部消失。
SMTP 虚拟服务器将出现在 IIS 管理中,从那里您可以将其设置为使用您的 google 帐户作为转发器,或者更好的是,您应该调整您的邮件功能以使用 SMTP 发送到 Google 而不是本地。假设您正在使用 CDOSYS,请使用以下代码指定邮件服务器和登录详细信息:
源
您应该时常监视您的邮件根文件夹中的“队列”和“死信”文件夹,即使唯一的操作是清除它们。
Out of the box, IIS 6 will send using the built in SMTP server, Classic ASP usually default to using the pickup directory
x:\inetpub\mailroot\pickup\
. ASP creates an email file in here and when the SMTP service detects it, the mail is moved for processing. If you stop the 'Simple Mail Transfer Protocol' service, you should see files backing up in here, starting it again will make them all go out.The SMTP Virtual server will appear in IIS Management, and from there you can set it to use your google account as a forwarder, or better still, you should adjust your mail function to use SMTP to Google instead of local. Presuming that you are using CDOSYS, use the following code to specify a mail server and logon details:
Source
You should monitor your mailroot folder from time to time, for the 'queue' and 'badmail' folders, even if the only action is to clear them out.