Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Outgoing mail from linux not being delivered

SOLUTION
As someone marked this a a duplicate I cannot post the actual answer that worked for me and that can be found here: http://serverfault.com/a/128218/42894 (and not in the duplicate link).

Our website email system based on the CakePHP (1.3) email component has been working perfectly fine for a year and suddently it's not sending emails since yesterday to certain domains anymore, and sometimes even randomly.
I use the mail() php function to send emails via the website (account modifications, project updates, ...), and we retrieve our emails via gmail (we are using google apps). When I try to send an email to a user in our own domain, I get the followin error in /var/log/mail.log:

Mar 9 10:12:29 newserverxxxx sm-mta[27999]: q29ACTlt027999: < user@ourdomain.com >... User unknown

We also have issues with dsn=4.0.0, stat=Deferred on certain users from other domains receiving randomly their emails or not.

We are running a Debian (lenny) + sendmail, with everything up to date.

EDIT: here's the dig mx ourdomain.com output:

newserverxxxx:/# dig mx ourdomain.com

; <<>> DiG 9.6-ESV-R4 <<>> mx ourdomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45980
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 3, ADDITIONAL: 10

;; QUESTION SECTION:
;ourdomain.com. IN MX

;; ANSWER SECTION:
ourdomain.com. 86400 IN MX 30 aspmx5.googlemail.com.
ourdomain.com. 86400 IN MX 1 aspmx.l.google.com.
ourdomain.com. 86400 IN MX 5 alt1.aspmx.l.google.com.
ourdomain.com. 86400 IN MX 5 alt2.aspmx.l.google.com.
ourdomain.com. 86400 IN MX 10 aspmx2.googlemail.com.
ourdomain.com. 86400 IN MX 10 aspmx3.googlemail.com.
ourdomain.com. 86400 IN MX 30 aspmx4.googlemail.com.

;; AUTHORITY SECTION:
ourdomain.com. 80089 IN NS ns2.phase8.net.
ourdomain.com. 80089 IN NS ns0.phase8.net.
ourdomain.com. 80089 IN NS ns1.phase8.net.

;; ADDITIONAL SECTION:
aspmx.l.google.com. 99 IN A 173.194.67.26
alt1.aspmx.l.google.com. 97 IN A 173.194.70.26
alt2.aspmx.l.google.com. 99 IN A 173.194.69.26
aspmx2.googlemail.com. 399 IN A 74.125.43.27
aspmx3.googlemail.com. 399 IN A 74.125.127.27
aspmx4.googlemail.com. 536 IN A 209.85.229.27
aspmx5.googlemail.com. 536 IN A 74.125.157.27
ns0.phase8.net. 658 IN A 85.233.160.69
ns1.phase8.net. 658 IN A 85.233.160.68
ns2.phase8.net. 658 IN A 85.233.164.62

;; Query time: 7 msec
;; SERVER: 217.112.87.147#53(217.112.87.147)
;; WHEN: Fri Mar 9 11:37:08 2012
;; MSG SIZE rcvd: 438

share|improve this question

marked as duplicate by Chris S Mar 9 '12 at 13:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What does dig mx ourdomain.com say? Is it pointing to correct server? Is this server local? Can you send emails to this address from external source? –  Dmitry Alexeyev Mar 9 '12 at 10:54
    
dig output above. Yes I can; everything's working fine for sending/receiving emails on ouromain.com. It's just up to the emails sent from the website. –  Nicolas Mar 9 '12 at 11:42
    
is php configured to send mail using an smtp relay, or calls /usr/sbin/sendmail -t -i directly? You can test that unknown user message my trying to replicate the session using telnet –  Tom H Mar 9 '12 at 11:51
    
No smtp relay used (if would've been simple but google has a very restricted emails quota per hour/day). –  Nicolas Mar 9 '12 at 14:27
add comment

2 Answers 2

Your mail server configured to receive mail for ourdomain.com locally, that's why it rejects emails for users who are on the server you forwarding emails to. Check /etc/mail/local-host-names file and remove ourdomain.com if it's here.

share|improve this answer
    
Unfortunately it is not here. –  Nicolas Mar 9 '12 at 14:36
add comment

This is a question that frequently appears in SF. This happens because your machine thinks it should deliver mail locally instead of delivering it to Gmail. For a solution to this see for example this answer in a previous similar question at SF.

share|improve this answer
    
As Jason said in his comment, I do not have any of the sections you're talking about; are you sure your code is applicable as it is in sendmail.mc? –  Nicolas Mar 9 '12 at 14:29
    
Yes I am sure. If you are afraid, backup sendmail.mc and just add them to the bottom of the file. Then see if something breaks. If it does (it won't) copy back the previous sendmail.mc! –  adamo Mar 9 '12 at 18:24
    
I tried and this is not working, here are several messages from my mail.log: SYSERR(root): buildaddr: no user || mailer=relay, pri=34062, relay=[127.0.0.1] [127.0.0.1], dsn=5.3.5, stat=Service unavailable || DSN: Service unavailable. I don't know if any of this would help... –  Nicolas Mar 12 '12 at 9:39
    
It means that you have not properly and entirely copied the rule to your file. As the "bat book" says If a triple is missing the address part (the $:), the following error is produced: 554 5.3.5 buildaddr: no user (page 697). –  adamo Mar 12 '12 at 11:42
add comment

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