Operating System - Linux
1752781 Members
6588 Online
108789 Solutions
New Discussion юеВ

Re: Sendmail Problem :-( please help!

 
juniorher
New Member

Sendmail Problem :-( please help!

Hey my friends,
I've got a sendmail problem on a dedicated server, shall I post the configs or what do you suggest?

Problem is, that all coming in via smtp is sent through fine, but messages I try to send via PHP mail() are not going through, error in root is "deferred: connection refused by [127.0.0.1]"

I guess I just have a block of wood in front of my head, can somebody help to remove it PLEASE!



update:

[CODE]file "access"

localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
myPOPIP RELAY (changed when accessing via POP you know - POP is working as well as SMTP like said...)
[/CODE]

telnet works too on Port 25:

[CODE]telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 rummels.de ESMTP Sendmail 8.13.4/8.13.4/Debian-3sarge1; Fri, 22 Dec 2006 21:53:12 +0100; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
[/CODE]

and status of sendmail seems to be fine too:

[CODE]# /etc/init.d/sendmail status
MSP: is run via cron (20m)
MTA: 8640 /usr/sbin/sendmail-mta -Am -L sm-mta -bd -q10m
UID PID PPID C STIME TTY TIME CMD
root 8640 1 0 22:32 ? 00:00:00 sendmail: MTA: accepting connections
QUE: Same as MTA
[/CODE]

one thing I found (I just used several test commands and this is one result - there is no 127.0.0.1 there, :

[CODE]# netstat -an|grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
....tcp 0 0 serverip:25 220.174.224.223:2246 VERBUNDEN

etc.

[/CODE]

like said, SMTP & POP are wonderful working, just this PHP mail() isn't, always the same error :(

update2:

I did some more tests now as suggested by other people, maybe this helps:

[code]# sendmail -v -d8 -d38(E-Mail address blocked: See forum rules)
dsfsdfs
.
(E-Mail address blocked: See forum rules)... Connecting to [127.0.0.1] port 587 via relay...
(E-Mail address blocked: See forum rules)... Deferred: Connection refused by [127.0.0.1]
[/code]

so there is the error again, on the other side:

[code]# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 "myserver" ESMTP Sendmail 8.13.4/8.13.4/Debian-3sarge1; Sat, 23 Dec 2006 23:24:50 +0100; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
helo test
250 "myserver" Hello localhost [127.0.0.1], pleased to meet you
mail from:(E-Mail address blocked: See forum rules)
250 2.1.0(E-Mail address blocked: See forum rules)... Sender ok
rcpt to:(E-Mail address blocked: See forum rules)
250 2.1.5(E-Mail address blocked: See forum rules)... Recipient ok
data
354 Enter mail, end with "." on a line by itself
test message
.
250 2.0.0 kBNMOoZu004585 Message accepted for delivery
quit
221 2.0.0 myserver closing connection
Connection closed by foreign host.
[/code]

this last one reached the email address fine, so via telnet it's working, via smtp it's working, just via sendmail directly & php not, this is very strange to me :(

maybe this helps you locating the problem :( thanks my friends!

4 REPLIES 4
Stuart Browne
Honored Contributor

Re: Sendmail Problem :-( please help!

Tell-tail line:

Connecting to [127.0.0.1] port 587 via relay...

You've got your sendmail submission set up to connecto localhost port 587. Is your sendmail listening to port 587 as well as port 25?
One long-haired git at your service...
Steven E. Protter
Exalted Contributor

Re: Sendmail Problem :-( please help!

Shalom,

netstat -an | grep ":587"

You will see no listen line.

netstat -an | grep ":25"

You will see a listen line.

Sendmail is not listening on port 587.

Its not a terribly good idea to configure it to listen on that port either.

When you say php mail, are you talking about a php based web client like squirrelmail? If so check the configuration file there.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
George Liu_4
Trusted Contributor

Re: Sendmail Problem :-( please help!

What's you rphpmail thing function? It does use smtp or other protocol, like pop, imap?
juniorher
New Member

Re: Sendmail Problem :-( please help!

Thanks for the help, I fixed it so far now, but the next problem occured :(

when I send out mail via php to my gmail account, it always goes into spam, because of some header problems I think, I included SPF also, which is recognized, but doesn't change the situation to the better (exactly same email delivered via smtp from the same server works out to "land" in the inbox, it's freakin....):


[CODE]
Delivered-To: my-address-at@gmail.com
Received: by 10.82.153.10 with SMTP id a10cs185450bue;
Sat, 6 Jan 2007 18:05:47 -0800 (PST)
Received: by 10.67.29.12 with SMTP id g12mr14006613ugj.1168135547091;
Sat, 06 Jan 2007 18:05:47 -0800 (PST)
Return-Path:
Received: from mydomain.com (mydomain.com [MY-SERVERs-IP-HERE])
by mx.google.com with ESMTP id u6si37493585uge.2007.01.06.18.05.46;
Sat, 06 Jan 2007 18:05:47 -0800 (PST)
Received-SPF: pass (google.com: domain of sender@mydomain.com designates MY-SERVERs-IP-HERE as permitted sender)
Received: from mydomain.com (localhost [127.0.0.1])
by mydomain.com (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id l07261DL004032
for ; Sun, 7 Jan 2007 03:06:02 +0100
Received: (from root@localhost)
by mydomain.com (8.13.4/8.13.4/Submit) id l072613x004030;
Sun, 7 Jan 2007 03:06:01 +0100
Date: Sun, 7 Jan 2007 03:06:01 +0100
Message-Id: <200701070206.l072613x004030@mydomain.com>
To: my-address-at@gmail.com
Subject: I got news for you
Reply-To: sender@mydomain.com
From: David
[/CODE]

the email via smtp (the one landing in the inbox at gmail has the following headers instead:

[CODE]
Delivered-To: my-address-at@gmail.com
Received: by 10.82.153.10 with SMTP id a10cs180353bue;
Sat, 6 Jan 2007 15:02:32 -0800 (PST)
Received: by 10.67.121.15 with SMTP id y15mr31671422ugm.1168124551891;
Sat, 06 Jan 2007 15:02:31 -0800 (PST)
Return-Path:
Received: from mydomain.com (mydomain.com [MY-SERVERs-IP-HERE])
by mx.google.com with ESMTP id 54si37319882ugp.2007.01.06.15.02.31;
Sat, 06 Jan 2007 15:02:31 -0800 (PST)
Received-SPF: pass (google.com: domain of sender@mydomain.com designates MY-SERVERs-IP-HERE as permitted sender)
Received: from mylaptop ([MY-ADSL-IP-HERE])
by mydomain.com (8.13.4/8.13.4/Debian-3sarge1) with SMTP id l06N2iSv029170
for ; Sun, 7 Jan 2007 00:02:46 +0100
Message-ID: <000301c731e6$be0b28f0$0973a8c0@mylaptop>
From: "my name"
To:
[/CODE]

like said, the subject + content of the mails is the same, just the headers coming from root@localhost (for the script?) seems the problem maybe, or what do you experienced users think? How can I change this problem to the better? A change in the php.ini or sendmail config? The way it is "working" at present is, that confirmation emails for comments etc. are going into spam of the commenting party and that's not good :(

Thanks again and in advance as well for your appreciated help!