PHP not attaching file...
Posted: Thu Jun 03, 2010 9:26 am
Code: Select all
$to = $recipient_email;
$subject = $email_subject;
$random_hash = md5(date('r', time()));
$headers = "From: " . $sender_email . "\r\nReply-To: " . $sender_email;
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($complete_zip_path)));
$complete_zip = $format_name . '.zip';
$output = "
--PHP-mixed-$random_hash;
Content-Type: multipart/alternative; boundary='PHP-alt-$random_hash'
--PHP-alt-$random_hash
Content-Type: text/plain; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
--PHP-alt-$random_hash
Content-Type: text/html; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
--PHP-alt-$random_hash--
--PHP-mixed-$random_hash
Content-Type: application/zip; name=$complete_zip
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$attachment
--PHP-mixed-$random_hash--";
@mail($to, $subject, $output, $headers);
[text]
--PHP-mixed-22e9eaebf5a2ed87be456f72304ee203;
Content-Type: multipart/alternative; boundary='PHP-alt-22e9eaebf5a2ed87be456f72304ee203'
--PHP-alt-22e9eaebf5a2ed87be456f72304ee203
Content-Type: text/plain; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
--PHP-alt-22e9eaebf5a2ed87be456f72304ee203
Content-Type: text/html; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
--PHP-alt-22e9eaebf5a2ed87be456f72304ee203--
--PHP-mixed-22e9eaebf5a2ed87be456f72304ee203
Content-Type: application/zip; name=jkkj.zip
Content-Transfer-Encoding: base64
Content-Disposition: attachment
[/text]
Under that is all the encoding, but no attachment? Here are the pear modules I have installed:
Archive_Tar 1.3.2 stable
Archive_Zip 0.1.1 beta
Console_Getopt 1.2.3 stable
File_Archive 1.5.4 stable
MIME_Type 1.2.0 stable
Mail 1.2.0 stable
Mail_Mime 1.7.0 stable
Mail_mimeDecode 1.5.1 stable
PEAR 1.6.1 stable
Structures_Graph 1.0.2 stable
Am I missing something?