httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lyle Wincentsen <lyle.wincent...@gmail.com>
Subject Re: [users@httpd] sending email
Date Mon, 15 Jun 2009 13:45:07 GMT
I have actually found a solution to the problem. The big question I had (but
couldn't put into the right words in my original email) was this: does the
user that apache runs as (in my case www-data on Debian) read various config
files that may be present in its home directory, as happens for regular
logged-in users when they, for example, run vi or try to send mail using
esmpt?

I didn't know (and still don't) if this is an OS question or an apache
question, but I was pretty sure it was not a php question per se. I had read
the man pages and done the test php script as suggested below.

FYI it turns out that the esmtp config file was not getting read from the
"home directory" of www-data on my system when apache was trying to do it -
although it did do so when I explicitly switched to that user by typing "su
www-data" and performing the same operation on the php CLI, which is
strange. I was able to get it working for apache by adding a -C directive to
the php.ini file explicitly giving it a path to the config file I want it to
load. The line in the php file now looks like this:

sendmail_path ="/usr/bin/esmtp -t -N failure,delay,success -C
/var/www/.esmtprc"

Anyway, I thought I'd post the solution I found in case it may be of help to
someone else. I'm still not sure why the config file was read when I was
logged in as www-user but not when apache is operating as that user.

Thanks to those who responded to my question.

-Lyle

  I don’t think this is an Apache problem, it’s either bad PHP or problem
> with your esmtp configuration by the sounds of it.
>
>
>
> Have you checked the MAN pages for your esmtp program or checked that your
> PHP replaces any invalid chars that could prevent emails being sent?
>
>
>
> Have you tried to create a simple test.php page where when you browse to
> it, it spits out an email to a test email address without you having to
> enter an email address etc in a previous form.
>
>
>
> Test.php would read:
>
> *<?php*
>
> *mail(“test@test.com”, “The Subject”, “Hello world”); *
>
> *?>*
>
>
>
> When all’s said and done though, Apache has nothing to do with sending
> emails, in a nutshell, it just serves webpages.
>
>
>
>
>  ------------------------------
>
> *From:* Lyle Wincentsen [mailto:lyle.wincentsen@gmail.com]
> *Sent:* 13 June 2009 14:46
> *To:* users@httpd.apache.org
> *Subject:* [users@httpd] sending email
>
>
>
> I'm trying to send an email when a user hits the submit button on a
> webpage, but the email never goes out. I'm using the php mail function as
> follows:
>
>
>
> mail($recipient_address, $subject, $body);
>
>
>
> It works fine for me if I send it from the php command line, but not from
> my web page. I use esmtp as my sendmail agent and I have put a copy of the
> .esmptrc file in the home directory for my web server (my web server runs as
> www-data and it's home directory is /var/www as listed in the /etc/passwd
> file). The file is readable by the www-data group.
>
>
>
> There is nothing in /var/log that tells me anything - in fact, all the
> mail.x logs are empty.
>
>
>
> Any ideas greatly appreciated.
>
>
> **********************************************************************
> Privileged/Confidential Information may be contained in this
> message. If you are not the addressee indicated in this
> message (or responsible for delivery of the message to such
> person), you must not copy, distribute or take any action in
> reliance to it.
> In such case, you should destroy this message and kindly
> notify the sender by reply email. Please advise immediately
> if you or your employer do not consent to Internet email for
> messages of this kind. Opinions, conclusions and other
> information in this message that do not relate to the official
> business of Minorplanet Systems plc shall be understood as
> neither given nor endorsed by it.
> Minorplanet Systems plc, Registration no: 3372097
> Minorplanet Limited, Registration no: 4072786
> Greenwich House, 223 North Street, Leeds, LS7 2AA
> VAT #: 698 1438 86
> **********************************************************************
>
>
>

Mime
View raw message