Most peculiar... Your solution seems to work, Ozz, but in a most unorthodox
manner...

Your method allows the email to be sent "from" pspicer (as far as the SMTP
server is concerned), but the $header line rewrites who the message is from
on the receiving end.

While not the solution I was expecting, this will do quite nicely. Thank you
very much!

On Thu, Sep 29, 2011 at 7:55 AM, <[email protected]> wrote:

> > Thanks to everyone for their suggestions. Here's what I've figured out
> and
> > where I'm stuck:
> > I had my email domain listed in the "mydomains" line of main.cf. That's
> > why
> > the mails were only being handled on my local machine and not going out
> to
> > the proper SMTP server. I took it out and was able to send a test message
> > by
> > telneting into localhost. However, when I try to send a mail through PHP,
> > it
> > gets rejected on the grounds of "unknown user account" on the server.
> > Further investigation reveals PHP is using www-data as it's user and, for
> > whatever reason, it's not using the name I specify in the $headers
> > variable
> > of my PHP script... Here's the script I'm using:
> >
> > $to="[email protected]";
> > $subject="Test";
> > $body="Testing";
> > $headers="From: [email protected]\r\nReply-to: [email protected]";
> >
> > $mail_sent=@mail($to,$subject,$body,$headers);
> > echo $mail_sent ? "Message sent." : "Message failed.";
>
> Try making the following changes:
> $to="[email protected]";
> $subject="Test";
> $body="Testing";
> $headers="From: [email protected]\r\nReply-to: [email protected]";
> // Add force from (next 2 lines)
> $set_force_from = "[email protected]";
> $force_from = "-f $set_force_from";
> // Add force_from to the mail command (after the headers).
> $mail_sent=@mail($to,$subject,$body,$headers,$force_from);
> echo $mail_sent ? "Message sent." : "Message failed.";
>
>
> Regards,
> Ozz.
>
>
> ---------------------------------------------------------------------
> Archive      http://marc.info/?l=jaxlug-list&r=1&w=2
> RSS Feed     http://www.mail-archive.com/[email protected]/maillist.xml
> Unsubscribe  [email protected]
>
>

Reply via email to