I have a system on my website where members can recieve a word file monthly. The PHP process that sends out the emails with the word attachment uses the PEAR Mime classes.
Every month however I get about four or five emails ( out of about 70 members, although I dont know how many dont bother to inform me of any problems ) stating that the email they recieved was a load of jumbled text instead of the attachment.
The attachemnt is sent fine to my email address, and to friends who use different email clients than me. My code is as follows
Code: Select all
<?php
$mail_to = $row['email'];
$mail_subject = "BlahBlah"
$mail_body = "Dear So and So etc etc \r\n\r\n";
$mail_body .= "Yours Sincerely\r\n\r\n";
$catalogue_filename = "../Catalogues/" . $_POST['SaleNumber'] . ".doc";
$hdrs = array('From' => 'blahblah@blahblah.com','Subject' => $mail_subject);
$crlf = "\r\n";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($mail_body);
$mime->addAttachment($catalogue_filename,"application/msword");
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send($mail_to, $hdrs, $body);
?>