LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-19-2008, 04:11 PM   #1
xoise
LQ Newbie
 
Registered: Dec 2008
Posts: 13

Rep: Reputation: 0
Sendmail not working on Centos 4.5


I'm running PHP5 on Apache 2. I've tried testing the mail() function in PHP and it just times out. After some investigation, I learned that something is wrong with sendmail, be it configuration or an iptables issue.

I checked the configuration and nothing seems to be wrong (although my knowledge on this is very limited). sendmail was installed on the server when I took over from GoGrid though anyway and Apache/PHP were both installed via yum.

Thinking it may be an iptables issue, I added the following lines to /etc/sysconfig/iptables:
Code:
[0:0] -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
[0:0] -A OUTPUT -p tcp -m tcp --dport 25 -j ACCEPT
No luck there after restarting iptables (service iptables restart).

I've done a lot of googling and looked at a bunch of things, and I'm just clueless now.

After some test emails to my addresses, here's the data in /var/log/maillog:
Code:
Dec 19 16:16:23 18442_3991_25093 sendmail[11689]: mBJLGNT6011689: from=apache, size=247, class=0, nrcpts=1, msgid=<200812192116.mBJLGNT6011689@18442_3991_25093.dev.gogrid.com>, relay=apache@localhost
Dec 19 16:22:41 18442_3991_25093 sendmail[11689]: mBJLGNT6011689: to=dan@xoise.com, ctladdr=apache (48/48), delay=00:06:18, xdelay=00:06:18, mailer=relay, pri=30247, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection timed out with [127.0.0.1]
Dec 19 16:50:26 18442_3991_25093 sendmail[12261]: mBJLoQMS012261: from=apache, size=48, class=0, nrcpts=1, msgid=<200812192150.mBJLoQMS012261@18442_3991_25093.dev.gogrid.com>, relay=apache@localhost
Dec 19 16:55:30 18442_3991_25093 sendmail[12281]: mBJLtUGL012281: from=apache, size=48, class=0, nrcpts=1, msgid=<200812192155.mBJLtUGL012281@18442_3991_25093.dev.gogrid.com>, relay=apache@localhost
Dec 19 16:56:44 18442_3991_25093 sendmail[12261]: mBJLoQMS012261: to=baseballdude@gmail.com, ctladdr=apache (48/48), delay=00:06:18, xdelay=00:06:18, mailer=relay, pri=30048, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection timed out with [127.0.0.1]
Dec 19 17:01:48 18442_3991_25093 sendmail[12281]: mBJLtUGL012281: to=baseballdude@gmail.com, ctladdr=apache (48/48), delay=00:06:18, xdelay=00:06:18, mailer=relay, pri=30048, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection timed out with [127.0.0.1]
And I tried a traceroute to google.com on port 25 (traceroute -p 25 google.com)
Code:
traceroute: Warning: google.com has multiple addresses; using 74.125.45.100
traceroute to google.com (74.125.45.100), 30 hops max, 38 byte packets
 1  145.113.121.216.reverse.gogrid.com (216.121.113.145)  0.848 ms  0.345 ms  0.307 ms
 2  border-core2.sfo2.servepath.com (208.96.31.65)  0.290 ms  0.292 ms  0.293 ms
 3  te-3-4.car2.SanFrancisco1.Level3.net (4.53.130.17)  0.482 ms  0.446 ms  0.392 ms
 4  ae-2-4.bar2.SanFrancisco1.Level3.net (4.69.133.158)  0.349 ms  0.363 ms  0.332 ms
 5  ae-6-6.ebr2.SanJose1.Level3.net (4.69.140.154)  1.348 ms  14.173 ms  1.430 ms
 6  ae-62-62.csw1.SanJose1.Level3.net (4.69.134.210)  8.562 ms  13.878 ms  1.615 ms
 7  ae-63-63.ebr3.SanJose1.Level3.net (4.69.134.225)  2.971 ms  13.415 ms  1.724 ms
 8  ae-2.ebr3.LosAngeles1.Level3.net (4.69.132.10)  18.473 ms  16.772 ms  17.931 ms
 9  ae-73-73.csw2.LosAngeles1.Level3.net (4.69.137.38)  9.834 ms  11.249 ms  17.802 ms
10  ae-72-72.ebr2.LosAngeles1.Level3.net (4.69.137.21)  10.105 ms  9.862 ms  16.684 ms
11  ae-3.ebr3.Dallas1.Level3.net (4.69.132.78)  50.365 ms  53.203 ms  53.631 ms
12  ae-7.ebr3.Atlanta2.Level3.net (4.69.134.22)  70.086 ms  67.381 ms  71.632 ms
13  ae-21-52.car1.Atlanta1.Level3.net (4.68.103.34)  61.805 ms ae-11-51.car1.Atlanta1.Level3.net (4.68.103.2)  62.203 ms  61.768 ms
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
Any help would be hugely appreciated as this is officially driving me nuts.
 
