Re: problem with mail()

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

 



Stefan Sturm wrote:
> I'm using the script below to send ascii files attached to mails via
> mail().
> I'm running the script on different servers and it works fine. Now I got a
> problem on windows server 2003. The attachment of the mail is disturbed,
> the
> first 76 characters are missing, the rest of the attachment is correct.
> When
> I looked at the mail headers of the mail I recieved I recognized that
> there
> were some lines missing. Also the first line of the attachment part in the
> header is mssing. As I use chunk_split without the chunklen paramter the
> lines are all 76 characters long. So it just looks like that the server
> ommits lines in the header. I marked the missing lines in the script with
> comments. Has anybody got an idea where the problem could be?
>
> Thank in advance
>
> Stefan
>
>   $unique_sep =md5(uniqid(time()))";
>   $headers = "From: egrade questionaire\n";
>   $headers .= "MIME-Version: 1.0\nContent-Type:
> multipart/mixed;boundary=\"$unique_sep\";\n";
>
> #The second \n at the end of the next command is ommited, the resulting
> empty line is not in the header of the received mail
>   $headers .=
> "charset=\"iso-8859-1\"\nContent-Transfer-Encoding:7bit\n\n";

Email headers, by definition, end when a blank line is sent.

So you're really cramming the BODY of your message into the headers
through the PHP mail function.

It happens by sheer good luck to "work" on some systems, since the
resulting composition ends up *LOOKING* like a valid email, even though
you routed your body through the headers.

That doesn't make it valid.

Everything after the \n\n should be moved to the body you pass to PHP's
mail  function.


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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