Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Servers > Apache + PHP + Sendmail?

Forgot Password?
 Servers   Anything server related, Apache, MySQL, Samba, server security, sendmail, exim, etc

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 10-24-2007   #1 (permalink)
Extraordinary Gentleman
 
Redman's Avatar
 
Join Date: Oct 2004
Location: The green fields of Brabant, Netherlands
Posts: 605
Apache + PHP + Sendmail?

I am transfering a php built website from a webhoster to our own webserver.

Apache and PHP aren't a real problem, except for the mail() command in PHP.
The server is not required to act as a mailserver for the domains hosted on it. Only some PHP forms need to send their info externally using the mail() command.

This I don't seem to be able to achieve
And since the originating server is a Windows machine, there is nothing to peek at.

Anybody care to help me on my way with this? The PHP forms do not generate any kind of error.

Relevant section of php.ini:
Quote:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = anything@foobar.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i
Relevant piece of sendmail.mc:
Quote:
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
__________________
"Yoda of Borg are we: Futile resistance is. Assimilate you, we will."
Distributions in use: CentOS 5.3
Registered Linux user #327830
100% on Linux since september 7, 2003 - now I am free!
Redman is offline  


Reply With Quote
Old 10-25-2007   #2 (permalink)
Extraordinary Gentleman
 
Redman's Avatar
 
Join Date: Oct 2004
Location: The green fields of Brabant, Netherlands
Posts: 605
I have looked at the mail logfile and found out messages are going out:

Quote:
Oct 25 08:26:43 antarctica sendmail[3534]: l9P6Qhpl003534: from=root, size=49, class=0, nrcpts=1, msgid=<200710250626.l9P6Qhpl003534@localhost.local domain>, relay=root@localhost

Oct 25 08:26:43 antarctica sendmail[3535]: l9P6QhQD003535: from=<root@localhost.localdomain>, size=354, class=0, nrcpts=1, msgid=<200710250626.l9P6Qhpl003534@localhost.local domain>, proto=ESMTP, daemon=MTA, relay=antarctica [127.0.0.1]

Oct 25 08:26:43 antarctica sendmail[3534]: l9P6Qhpl003534: to=working-address@provider.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30049, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l9P6QhQD003535 Message accepted for delivery)

Oct 25 08:27:04 antarctica sendmail[3537]: l9P6QhQD003535: to=<working-address@provider.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:21, xdelay=00:00:21, mailer=esmtp, pri=120354, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.

Oct 25 08:37:52 antarctica sendmail[3730]: l9P6bqrx003730: Authentication-Warning: localhost.localdomain: apache set sender to working-address@other-provider.com using -f

Oct 25 08:37:52 antarctica sendmail[3730]: l9P6bqrx003730: from=working-address@other-provider.com, size=194, class=0, nrcpts=1, msgid=<200710250637.l9P6bqrx003730@localhost.local domain>, relay=apache@localhost

Oct 25 08:37:52 antarctica sendmail[3731]: l9P6bqAq003731: from=<working-address@other-provider.com>, size=533, class=0, nrcpts=1, msgid=<200710250637.l9P6bqrx003730@localhost.local domain>, proto=ESMTP, daemon=MTA, relay=antarctica [127.0.0.1]

Oct 25 08:37:52 antarctica sendmail[3730]: l9P6bqrx003730: to=working-address@provider.com, ctladdr=working-address@other-provider.com (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30194, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l9P6bqAq003731 Message accepted for delivery)

Oct 25 08:38:14 antarctica sendmail[3733]: l9P6bqAq003731: to=<working-address@provider.com>, delay=00:00:22, xdelay=00:00:22, mailer=esmtp, pri=120533, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.
Based on this, I assume php/apache is configured properly (since the mails go out), but do I need to tweak sendmail ?!?

Any advice welcome of course!
__________________
"Yoda of Borg are we: Futile resistance is. Assimilate you, we will."
Distributions in use: CentOS 5.3
Registered Linux user #327830
100% on Linux since september 7, 2003 - now I am free!
Redman is offline   Reply With Quote
Old 10-25-2007   #3 (permalink)
Linux Engineer
 
Lakshmipathi's Avatar
 
