Jump to content

[SOLVED] PEAR Mail_mime attachments help


nadeemshafi9

Recommended Posts

Hi guys

 

I am using Mail_mime attachments for the first time, my emails are arriving with the data instead of the icons i am sure i am doing it right i followed the manual, i am sending base64 encoded data files contents from a database along with there content type and disposition, i have specified this in Mail_mime. We don't use camel case here, should i be using Mail_mime getMessage  or get.

 

<?php
while($recipient = mysql_fetch_array($recipient_rs)){
		$attachments_rs = $this_attachment->get_all_email_attachments($this_email->email_id);
		while($attachment = mysql_fetch_array($attachments_rs)){
			// attachment
			if(!$this_mail_mime->addAttachment(
				$attachment['attachment_attachment'], 
				$attachment['attachment_contenttype'], 
				'filename', 
				false, 
				'base64', 
				'attachment', 
				'UTF8', 
				'English',
				''
			)){
				echo "Fail: this_mail_mime->addAttachment";
			}
		}
		// recipient
		$recipient = $this_mail_mime->encodeRecipients($recipient['recipient_email']);
		// HTML
		if(!$this_mail_mime->setHTMLBody($this_email->email_html)) echo "Fail: this_mail_mime->setHTMLBody";
		// Text
		if(!$this_mail_mime->setTXTBody($this_email->email_text, false, true)) echo "Fail: this_mail_mime->setTXTBody";
		// Headers 
		$headers = $this_mail_mime->headers();
		// Body
		$body = $this_mail_mime->get();
		// Send
		$this_mail->send($recipient, $headers, $body);
	}
?>

 

The email is delivered looking like this

 

--=_c5315d2ba2c73c11d0eb41f3c2e6a43f

Content-Type: multipart/alternative;

boundary="=_aa7e3304f426f2a0d91d8bf6815d92d8"

 

--=_aa7e3304f426f2a0d91d8bf6815d92d8

Content-Transfer-Encoding: 7bit

Content-Type: text/plain; charset="ISO-8859-1"

 

hiyahiya

--=_aa7e3304f426f2a0d91d8bf6815d92d8

Content-Transfer-Encoding: quoted-printable

Content-Type: text/html; charset="ISO-8859-1"

 

hiya

--=_aa7e3304f426f2a0d91d8bf6815d92d8--

 

--=_c5315d2ba2c73c11d0eb41f3c2e6a43f

Content-Transfer-Encoding: base64

Content-Type: image/jpeg;

name*="UTF8'English'filename";

Content-Disposition: attachment;

filename*="UTF8'English'filename";

 

LzlqLzRBQVFTa1pKUmdBQkFRRUFZQUJnQUFELzJ3QkRBQVlFQlFZRkJBWUdCUVlIQndZSUNoQUtD

Z2tKQ2hRT0R3d1FGeFFZR0JjVUZoWWFIU1VmR2hzakhCWVdJQ3dnSXlZbktTb3BHUjh0TUMwb01D

 

This goes on forever ......

 

o=

--=_c5315d2ba2c73c11d0eb41f3c2e6a43f

Content-Transfer-Encoding: base64

Content-Type: image/jpeg;

name*="UTF8'English'filename";

Content-Disposition: attachment;

filename*="UTF8'English'filename";

 

LzlqLzRBQVFTa1pKUmdBQkFRRUFZQUJnQUFELzJ3QkRBQVlFQlFZRkJBWUdCUVlIQndZSUNoQUtD

Z2tKQ2hRT0R3d1FGeFFZR0JjVUZoWWFIU1VmR2hzakhCWVdJQ3dnSXlZbktTb3BHUjh0TUMwb01D

 

This goes on forever ......

 

--=_c5315d2ba2c73c11d0eb41f3c2e6a43f--

 

 

Any ideas ? remember first time use.

 

Thanks

 

http://pear.php.net/package/Mail_Mime/docs/latest/Mail_Mime/Mail_mime.html

 

http://pear.php.net/package/Mail/docs/latest/Mail/Mail.html

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.