Email issues with postfix

I’m hosting multiple domains, all use gravity forms to send mail and the mail notifications work great except one.

In all the working gravity forms notifications I’m sending notifications to a gmail account. However on the site that’s not working (let’s say example.com) I’m sending an email to [email protected] and have setup an email account using a 3rd party email service.

The log error I see in mail.log is (email address has changed):

May 8 16:14:29 localhost postfix/smtp[17792]: BBED9C1DA1: to=[email protected], relay=mx1.privateemail.com[192.64.116.198]:25, delay=0.79, delays=0.02/0.01/0.43/0.33, dsn=5.5.2, status=bounced (host mx1.privateemail.com[192.64.116.198] said: 504 5.5.2 www-data@localhost: Sender address rejected: need fully-qualified address (in reply to RCPT TO command))

www-data@localhost: Sender address rejected: need fully-qualified address

You need to specify a FQDN as localhost is not a FQDN

Please paste the output of following command
postconf -n

Thanks, Would I need to add one for each domain then?

Here’s the output
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost, localhost.localdomain, localhost
myhostname = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

@coreyallen

myhostname = localhost

You need to change myhostname variable in /etc/postfix/main.cf
Then restart postfix
service postfix restart

@miteshshah Does the hostname need to be a FQDN which is associated with my server? Similar to @coreyallen, my server runs multiple domains, and emails sent to gmail work fine, but for 3rd party emails, they don’t. i.e. GoDaddy hosted email, or even email forwarding.

Additionally, when using Amazon EC2 instances, they automatically set the hostname to the internal IP address. Does anyone know if this is causing a conflict with postfix? Do I need to change the hostname to a FQDN (example.com) which has DNS records pointing to my server?

Also, I would like to reiterate this question, because I am wondering this as well:

So I may have figured out the answer to my question: Here’s a helpful tutorial from Linode. Apparently there’s a Reverse DNS issue with emails. I’ll list a few tutorials here:

https://www.linode.com/docs/email/running-a-mail-server (just read the part about hostnames)

Hi @coreyallen

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile: