[TriLUG] sending mail with PHP

Brian Henning brian at strutmasters.com
Thu Sep 2 15:50:53 EDT 2004


Yeah, that's what I'm doing; sorry if that wasn't clear.  I mentioned the
command-line mail because it gives me trouble too.  But here's the line in
question from my script:
mail($FORM_RECIPIENT, "Form Submission Data", $message, "From: Form Bot
<robot at strutmasters.com>\r\n");
But in actuality, the PHP mail() command does its magic with an OS call to
/usr/bin/sendmail -t -i (or whatever is set in php.ini) anyway, so if a
command-line call to sendmail doesn't work, it follows that neither will
PHP's mail().
And yes, sending mail from a regular client works just fine.  That's how
this message is getting to the list (sendmail and apache are on the same
box).

It *does* sound like a sendmail config issue, but I'm not sure what I'm
missing in its config..  Everything seems in order when I peruse the
configuration.

I also can't find any log data that would pertain to this..  Not in
/var/log/messages or /var/log/maillog, at least.  Where else should I look?

~B

----- Original Message ----- 
From: "James Beidler" <james at layyze.com>
To: <trilug at trilug.org>
Sent: Thursday, September 02, 2004 3:10 PM
Subject: Re: [TriLUG] sending mail with PHP


>   It seems almost like a sendmail config issue.  Can you send mail from a
> regular client through your sendmail?
>   Another option that you can try instead of an os call from PHP to send
> mail is using the built-in PHP mail function:
> http://us4.php.net/manual/en/function.mail.php
>
>   The built-in function has worked rock-solid for me.
> -James
> > 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
> >
> >
> > --
> > TriLUG mailing list        :
> > http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ
> > : http://trilug.org/faq/
> > TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> > TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
>
>
>
> -- 
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
>





More information about the TriLUG mailing list