Score:0

Postfix emails error, loops back to myself

cn flag

I'm struggling with Postfix to send out emails from a form on my website:

Google Domain, hosting provided by DigitalOcean with a LAMP droplet; this is my DNS config:

dns config

Mail function on my .php file wants to send an email from: [email protected] to: [email protected]

all goes succesfully except emails are not actually sent.

/var/log/mail.log mentions that status=bounced (mail for mydomain.io loops back to myself)

Here's my main.cf config:

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

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2



# 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_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = packer-611a9b0e-18c5-2e19-5583-bed9efc126b7
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
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 = all
inet_protocols = all
myorigin = /etc/mailname

I looked every guide available to tweak /etc/postfix/main.cf but nothing works, thanks in advance to anybody who's willing to help.

jp flag
You need to list your domain in `mydestination`
Score:0
jp flag

Unless you have MX DNS records defined, the mail to mydomain.io will be delivered to an IP from A DNS record for mydomain.io, which (as I can guess) is the same as your web application. As your application is attempting to send an email to mydomain.io through postfix it loops back to itself. You need to configure your postfix to accept email for mydomain.io by setting mydestination or point MX records to a server that handles email for domain mydomain.io.

Emi-C avatar
cn flag
Thanks @AlexD, any suggestion on how to do so please? I'm struggling to get if this has to be taken care of by the google domain on which the domain (and email domain) is registered or by the hosting platform.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.