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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-19-2008, 04:11 PM
|
#1
|
LQ Newbie
Registered: Dec 2008
Posts: 13
Rep:
|
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.
|
|
|
12-20-2008, 11:36 PM
|
#2
|
Member
Registered: Feb 2005
Distribution: RHEL, CentOS
Posts: 113
Rep:
|
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
|
|
|
12-22-2008, 12:20 PM
|
#3
|
LQ Newbie
Registered: Dec 2008
Posts: 13
Original Poster
Rep:
|
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
|
|
|
12-22-2008, 12:22 PM
|
#4
|
LQ Newbie
Registered: Dec 2008
Posts: 13
Original Poster
Rep:
|
Removed this post
Last edited by xoise; 12-22-2008 at 12:23 PM.
Reason: Double posted on accident
|
|
|
12-22-2008, 03:03 PM
|
#5
|
Member
Registered: Feb 2005
Distribution: RHEL, CentOS
Posts: 113
Rep:
|
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.
|
|
|
12-29-2008, 02:54 PM
|
#6
|
LQ Newbie
Registered: Dec 2008
Posts: 13
Original Poster
Rep:
|
Quote:
Originally Posted by mackdav
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?
|
|
|
All times are GMT -5. The time now is 03:42 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|