Re: Re: mail function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




------------ Original Message ------------
> Date: Friday, October 03, 2014 11:19:49 -0700
> From: Jim Pazarena <php@xxxxxx>
> To: php-general@xxxxxxxxxxxxx
> Cc: 
> Subject:  Re: mail function
>
> On 2014-10-03 10:40, Jim Pazarena wrote:
>> when I generate an email using the mail() function, my message
>> body ALWAYS has the sending/from address
>> included as the first line of the message body. I am not putting
>> it in my message body, yet there it is.
>> Any clues would be appreciated.
>> server is exim, altho I can't see exim doing it.
>> Thanks!
>> 
>> ps. only getting into php recently. 'Been in 'c' for years. I
>> really like php. Flexibility! Power!
> 
> attached is short source along with complete email output
> Thanks!

I believe the issue is that you are including the "$from" in the
"additional_headers" parameter position without building a header or
otherwise labeling that address.

 $subject_line = "testing email";
 $to = "php@xxxxxx";
 $from = "webmaster@xxxxxx";
 $envelope_sender = "-f=<$from>";
 $hit_date = date("Y-m-d H:i:s");
 ...
 $message_body = "$subject_line ...

 mail($to,$subject_line,$message_body,$from,$envelope_sender);

I think that if you label it, e.g., 'From: $from', or build a header
variable and include it there, you'll be ok. See: 

   <http://php.net/manual/en/function.mail.php>

for lots of detail.

By the way, using the same "from" address everywhere makes figuring
out where this is coming from more complicated. For testing
purposes, try using different values in your various "from"
instances so that things are more obvious.


    - Richard




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux