Postfix can't send email to the same domain name email address (G Suite)
dtcooper opened this issue · 5 comments
Using GMail for my G Suite account, for example mydomain.com
below, I run the container with the following environment variables:
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=no-reply@mydomain.com
SMTP_PASSWORD=topsecret
SERVER_HOSTNAME=mydomain.com
Now if try to send an email to user@mydomain.com
, I get the following error,
Oct 11 02:55:23 c2068577d527 postfix/smtpd[96]: NOQUEUE: reject: RCPT from carb_admin_run_1bc21d8a4fd6.carb_default[****]: 550 5.1.1 <user@mydomain.com>: Recipient address rejected: User unknown in local recipient table; from=<no-reply@mydomain.com> to=<user@mydomain.com> proto=ESMTP helo=<[****]>
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. Since the container is not using Postfix to receive mail, we should set mydestination
to localhost
only.
So line 32 in run.py
should be changed from,
add_config_value "mydestination" '$myhostname'
to
add_config_value "mydestination" 'localhost'
Thanks!
Added two PRs, one on master and one on the migrate_to_alpine
branch. Thanks again!
Hi @dtcooper , thanks for reporting and for the PR, I will test it this weekend, sorry for the delay.
Any update? Would love to use this as a container without forking in my project. 😄
Friendly ping. 👯♀️
@dtcooper Merged, thanks.