550 Bad HELO - מארח המתחזה לשם המארח

סיכום מבוסס בינה מלאכותית

In a self-hosting support thread titled “550 Bad HELO - Host impersonating hostname,” Codes09 reports encountering a Bad HELO error after setting up Discourse. They suspect the issue stems from a mismatch between reverse DNS and the hostname used in SMTP configuration, particularly since their Discourse instance runs on a domain (example.com) different from the mail server’s hostname (20.example.org). Their config includes DISCOURSE_SMTP_DOMAIN: 20.example.org, while the mail server resides on a shared DirectAdmin server. pfaffman asks whether reverse DNS lookup (dig -x) for the VPS IP returns the expected hostname. Codes09 confirms that the VPS resolves to its own hostname (discourse.example.com), but the shared mail server’s reverse DNS returns its own hostname (20.example.org), not example.com — even though example.com resolves to the shared server’s IP. This mismatch may trigger anti-spam systems that reject HELO/EHLO commands when reverse DNS doesn’t exactly match the claimed hostname. The discussion references PHPMailer’s Hostname property as a potential override, citing GitHub issue #1095 for context.

I’m getting a Bad HELO error after setting up Discourse.

I’ve done some digging and found that this can be an issue if the reverse DNS does not match the hostname in some cases.

In my case my config has the mailserver hostname on a shared DirectAdmin server so I’m setting up Discourse on a domain that differs from the hostname domain.

  DISCOURSE_SMTP_ADDRESS: mail.example.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: discourse@example.com
  DISCOURSE_SMTP_PASSWORD: "my_password_without_hash"
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
  DISCOURSE_SMTP_DOMAIN: 20.example.org #note the DirectAdmin domain differs from my domain.
  DISCOURSE_NOTIFICATION_EMAIL: noreply@example.com

It’s quite likely that it’s objecting to your reverse DNS entry not matching, for example you connect from an IP and say EHLO domainname.com, the receiving server does a reverse lookup on that and finds www.domainname.com, which isn’t an exact match, and so it complains/rejects. It’s not an SMTP spec contravention, but it is common anti-spam, anti-forgery practice.

PHPMailer will derive the SMTP envelope sender address from the From address by default, but you can override that using the Hostname property (not the same thing as Host), for example:

$mail->From = 'user@domainname.com';
$mail->Hostname = 'www.domainname.com';
https://github.com/PHPMailer/PHPMailer/issues/1095

Does

  dig -x your.ip.number

Have your host name?

Hi Jay,

Discourse is not allowing met to post links in a reply just yet. So I’ll respond with dot instead of a period. Hope it keeps things clear.

Yes when I run this command against the VPS that discourse is on I get the hostname that discourse is running on. i.e. discourse dot example dot com.

If I run this against the Shared server (where the mailserver is) I get it’s hostname i.e. above 20 dot example dot org. Not example dot com. Technically example dot com resolves to the shared server’s IP. But the shared server has another hostname (20 dot example dot org).