Join Date: Sep 2006
Location: 3rd rock from sun
Posts: 1,079
Are you able to send a mail using
mail command ,try this and post ur output.

#mail -iInv -s "subject" lakshmipathi.g@gmail.com
Hi this is test mail.
ctrl + D


what's the output now?
what the mail log says?
__________________
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
Lakshmipathi is offline   Reply With Quote
Old 10-25-2007   #4 (permalink)
Extraordinary Gentleman
 
Redman's Avatar
 
Join Date: Oct 2004
Location: The green fields of Brabant, Netherlands
Posts: 605
After I hit [CTRL][D] I got the following:

Quote:
EOT
lakshmipathi.g@gmail.com... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Thu, 25 Oct 2007 15:10:37 +0200
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello antarctica [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<polarbear@localhost.localdomain> SIZE=138
250 2.1.0 <polarbear@localhost.localdomain>... Sender ok
>>> RCPT To:<lakshmipathi.g@gmail.com>
>>> DATA
250 2.1.5 <lakshmipathi.g@gmail.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 l9PDAbwH004487 Message accepted for delivery
lakshmipathi.g@gmail.com... Sent (l9PDAbwH004487 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
Here is the info from the logfile:

Quote:
Oct 25 15:10:37 antarctica sendmail[4486]: l9PDAa0l004486: from=polarbear, size=138, class=0, nrcpts=1, msgid=<200710251310.l9PDAa0l004486@localhost.local domain>, relay=polarbear@localhost

Oct 25 15:10:37 antarctica sendmail[4487]: l9PDAbwH004487: from=<polarbear@localhost.localdomain>, size=452, class=0, nrcpts=1, msgid=<200710251310.l9PDAa0l004486@localhost.local domain>, proto=ESMTP, daemon=MTA, relay=antarctica [127.0.0.1]

Oct 25 15:10:37 antarctica sendmail[4486]: l9PDAa0l004486: to=lakshmipathi.g@gmail.com, ctladdr=polarbear (500/500), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30138, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l9PDAbwH004487 Message accepted for delivery)

Oct 25 15:10:59 antarctica sendmail[4489]: l9PDAbwH004487: to=<lakshmipathi.g@gmail.com>, ctladdr=<polarbear@localhost.localdomain> (500/500), delay=00:00:22, xdelay=00:00:22, mailer=esmtp, pri=120452, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.
Seems the same result
__________________
"Yoda of Borg are we: Futile resistance is. Assimilate you, we will."
Distributions in use: CentOS 5.3
Registered Linux user #327830
100% on Linux since september 7, 2003 - now I am free!

Last edited by Redman; 10-25-2007 at 03:07 PM.. Reason: mail log info added
Redman is offline   Reply With Quote
Old 10-25-2007   #5 (permalink)
Extraordinary Gentleman
 
Redman's Avatar
 
Join Date: Oct 2004
Location: The green fields of Brabant, Netherlands
Posts: 605
I tried the same on a mailbox at work and there I did get mail

Quote:
Van: SysAdmin [polarbear@localhost.localdomain]
Verzonden: donderdag 25 oktober 2007 15:43
Aan: Redman (company)
Onderwerp: webserver

**TEST**
__________________
"Yoda of Borg are we: Futile resistance is. Assimilate you, we will."
Distributions in use: CentOS 5.3
Registered Linux user #327830
100% on Linux since september 7, 2003 - now I am free!
Redman is offline   Reply With Quote
Old 10-25-2007   #6 (permalink)
Linux Engineer
 
Lakshmipathi's Avatar
 
Join Date: Sep 2006
Location: 3rd rock from sun
Posts: 1,079
Code:
Oct 25 15:10:59 antarctica sendmail[4489]: l9PDAbwH004487: to=<lakshmipathi.g@gmail.com>, ctladdr=<polarbear@localhost.localdomain> (500/500), delay=00:00:22, xdelay=00:00:22, mailer=esmtp, pri=120452, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.
If I'm right,i think your mail reaches google but google not accepts your mail because ,
google doesn't recognice the from domain. ie. from address.

you can send mail from work station because your workstation as valid Exchange server i guess.
try commands , like
dig yourhostname
from home and office

it'll provide atleast 1 answer
__________________
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
Lakshmipathi is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 11:31 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2