Re: [PHP] problem with mail() and attachment

2005-03-01 Thread AdamT
On Sun, 27 Feb 2005 08:23:26 +0100, Stefan Sturm <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I'm using the script below to send ascii files attached to mails via mail().
snip
> Has anybody got an idea where the problem could be?
> 
It appears that your mailserver has developed a fault and is sending
all messages out two or three times.
-- 
AdamT
"Justify my text?  I'm sorry, but it has no excuse."

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



[PHP] Problem with mail() and attachment

2005-02-28 Thread Stefan Sturm
Hi,

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";
  $headers .= "egrade-result\n";
  $headers .= "If you read this text your mail server is not supporting MIME
Format.\n";
  $headers .= "--$unique_sep\n";
  $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\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 .= "Content-Transfer-Encoding: 7bit\n\n";
#From the next command only a single \n is  in the header of the received
mail, the text and the other \n are missing
  $headers .= "egrade-result\n\n";
  $headers .= "--$unique_sep\n";
# filename holds the path to the ascii file
  $headers .= "Content-Type: {text/plain}; name=\"{$filename}\"\n";
  $headers .= "Content-Transfer-Encoding: base64\n";
  $headers .= "Content-Disposition: attachment\n\n";
  $filedata = implode(file($filename), '');
  $headers .= chunk_split(base64_encode($filedata));
  $headers .= "--$unique_sep--\n";
  if(mail("[EMAIL PROTECTED]","subject","egrade-result",$headers) or die("An
error occured! The questionnaire has not been processed"));

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



[PHP] problem with mail() and attachment

2005-02-28 Thread Stefan Sturm
Hi,

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";
  $headers .= "egrade-result\n";
  $headers .= "If you read this text your mail server is not supporting MIME
Format.\n";
  $headers .= "--$unique_sep\n";
  $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\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 .= "Content-Transfer-Encoding: 7bit\n\n";
#From the next command only a single \n is  in the header of the received
mail, the text and the other \n are missing
  $headers .= "egrade-result\n\n";
  $headers .= "--$unique_sep\n";
# filename holds the path to the ascii file
  $headers .= "Content-Type: {text/plain}; name=\"{$filename}\"\n";
  $headers .= "Content-Transfer-Encoding: base64\n";
  $headers .= "Content-Disposition: attachment\n\n";
  $filedata = implode(file($filename), '');
  $headers .= chunk_split(base64_encode($filedata));
  $headers .= "--$unique_sep--\n";
  if(mail("[EMAIL PROTECTED]","subject","egrade-result",$headers) or die("An
error occured! The questionnaire has not been processed"));

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