Discussion:
mail function
Jim Pazarena
2014-10-03 17:40:27 UTC
Permalink
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!
--
Jim Pazarena 250.559.7777
www.haidagwaii.net/paz/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard
2014-10-03 17:51:53 UTC
Permalink
------------ Original Message ------------
Date: Friday, October 03, 2014 10:40:27 -0700
Subject: [PHP] mail function
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!
Care to show your work? It's hard to give insights about what the
cause might be when we can only guess at what you're doing.

A code snippet relevant to your mail() function usage would be a
starting point.


- Richard
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-10-03 17:53:46 UTC
Permalink
Post by Jim Pazarena
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!
Showing your code would be helpful for us to be able to help you.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Pazarena
2014-10-03 18:19:49 UTC
Permalink
Post by Jim Pazarena
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!
--
Jim Pazarena 250.559.7777
www.haidagwaii.net/paz/
Richard
2014-10-03 18:54:53 UTC
Permalink
------------ Original Message ------------
Date: Friday, October 03, 2014 11:19:49 -0700
Subject: [PHP] Re: mail function
Post by Jim Pazarena
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 = "***@paz.bz";
$from = "***@paz.bz";
$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
Jim Pazarena
2014-10-03 19:28:46 UTC
Permalink
Post by Richard
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";
$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
BINGO !
as simple as making my $from include the From: webmaster ...

I am very grateful.
Post by Richard
<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.
excellent suggestion ... at least for troubleshooting.
thank you muchly
Post by Richard
- Richard
--
Jim Pazarena 250.559.7777
www.haidagwaii.net/paz/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...