Encoding Issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leoden
Forum Newbie
Posts: 21
Joined: Sat May 24, 2003 8:48 pm

Encoding Issues

Post by leoden »

Hi guys, can someone help me with this little issue I've got.

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

?>
Does anyone know why these odd couple of customers recive unencoded attachments. Or why when I physically attach the file via outlook express and send it to the aforementionned customers it is recieved perfectly?
Post Reply