Question

Postfix can't send email to the same domain name email address as the droplet

I have been researching for 3days but haven’t find the solution for this email issue.

I use Postfix to send out email on my droplet which is working fine for all email addresses but not for the email address that I assigned to the droplet. I have tried http://stackoverflow.com/questions/18377813/postfix-status-bounced-unknown-user-myuser and all other suggestions I found online but nothing worked.

Here is my etc/postfix/main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = goodnightjournal.com
alias_maps = hash:/etc/aliases
# virtual_alias_maps = hash:/etc/postfix/virtual
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all

and I’m getting this error message on sending email to o@goodnightjournal.com from my contact form on the site.

Feb 23 01:30:41 goodnightjournal postfix/pickup[17494]: 492A4185557: uid=33 from=<www-data>
Feb 23 01:30:41 goodnightjournal postfix/cleanup[17713]: 492A4185557: message-id=<d2b17d8f8fb99f252a50a823d0e8cbdb@goodnightjournal.com>
Feb 23 01:30:41 goodnightjournal postfix/qmgr[17105]: 492A4185557: from=<www-data@104.236.98.136>, size=706, nrcpt=1 (queue active)
Feb 23 01:30:41 goodnightjournal postfix/smtp[17715]: 492A4185557: to=<o@goodnightjournal.com>, relay=smtp.secureserver.net[68.178.213.203]:25, delay=0.48, delays=0.01/0/0.21/0.25, dsn=5.2.0, status=bounced (host smtp.secureserver.net[68.178.213.203] said: 550 5.2.0 <www-data@104.236.98.136> From: Domain is invalid. Please provide a valid From: IB506  <http://x.co/srbounce> (in reply to end of DATA command))
Feb 23 01:30:41 goodnightjournal postfix/cleanup[17713]: BEB9D185558: message-id=<20170223063041.BEB9D185558@goodnightjournal.com>
Feb 23 01:30:41 goodnightjournal postfix/qmgr[17105]: BEB9D185558: from=<>, size=2817, nrcpt=1 (queue active)
Feb 23 01:30:41 goodnightjournal postfix/bounce[17716]: 492A4185557: sender non-delivery notification: BEB9D185558
Feb 23 01:30:41 goodnightjournal postfix/qmgr[17105]: 492A4185557: removed
Feb 23 01:30:41 goodnightjournal postfix/error[17718]: BEB9D185558: to=<www-data@104.236.98.136>, relay=none, delay=0.02, delays=0.01/0.01/0/0, dsn=5.1.3, status=bounced (bad address syntax)
Feb 23 01:30:41 goodnightjournal postfix/qmgr[17105]: BEB9D185558: removed
Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Per the Postfix documentation on mydestination, it should contain the list of domains whose emails are hosted on the local Postfix server so that they are handled internally and not relayed out to external systems.

If you are not using Postfix to receive mail, you should set mydestination to localhost only. Looking at the original error message:

Feb 23 01:30:41 goodnightjournal postfix/smtp[17715]: 492A4185557: to=<o@goodnightjournal.com>, relay=smtp.secureserver.net[68.178.213.203]:25, delay=0.48, delays=0.01/0/0.21/0.25, dsn=5.2.0, status=bounced (host smtp.secureserver.net[68.178.213.203] said: 550 5.2.0 <www-data@104.236.98.136> From: Domain is invalid. Please provide a valid From: IB506  <http://x.co/srbounce> (in reply to end of DATA command))

The bit that pops out is From: Domain is invalid. Please provide a valid From:. It looks like the contact form isn’t setting the From: field so it’s being automatically set by php to www-data@IP which apparently some email servers don’t like. So, make sure you set the From: field to a valid email address in your contact form’s settings and you should be fine.

Hello friends, I am really stuck with this kind of Problem. We have 2 domains hosted on 1 Droplet (Apache2, Ubuntu 16.04). We are using Gsuite for 1 domain and for other domain we use Zoho as our email services. We have set the MX record in DNS correctly. Also installed Postfix on our droplet as MTA (send only). But still now our PHP Forms (built with WP Plugins) doesn’t send emails to our domain based email a/c - our form level config is ok - double checked. Can any body help me out… getting error in mailtester: https://www.mail-tester.com/web-89o10

Any help/suggestion will be highly appreciated, thanks

This comment has been deleted