I have a droplet on DigitalOcean and decided to implement my own mail server there using postfix and dovecot. Everything worked correctly and I was able to send and receive emails via a mail client (Airmail for Mac). My droplet is debian and I set all the DNS records as expected.

I set the following restrictions (on postfix main.cf):

    smtpd_banner = $myhostname ESMTP
    smtpd_helo_required = yes
    smtpd_helo_restrictions = permit_mynetworks, reject_non_fqdn_helo_hostname,  reject_invalid_helo_hostname, reject_unknown_helo_hostname, permit
    smtpd_recipient_restrictions = reject_unknown_client_hostname, reject_unknown_sender_domain,  reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated,     reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_sender

The strange thing is that my emails get rejected due to how the hostname is set on my local machine (not the server). So, if I set the hostname on my computer to example.local, the mail helo message is rejected but if i set it to example.com, the message gets sent.

If I am not mistaken, my computer hostname should have no impact on the emails sent/received. Any ideas why this is happening?


You should also add permit_sasl_authenticated at the beginning of smtpd_helo_restrictions, as that part is evaluated before the recipient restrictions and your message will be rejected because example.local isn't considered a valid hostname by Postfix.

  • That worked as you said, thanks. I would upvote but I cannot yet. One question though: should the hostname of my local machine be used on the helo message? Is that behaviour expected? – user275098 Mar 8 '15 at 18:02
  • @CedricPimenta yes the FQDN of the machine should be in the HELO message as per the SMTP spec (otherwise servers would reject your messages as you've experienced it yourself) but for a mail client it doesn't really matter as authentication should short-circuit the HELO check and other mail servers will only see your own server's HELO (with its correct hostname) when you send outgoing mail. – user186340 Mar 8 '15 at 18:26
  • 1
    Better use the submission port for submitting mail using authentication. – sebix Mar 8 '15 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy