Re: PLEASE HELP...Email attachment corruption

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

 



Maybe the files are damaged even before they get to the php script?

-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
"Ron Herhuth" <Ron.Herhuth@xxxxxxxxxxxxxxxxx> skrev i meddelandet
news:d8e401c4126b$2eaf5660$f25d2981@xxxxxxxxxxxxxxxx

I am dying here.  I'm on a deadline and I can't get
attachments...specifically PDFs and Word Docs to send without corruption.
I am using the script below to send the emails, and I have used several of
the classes on PHP.classes to try but everytime the files show up and the
error reads "The File is damaged and could not be repaired" when they are
opened.  When I print the message out to the browser it appears as though
the entire string is not being sent.  Is there any ini settings that might
affect this?  I am really in a bind and don't know what to do.  Any
suggestions would be greatly appreciated.


SCRIPT:

ini_set("sendmail_from","cio.tax@xxxxxxxxxxxx");

$toaddress = "testemail@xxxxxxxxxxxx";
$fromaddress = "Tatum CIO Tax <cio.tax@xxxxxxxxxxxx>";
$subject = "Tatum CIO K-1 & State Tax Information";




$headers = "From: $fromaddress\n";
$headers .= "Reply-To: $fromaddress\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDARY\"\n";
$headers .= "X-Sender: $fromaddress\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: $fromaddress\n";
$headers .= "This is a multi-part message in MIME format.\n";

$message = "--MIME_BOUNDARY\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n\n";
$message .= "\n\n";

// email text message goes here
$message .= "
\n
Attached to this email are the following 3 documents: to you from the
Tatum CIO Tax
\n\n
";


$message .= "\n";
$message .= "--MIME_BOUNDARY\n";


// FILE ATTACHMENT CODE



$file_url = "Simpletest.pdf";

$fp = fopen($file_url,"r");
$str = fread($fp, filesize($file_url));
$str = chunk_split(base64_encode(implode("", file("Simpletest.pdf")))); ;


$message .= "Content-Type: application/pdf; name=\"Simpletest.pdf\"\n";
$message .= "Content-disposition: attachment\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "\n";
$message .= "$str\n";
$message .= "\n";
$message .= "--MIME_BOUNDRY\n";




$message .= "--MIME_BOUNDRY--\n";

// echo "TO: $toaddress <br><br>SUBJECT: $subject<br><br>MESSAGE:
$message<br><br><br><br>";

mail("ron@xxxxxxxxxxxx",$subject,$message,$headers);

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux