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
https://forums.phpfreaks.com/topic/142778-solved-pear-mail_mime-attachments-help/
Share on other sites

i havent filled in the

 

string    $location    —    The RFC 2557.4 location of the attachment

 

of the

 

Mail_mime->addAttachment method

 

as i don't know what it means and cant find any info and it dose not say it defaults.

comon guys youv forsaken me, look when i take away the files, the headers still display in the clien, when i take away the html the headers dont display so it works cool with plain text.

 

why cant i get the headers to be understood byh the client ??

Yeh be lyk that i found teh answer anyways in UNIX systems its a

 

new Mail_mime("/n");

 

in others its

 

new Mail_mime("/n/r");

 

or

 

new Mail_mime("/r/n");

 

otherwise the newlines in the headers cock up

 

sweet

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.