The first thing a mail server says when you connect is a single line: the banner. It begins with the code 220, followed by a host name and, usually, some text about the software. It looks like decoration, yet receivers and security scanners read it carefully. A banner with the wrong host name can contribute to spam points; a banner that reveals exact software and version helps attackers pick exploits; an empty or odd banner can look like a bot. Administrators also change banners for branding, which carries its own small risks. This guide explains what the standard requires, what a good banner contains, whether to hide version information, how banners relate to HELO and reverse DNS, how to configure them in common servers and how to test the result. It builds on an SMTP conversation step by step, FCrDNS and VRFY and EXPN.
What the standard says
RFC 5321 requires the server to start the session with a 220 greeting that includes its fully qualified domain name. Free text after the name is permitted but not required. The server speaks first on a normal SMTP port; a server that sends nothing, or sends a malformed line, breaks clients. A multi-line banner is allowed (each line except the last uses 220-), but many clients and scanners expect one line, so keep it single.
220 mail1.example.com ESMTP ready
220 mail1.example.com ESMTP Postfix
220-mail1.example.com ESMTP
220 Authorized use onlyAll four lines are valid SMTP, but their quality differs. The first is neutral and good. The second names the software, which is common and not forbidden but unnecessary. The last two show a multi-line banner; the final line should still begin with 220 followed by a space. A greeting with no host name violates the requirement and is penalised by some receivers.
What a good banner contains
| Element | Recommendation | Reason |
|---|---|---|
| Code | 220 | Required greeting code |
| Host name | Your public fully qualified name, the same as PTR and EHLO | Receivers compare banner, PTR and HELO for consistency. See FCrDNS |
| Protocol word | ESMTP | Signals support for extensions |
| Software name and version | Omit, or give a generic term | Version strings help scanners and attackers map known vulnerabilities |
| Operator text | Short, optional, non-promotional | Banners are not a place for marketing or jokes |
| Legal notice | Put on submission login banners if required by policy, not on public port 25 text | Some auditors ask for notices; they have no legal effect on a public MX and clutter the greeting |
| Line count | One line | Compatibility with simple scanners and clients |
To hide the version or not
Hiding the exact version is a minor hardening step, not a security control. An attacker can fingerprint a server in other ways (behaviour of commands, extension lists, error text), and defenders gain the most from patching, not from secrecy. The cost of removing the version is almost zero, though, and it reduces trivial scanning noise. Many administrators therefore configure the banner to state only the host name and the ESMTP word. Do not go further and forge the banner to claim a different product: it serves no purpose, confuses your own troubleshooting and can look suspicious to filters that compare the banner with observed behaviour.
Configuration examples
| Server | Setting | Result |
|---|---|---|
| Postfix | smtpd_banner = $myhostname ESMTP | 220 mail1.example.com ESMTP (the default includes the software name) |
| Exim | smtp_banner = "${primary_hostname} ESMTP" | 220 mail1.example.com ESMTP |
| Sendmail | Set SmtpGreetingMessage with the macro for the host name | Controls the text after the host name |
| Microsoft Exchange | Set the connector banner with Set-ReceiveConnector -Banner | Also set the FQDN of the connector to the public name |
| Haraka and other modern MTAs | Plugin or configuration option for the greeting text | Check the documentation for the exact key |
| Gateways and cloud filters | Often fixed; verify what they show | Ensure the gateway name matches PTR if it is the public endpoint |
# Postfix
postconf -e 'myhostname = mail1.example.com'
postconf -e 'smtpd_banner = $myhostname ESMTP'
postfix reload
# Check what is shown from outside
printf 'QUIT\r\n' | nc -w 5 mail1.example.com 25Banner and receivers
- Host name consistency. The name in the banner (inbound) and the name in your EHLO (outbound) both matter. On outbound connections your server speaks as client with its EHLO name; the banner matters when others connect to you, and the same name should be used for both. See HELO and EHLO errors.
- Generic or dynamic names. A banner such as
220 localhostor220 ubuntushows the server was never configured and is sometimes treated as an unmanaged or compromised host. - Internal names. Showing
srv-db-04.corp.localleaks structure and gives scanners targets. Use the public name. - Greeting delay (greet pause). Some servers wait a few seconds before sending the banner and reject clients that talk before it arrives, a cheap way to stop spam bots. See tarpitting.
- Load balancers. If a load balancer terminates connections, make sure it forwards the real server banner or presents a correct one of its own; a blank or immediate close breaks monitoring.
- Implicit TLS ports. On port 465 the banner appears only after the TLS handshake, so a plain-text scan of that port shows nothing.
Security scanning and banner grabbing
Security scanners connect, read the banner and match it against databases of known software. Because the match is based on text, accurate-looking banners can trigger alarms for old vulnerabilities even in patched software, and hidden banners can make an audit report "unknown service". If your auditors require a particular style, agree on one neutral banner and document that the version is deliberately hidden. For real assurance, rely on patch management and on configuration checks, not on the banner. Also remember that banners are sent to anyone who connects, including bots; a rate limit on connections and a firewall policy for management ports matter more than the text.
Testing
- Connect from outside your network with netcat, telnet or
openssl s_client -starttls smtpand read the first line. - Confirm that the host name in the banner is a fully qualified public name.
- Look up the PTR record of the server IP and the A record of the banner name; they should agree. See FCrDNS.
- Send EHLO and verify that the name you announce as a client (for outbound connections) is the same name.
- Check that the banner has one line and ends with a normal 220 line.
- Repeat the test through any load balancer, VPN or cloud gateway in front of the server.
- Re-test after upgrades, because package updates sometimes restore default banners.
Common mistakes
| Mistake | Effect | Fix |
|---|---|---|
| Default banner with software and version left in place | Needless disclosure | Set a neutral banner |
Banner shows localhost or an internal name | Looks misconfigured; leaks structure | Use the public FQDN |
| Banner does not match PTR | Reputation and filter penalties | Align PTR, A record and banner |
| Jokes, ASCII art or marketing text | Unprofessional; may confuse scanners and monitoring | Keep it short |
| Multiple banner lines with a wrong final line | Clients hang or fail | End with a single "220 " line |
| Forging another product | Misleads your own team and breaks troubleshooting | Do not do it |
| Long banner delay | Legitimate clients time out | Keep greet pause to a few seconds and allowlist known senders |
The SMTP banner is tiny but visible to everyone who connects. Give it your real public name, keep the text short and neutral, make sure the name matches your reverse DNS and EHLO and test it from outside after every change. It is one of the cheapest ways to look like a well-run mail server.
Check your mail server from outside See whether your IP appears on any blocklist.
References and further reading
Frequently asked questions
What is the SMTP banner?
The first line a server sends after a connection, starting with 220 and containing its host name and optional text.
Should the banner match the PTR record?
Yes. Using the same fully qualified name in the banner, PTR record and EHLO avoids consistency penalties.
Should I hide the software version?
It is a minor hardening step with little cost, so most administrators show only the host name and ESMTP.
Can I put a legal notice in the banner?
You can, but on a public MX it has no legal value and clutters the greeting; use login banners for submission services if policy requires.
How do I test my banner?
Connect with netcat or openssl s_client from outside your network and read the first line.