I've set up sendmail to just send out mails from our php web application. That works fine, as long as we are not sending mail to the same domain as our web app.


our app = www.ourapp.com sending mails works perfectely, except for anything@ourapp.com"

I don't know if it's relevant, but our target email is hosted with google apps. Sendmail queue is empty and the log files always say the message has been sent

we are running CentOS as our OS


It is doable in sendmail, but it is faster to use something like ssmtp. An example that closely relates to your case is here.

sendmail as is configured is not delivering email to your Google Apps hosted email accounts because it thinks that it should handle email for your domain locally. The fact that it says that messages have been sent means that they are delivered locally on the machine. Check you /var/mail contents.

| improve this answer | |
  • is it allowed to use a gmail smtp like this for a commercial web app? Are there any known limitation to this? – solsol Nov 8 '10 at 14:21
  • and do you have a solution for sendmail? We will need to have sendmail, because we are also sending mails on behalf of clients on other domain names and we want to keep those addresses related to their own domain – solsol Nov 8 '10 at 14:28
  • I have not done this, as I do not relay through smtp.google.com, but you may try phinesolutions.com/sendmail-gmail-smtp-relay-howto.html – adamo Nov 8 '10 at 17:11
  • The ssmtp method through google apps has some limitations as google apps will rewrite some of your headers, such as the FROM field. For a contact-us webform, this may end up changing the sender information. – sybreon Nov 9 '10 at 7:44

Is the domain in /etc/mail/local-host-names ? if so, sendmail will assume that it is the final destination for that domain and attempt local delivery.

Take the domain out of local-host-names , rebuild your sendmail config, and reload sendmail, should be fine. If you don't want any mail delivered locally, ie if you want everything going to your google apps account, then you will likely want /etc/mail/local-host-names to be empty (not even localhost) and then make sure to create proper role aliases pointing to fully qualified addresses at your domain.

Also do please make sure your MX records are pointing to google (unlikely to be the problem , but worth double checking that as well)

| improve this answer | |

this problem has solved itself after 1-2 days. It probably just was a DNS update issue, where we got the updated data already, but perhaps the mailservers we have been tested still had old DNS cache.

thanks all for the help on this one

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.