问题
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