Significance of 'localhost' in HELO localhost

徘徊边缘 提交于 2021-02-19 03:21:36

问题


In SMTP, what is supposed to come after the HELO command and what does it do?

I'm sending email in my application and I'm wondering if I should use localhost, the domain name of the from-address (me@example.com), the domain name of the application server (where the email is being sent from) or something else.


回答1:


The parameter after HELO should identify the system sending the email. So, you would use an externally addressable DNS name for your sending machine.

Do not use localhost because a lot of spam software does that, and your email will be marked as spam.

From RFC 2821:

4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO)

These commands are used to identify the SMTP client to the SMTP server. The argument field contains the fully-qualified domain name of the SMTP client if one is available.

I would usually recommend that you use a real MTA, and hand off your email to the MTA for ultimate delivery. That way you don't have to reinvent the implementation of the SMTP protocol, which is surprisingly easy to get wrong.




回答2:


It should be the domain name of the application server.

  HELO <SP> <domain> <CRLF>

  In the HELO command the host sending the command identifies
  itself; the command may be interpreted as saying "Hello, I am
  <domain>".

http://tools.ietf.org/html/rfc821



来源:https://stackoverflow.com/questions/5294478/significance-of-localhost-in-helo-localhost

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!