[TriLUG] sending mail with PHP

Jeremy Portzer jeremyp at pobox.com
Thu Sep 2 16:07:36 EDT 2004


Sounds like you forgot to set "Cw" value when configuring sendmail.  Put
something like "Cwhost.domain.ext" in the bottom of
/etc/mail/sendmail.mc (or look for the Cw line in sendmail.cf if you
prefer to edit it directly).  Remember to rebuild the sendmail.cf file
if you edit sendmail.mc.

Also, when you run "mail" at a shell prompt, why is the mail not
delivered?  What is the error message or exact nature of the problem? 
What does /var/log/maillog have to say about the situation?

You should definitely use PHP's mail function instead of calling the
"mail" binary directly.  You should be EXTREMELY wary about accepting
user input (e.g. the e-mail address, e-mail body, etc.) and then
execuing a binary on your system, unless you REALLY know what you are
doing.

HTH,
Jeremy

On Thu, 2004-09-02 at 15:02, Brian Henning wrote:
> Isn't Apache 2.X supposed to be more secure and all that fun?
> anyhow..
> I'm trying to write a PHP script to send an e-mail containing data filled
> into a form on a web page.  Simple stuff.  Only problem is, the mail doesn't
> get delivered.  I think I know the basis of the problem, but I'm not at all
> sure how to fix it.  I think it's related to the mail command in a shell not
> working correctly (i.e. mail sent using said command does not get
> delivered).
> What I think the problem is, is that sendmail (or mail) isn't correctly
> qualifying the From: in the message.  It's getting qualified as
> sender at localhost.localdomain instead of sender at strutmasters.com , and that
> appears to be causing it to be bounced because of invalid domain name.
> I don't often send mail from the command line (although I sometimes do), but
> the mail function of the PHP script is critical, so a resolution is a fairly
> high priority for me.
> Any suggestions?
> 
> Thanks a bunch,
> ~Brian
-- 
/---------------------------------------------------------------------\
| Jeremy Portzer        jeremyp at pobox.com      trilug.org/~jeremy     |
| GPG Fingerprint: 712D 77C7 AB2D 2130 989F  E135 6F9F F7BC CC1A 7B92 |
\---------------------------------------------------------------------/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20040902/ada53fdf/attachment.pgp>


More information about the TriLUG mailing list