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
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.
×
Change the following two lines
Where SERVERNAME is whatever you call your server.
Thank you for the comment @hansen
SERVERNAME is the same as what I get from
hostname -f
? It’s goodnightjournal.com for me.Didn’t seem like working still getting error below.
Normally you would have a hostname for your server, which is part of a domain, which then is part of a TLD.
One of my servers is called Maria, so then I would have the FQDN looking like
maria.goodnightjournal.com
Because your server is actually not managing mail, but just relaying it, then you cannot use goodnightjournal.com as myhostname/mydestination, since it will swallow all mail being sent from the server to whatever@goodnightjournal.com and not relaying it.
@hansen I don’t think I’m fully following :( It seems like Postfix is sending out the email but my Godaddy email is bouncing the email cause it’s coming from
from=<www-data@104.236.98.136>
. Godaddy says thatVerify that you are sending from a valid domain. Then verify that the domain has valid DNS records by doing an external DNS lookup. If the DNS isn't valid, it must be fixed before you resend the email.
Do you know how to changefrom=<www-data@104.236.98.136>
tofrom=<www-data@goodnightjounrnal.com>
? I think this might solve the issue.Log in to https://cloud.digitalocean.com/networking/ptr and your rDNS to
goodnightjournal.com.
- wait a few hours (maybe a day) and try again.And while you’re at it, you should probably setup SPF for your domain to tell others that your server is allowed to send email as goodnightjournal.com.
https://www.digitalocean.com/community/tutorials/how-to-create-a-spf-record-for-your-domain-with-google-apps
EDIT: Not that you have Google Apps, but just as a reference guide.
Thank you again for the answer. I actually had them set up the way to suggested already. I feel like totally lost now..