To find out more about the disposition of a message, try this:
mailq
You'll see lots of lines like this:
n812uLGQ001861 12089700 Mon Aug 31 19:56 <******@*****.org>
(Deferred: Connection timed out with c.mx.mail.yahoo.com.)
<******@yahoo.com>
n82FR6a3019167 22388400 Wed Sep 2 08:27 <******@*****.net>
(reply: read error from g.mx.mail.yahoo.com.)
<******@yahoo.com>
where n82FR6a3019167 is the message ID
ls -al /var/spool/mqueue/*<message ID>
Try looking at those files (they're just text files), particularly the one named qn82FR6a3019167 (or whatever your message ID number is. Note: the 'q' before the message ID. You should be able to determine the status of the message, which will hopefully help determine what isn't working properly.
cat /var/spool/mqueue/qn82FR6a3019167
If that doesn't help, you may need to look at the smart relay setting in sendmail.cf. Your PHP server might need to relay mail out through a Smart Relay host.
Next, I would try a manual SMTP session from your PHP server to the Google mail server.
telnet alt4.gmail-smtp-in.l.google.com 25
Trying 209.85.129.114...
Connected to alt4.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP p9si790839fkb.7
helo <yourhostname>
250 mx.google.com at your service
mail from:<youremail@youraddress.com>
250 2.1.0 OK p9si740839fkb.7
rcpt to:<whoever@gmail.com>
250 2.1.5 OK p9si740839fkb.7
data
354 Go ahead h2si759562fkh.29
Subject: This is a test
Testing!
.
250 2.0.0 OK 1251933071 h2si759562fkh.29
quit
221 2.0.0 closing connection h2si759562fkh.29
Connection closed by foreign host.
This will hopefully tell you if your IP address is being blocked, or if some SPF (Sender Policy Framework) problem exists, or if you have DNS name mismatches that may be causing your email to be denied or deferred.
I presume you truncated the listing of the details in your reply. Your system really should have a valid hostname with reverse DNS entries for that hostname.
Also, check your /etc/hosts file to ensure that your IP address is listed correctly there. It's pretty common to have hostname mismatches be a problem when relaying email to the internet (at least, in my experience).
Something like:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
xxx.xxx.xxx.xxx yourhostname.yourdomain.com yourhostname
Typically email delays are DNS problems.
Try running:
host -t mx problemdomain.com
If that doesn't seem to be the problem, use sendmail -bi -v
to get more debugging output.
Best Answer
Although I have very little experience with CentOS, I do seem to recall seeing some flavor of linux that didn't have sendmail configured with a queue runner by default. I would be curious to see if your old messages are removed after running 'sendmail -q'. If that's the case, then I think you just need to configure your queue runner to run periodically.