Connecting Tech Pros Worldwide Help | Site Map

Mail() is eating my bcc: header

  #1  
Old January 15th, 2007, 10:35 PM
Tim Ferguson
Guest
 
Posts: n/a
Dear all

I have a script (below) that for a long time has been sending out to an
opt-in distribution list, about 100 members. Today it has stopped working
and I am not quite sure what I have changed. This is the smallest version
that still demonstrates the problem (addresses obviously changed from the
real ones):

$subject = 'Small test';

$sender = 'mailings@example.com';

$contents = "This is a short test message";


$recips = "1@example.com";
$recips .= ",\r\n 2@example.com";
$recips .= ",\r\n 3@example.com";
$recips .= ",\r\n 4@example.com";

$header='From: ' . $sender . "\r\nX-mailer: php mail()" .
"\r\nbcc: " . $recips;

echo("<h4>Header string:</h4><pre>$header</pre>");

$success = mail($sender, $subject, $contents, $header);


The symptom is that the entire "bcc: 1@example.com" line disappears,
leaving the other three addresses tacked onto the X-mailer header. Prior
to putting in that dummy line, they were attached to the To: header,
which is not much use.

If I change the Bcc: to cc: (i.e. remove just one character) then it
formats and sends perfectly as expected -- but of course, all the
addresses are visible.

I don't think it is the ISP (Linux, shared web hosting) because it
happens on my own Windows test server. Looking at my server's firewall
log, the mangling has already happened on the way out to the smtp server.

I have tried all the ways I can think of to create the $header string,
but all with the same outcome. There is no function or variable called
Bcc that could be causing substituting.

I can't think of anything I've done. Help please?

Tim F

  #2  
Old January 16th, 2007, 09:35 AM
P Pulkkinen
Guest
 
Posts: n/a

re: Mail() is eating my bcc: header


Quote:
I have tried all the ways I can think of to create the $header string,
but all with the same outcome. There is no function or variable called
Have you also tried to make a simple test header string without any string
concanations and variables?
Because often we can be so sure, that our variable is something that it is
not.

Options imho:

a) your string is not want you think it is
b) the way you believe that string should be build for mail()-function is
wrong
c) more mysterious server reason



  #3  
Old January 16th, 2007, 06:45 PM
Tim Ferguson
Guest
 
Posts: n/a

re: Mail() is eating my bcc: header


"P Pulkkinen" <perttu.POISTATAMA.pulkkinen@POISTATAMA.elisanet.f iwrote
in news:jU0rh.5289$Fd3.2713@reader1.news.saunalahti.f i:
Quote:
>
Quote:
>I have tried all the ways I can think of to create the $header
>string, but all with the same outcome. There is no function or
>variable called
>
Have you also tried to make a simple test header string without any
string concanations and variables?
Yes: I can send it with all the bcc addresses on a single line and it goes
out correctly to all four addresses.
Quote:
Because often we can be so sure, that our variable is something that
it is not.
That is the reason for the echo("<pre>$header</pre>"); line.
Quote:
Options imho:
>
a) your string is not want you think it is
Possible, but I can't see what else it could be.
Quote:
b) the way you believe that string should be build for mail()-function
is wrong
As far as I can tell, it's RFC conformant. There is no way I can put all
100 addresses on one line.
Quote:
c) more mysterious server reason
My server reports that this one file is encoded as UTF-8 rather than ISO-
8859-1 (which all the other pages on the same site are) but I don't know if
I am now chasing ghosts.

Thanks anyway

Tim F

Closed Thread