google app email
In my server /etc/postfix/main.cf, I added relayhost = smtp-relay.gmail.com:25 and ran systemctl start postfix.service.
Back in admin.google.com/ Apps>Google Apps>Settings for Gmail > Advanced settings, I added both my IP4 and IP6 server addresses to the SMTP relay service setting.
It worked fine when I sent test emails through Concrete5, but not for email notifications when a form was filled and submitted. The log said that the email failed due to my IP not being registered with my Google apps account.
I tried many things. It turns out that the problem was the sender. The working test emails were sent with a concrete5-noreply sender, while the failing form notifications were sent with the web site admin email. I changed the web site admin email to match the Google app registration address, and it has worked.
It is not ideal to have my site admin email be the same as the google app registration, particularly as I add more domains. However, it gives me time to figure out how to edit my server configuration to work with my personal email. And, over the next year I can also learn more about setting up a free email server with decent spam filtering.
Any suggestions about editing my configuration are welcome.
The lesson I want to pass on is that if you use Google apps for email, it seems that you need to have your web site admin email address match the account registered with Google, at least if you want your web site to send any email notifications.
5 Replies
inet_interfaces
If you have reasons for relaying through Gmail, It's possible that's just the way it works, using your source IP address and forcing the From e-mail address to match the one you have registered. Have you set your smtpsaslpassword_maps
The only steps I took to set up sending email from my web server are outlined above.
Thank you kindly Vance for providing a couple of suggestions that will save hours of searching and possibly a year of subscription fees. Sending out limited emails and not receiving any on a web server seems much simpler than configuring an incoming email server. I have to travel later this month and google is working. If I get chance to try Postfix alone, I will let you all know.
Now I have the choice of continuing to use google or doing this on my own. There are advantages and disadvantages either way.
I did not try setting smtpsaslpassword_maps. I'm not sure about sending a password for an sender account that is not registered with the apps. It might work to register the web site administrator and sender with the app account at google. Either that or I can have one administrator email for sender and admin for all of my sites and route emails to separate folders. That is all organizational preference. At least it is now working.
receive e-mail
The way relayhost and smtpsaslpassword_maps works is identical to sending mail using a client like Thunderbird, Evolution, or Mutt. So if a particular Google configuration supports using your own mail client, it should also work with Postfix. (Subject to any of the same restrictions, e.g., From address.)
ssmtpnullmailer
Just be aware of google app sending limits
Using your own email server is (obviously) possible, but getting harder and harder as big providers put more controls into place to cut down spammers. You'll probably find you need to do more and more maintenance work over time. Thus, it might also be worth your time and money to check out some of the transactional email services like mailgun.com, sendgrid.com, and mandrill.com.