> 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!
No problem - glad I could help.
This may provide a little more information:
http://www.php.net/manual/en/function.mail.php
The section under Additional Parameters says this:
<quote>
The additional_parameters parameter can be used to pass additional flags
as command line options to the program configured to be used when sending
mail, as defined by the sendmail_path configuration setting. For example,
this can be used to set the envelope sender address when using sendmail
with the -f sendmail option.
The user that the webserver runs as should be added as a trusted user to
the sendmail configuration to prevent a 'X-Warning' header from being
added to the message when the envelope sender (-f) is set using this
method. For sendmail users, this file is /etc/mail/trusted-users.
</quote>
This may provide a little more information - the user did the same thing I
recommended:
http://www.php.net/manual/en/function.mail.php#104594
Hope that helps.
Regards,
Ozz.
(BTW - sorry for the double post earlier. It didn't look like my first
one went through originally, so I resent using my phone.)
> 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="pspicer-3Q2Tfjf0mexWk0Htik3J/[email protected]";
>> > $subject="Test";
>> > $body="Testing";
>> > $headers="From: pspicer-3Q2Tfjf0mexWk0Htik3J/[email protected]\r\nReply-to:
>> pspicer-3Q2Tfjf0mexWk0Htik3J/[email protected]";
>> >
>> > $mail_sent=@mail($to,$subject,$body,$headers);
>> > echo $mail_sent ? "Message sent." : "Message failed.";
>>
>> Try making the following changes:
>> $to="pspicer-3Q2Tfjf0mexWk0Htik3J/[email protected]";
>> $subject="Test";
>> $body="Testing";
>> $headers="From: pspicer-3Q2Tfjf0mexWk0Htik3J/[email protected]\r\nReply-to: pspicer-3Q2Tfjf0mexWk0Htik3J/[email protected]";
>> // Add force from (next 2 lines)
>> $set_force_from = "pspicer-3Q2Tfjf0mexWk0Htik3J/[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]
>>
>>
>
---------------------------------------------------------------------
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.