My web app server sends emails. I also use Google Apps to host my emails. I can't send messages to my own users?
문제
Please excuse the horrible title. I've been banging my head against this issue all afternoon, only to realize that I was on a wild goose chase.
In short:
- Set up Google Apps to handle incoming emails for my domain (
foobar.org
) - Set up exim4 on my Linode to send outgoing emails for my web app
- Tested by sending emails to my private email (
julian@otherdomain.net
), and to work email (julian@foobar.org
).
After 3 hours, I still could not figure out why emails were being received at otherdomain.net
, but not at foobar.org
.
So I gave up. Ctrl+D out of the super-user account, and saw: You have new mail in /var/mail/julian
facepalm
So, any outgoing emails sent to foobar.org
get delivered to the local user account. Makes sense. How do I tell exim4
to send the email out to the interwebs, so when it comes back to my DNS, it'll be routed to Google's servers?
해결책 2
In the end, I had an incorrect hosts file entry added when setting up my server.
I had the following entry:
public-ip domain.tld machinename
Although the following was more appropriate
public-ip machinename.domain.tld machinename
From then on, all emails sent to domain.tld
ended up being sent out of the server.
다른 팁
Your local mail service needs to be set up to use the MX record for your domain. Using things like Plesk or Cpanel it's a case of shutting down the email service and ensuring the local DNS records included an A record for the external mail exchanger (Google) and a suitable MX record pointing to it.
This worked for me.