I am setting up a VPS with Ubuntu 20.04 to host a phpBB board, say "myvps.myserviceprovider.com", to which "mydomain.net" is assigned. I also have defined the MX record for my domain to permit Google Workspace to host the email account [email protected]. Notifications and other emails will come from the board using [email protected]. I've installed postfix on my VPS to facilitate this.
Here's an example of a command line email using postfix's sendmail:
mylogin@myvps: sendmail [email protected]
FROM: [email protected]
SUBJECT: Hello from your server!
Yup.
It's me.
.
Workspace rejects the mail; here's a snippet from /var/log/mail.log:
Jul 3 23:15:21 myvps postfix/pickup[5514]: B616461557: uid=1000 from=<mylogin>
Jul 3 23:15:21 myvps postfix/cleanup[5519]: B616461557: message-id=<[email protected]>
Jul 3 23:15:21 myvps postfix/qmgr[5516]: B616461557: from=<[email protected]>, size=348, nrcpt=1 (queue active)
Jul 3 23:15:21 myvps postfix/smtp[5521]: connect to smtp.gmail.com[2607:f8b0:400d:c0d::6c]:587: Network is unreachable
Jul 3 23:15:22 myvps postfix/smtp[5521]: B616461557: to=<[email protected]>, relay=smtp.gmail.com[172.217.222.109]:587, delay=0.99, delays=0.29/0.07/0.63/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[172.217.222.109] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8 https://support.google.com/mail/?p=BadCredentials i19sm3571712qkl.19 - gsmtp)
The FROM: I used is ignored - my ssl login, "mylogin", is used instead. No credentials are defined with sasl for this account, nor is the account defined in Workspace.
I followed the instructions here for rewriting FROM addresses when only sending from a server (not receiving - the second answer in the post). This is the single entry in my generic file (because mail can come from the default apache account as well):
@myvps.myserviceprovider.com [email protected]
I followed this with
sudo postmap /etc/postfix/generic
sudo /etc/init.d/postfix reload
I got the same result. I tried several variants for the source in the generic file; wash, rinse, repeat:
[email protected] [email protected]
@myvps.myserviceprovider.com [email protected]
[email protected] [email protected]
@localhost.localdomain [email protected]
[email protected] [email protected]
...and several others; I'm forgetting now what I've tried. But in an attempt to diagnose, I added a "-v" flag to the end of the line for the cleanup daemon in master.cf, per the instructions here. Here's what's reported in /var/log/mail.log:
Jul 3 23:18:36 myvps postfix/qmgr[5547]: 6043661559: from=<[email protected]>, size=348, nrcpt=1 (queue active)
Jul 3 23:18:36 myvps postfix/cleanup[5556]: warning: unix_trigger: write to public/qmgr: Broken pipe
Jul 3 23:18:36 myvps postfix/cleanup[5556]: cleanup_flush: status 0
Jul 3 23:18:36 myvps postfix/cleanup[5556]: send attr status = 0
Jul 3 23:18:36 myvps postfix/cleanup[5556]: send attr reason =
Jul 3 23:18:36 myvps postfix/cleanup[5556]: master_notify: status 1
Jul 3 23:18:36 myvps postfix/cleanup[5556]: connection closed
Jul 3 23:18:36 myvps postfix/smtp[5550]: connect to smtp.gmail.com[2607:f8b0:400d:c0d::6c]:587: Network is unreachable
Jul 3 23:18:36 myvps postfix/smtp[5550]: 6043661559: to=<[email protected]>, relay=smtp.gmail.com[173.194.175.109]:587, delay=0.23, delays=0.02/0/0.21/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[173.194.175.109] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8 https://support.google.com/mail/?p=BadCredentials s8sm3655090qke.72 - gsmtp)
Jul 3 23:18:41 myvps postfix/cleanup[5556]: rewrite stream disconnect
Before I added the "-v" flag, I saw a report from cleanup in the log file, preceding the qmgr handoff, even though it did not replace "mylogin" with "dan" as I had hoped. After adding the flag, the report from qmgr comes first, followed by several cleanup log lines, one of which is a failure to communicate with the qmgr daemon ("busted pipe"). It suggests that the addition of the "-v" flag permuted the behavior of the daemon interactions, rather than simply reporting on them in more detail.
So I am truly at a loss. Not sure how to diagnose what cleanup is actually doing.