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?