Old 12-20-2008, 11:36 PM   #2
mackdav
Member
 
Registered: Feb 2005
Distribution: RHEL, CentOS
Posts: 113

Rep: Reputation: 16
It is most likely a sendmail problem. The logs imply that the sendmail is trying to relay outbound mail through localhost (ie itself) and isn't able to connect.

Here's what I'd do off the top of my head.

First, check to see if the messages are stuck by using the mqueue command. If there are not any, then either php is bork or sendmail is bork. Test the latter by using the mail command directly from the command line like so:

Code:
$ mail -s "This is a test" myemail@destination
This is text that goes in my email
^D
Cc:
With this you should either get messages out or stuck in the queue; if not, it tells you that php is bork somehow. Can't help you with that.

If there are stuck messages in the queue, drop iptables completely and recycle sendmail. If messages get out, then it's an iptables problem, but like I said above it sounds like the sendmail is bork and it will either try to relay through itself and then loop and then bounce, or it will just immediately bounce it.

Sendmail diagnosis is a bit more complicated depending on what you are doing. If you are diddling sendmail.cf directly then you know more than I do.

If you are using sendmail.mc, I'd check your values of:

define(`SMART_HOST',
MASQUARADE_AS(

I'd comment out

EXPOSED_USER(

...and if you are trying to be cute, I'd check that the contents of /etc/mail/mailertable and /etc/mail/access were sane.

Finally, I'd telnet to whatever the MX for google.com is on port 25 and make sure that I wasn't getting intercepted or blocked by my ISP:

Code:
[saturn]$ dig +short mx google.com
10 smtp3.google.com.
10 smtp4.google.com.
10 smtp1.google.com.
10 smtp2.google.com.
[saturn]$ telnet smtp1.google.com. 25
Trying 209.85.237.25...
In my case, I'm getting blocked by my ISP as an anti-spam function; you'll have to get into relaying through a server which will permit you, which can be simple (ie SMART_HOST) or complicated (http://wiki.xdroop.com/space/sendmai...+a+smart+relay).

Last edited by mackdav; 12-20-2008 at 11:37 PM. Reason: I WRITE LIKE A MONKEY ON CRACK SOMETIMES
 
Old 12-22-2008, 12:20 PM   #3
xoise
LQ Newbie
 
Registered: Dec 2008
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks a ton for taking the time to help out. I'm still pretty lost here.

I ran a test email using the mail command.

Here's the log entry:
Code:
Dec 22 12:55:21 18442_3991_25093 sendmail[13860]: mBMHtLIl013860: from=root, size=81, class=0, nrcpts=2, msgid=<200812221755.mBMHtLIl013860@18442_3991_25093.dev.gogrid.com>, relay=root@localhost
Mail Queue was empty
Code:
/var/spool/mqueue is empty
                Total requests: 0
/etc/mail/mailertable is empty

Contents of /etc/mail/access:
Code:
localhost.localdomain           RELAY
localhost                       RELAY
127.0.0.1                       RELAY
telnet to smtp1.google.com didn't work...
Code:
# telnet smtp1.google.com 25
Trying 209.85.237.25...
telnet: connect to address 209.85.237.25: No route to host
telnet: Unable to connect to remote host: No route to host
 
Old 12-22-2008, 12:22 PM   #4
xoise
LQ Newbie
 
Registered: Dec 2008
Posts: 13

Original Poster
Rep: Reputation: 0
Removed this post

Last edited by xoise; 12-22-2008 at 12:23 PM. Reason: Double posted on accident
 
Old 12-22-2008, 03:03 PM   #5
mackdav
Member
 
Registered: Feb 2005
Distribution: RHEL, CentOS
Posts: 113

Rep: Reputation: 16
Try pinging smtp1.google.com since you need to have basic networking connectivity to the outside world for this to work. Check the setting of your default router.
 
Old 12-29-2008, 02:54 PM   #6
xoise
LQ Newbie
 
Registered: Dec 2008
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mackdav View Post
Try pinging smtp1.google.com since you need to have basic networking connectivity to the outside world for this to work. Check the setting of your default router.
ping smtp1.google.com works just fine.

Any more ideas on this?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail on CentOS Devileyezz Linux - Server 1 11-04-2007 01:08 PM
Centos 4.4 DNS and/or Sendmail/Postfix issue radiox Linux - Server 4 09-20-2007 05:04 PM
sendmail on CentOS 4.4 - where do I see the mail SENT to the server? Dan8080 Linux - Newbie 3 09-27-2006 11:30 PM
sendmail is not working & on $prompt the cmd sendmail hangs Pavan mahoorker Linux - Software 1 04-04-2006 03:57 PM
CentOS 4.2, Sendmail Problem adnonimape Linux - Software 2 03-24-2006 06:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration