[TriLUG] sending mail with PHP

Tobias Crawley tcrawley at gmail.com
Thu Sep 2 15:48:50 EDT 2004


Brian,

I had a similar problem, and fixed it by forcing the 'from' address
using the 'addtional_parameters' parameter to mail(), like so:

mail( $to, $subject, $body, $headers, "-f{$from}" );

Take a look at example 3:
http://us2.php.net/manual/en/function.mail.php

Toby

On Thu, 2 Sep 2004 15:02:39 -0400, Brian Henning <brian at strutmasters.com> 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
> 
> --
> 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