Problems with PEAR::Mail_Mime and GPG
| From: | James Carr | Date: | Mon, 07 Mar 2005 14:15:21 +0000 |
| Subject: | Problems with PEAR::Mail_Mime and GPG | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17906@lists.php.net to get a copy of this message | ||
Hello,
I've been using Mail_Mime with a web application I've been developing
to add attachments to emails send out, and I now have a need in my
specifications for this to be encrypted via GPG. I have been able to
encrypt plain text messages just fine and send them out, which are
decrypted okay, but once an attachment enters the foray, they decrypt
it and seem to get t he raw message.
Perhaps I'm doing something wrong... I'm no genius at email headers
and stuff. :(
Here's my code:
$mime =& new Mail_mime;
$mime->addAttachment($pdf, 'application/octet-stream', $filename, FALSE);
$mime->setTxtbody('The loan preapplication was submitted.');
$hdrs = array(
'From' => 'recipient@example.com',
'Subject' => "{$values['app_type']}
Pre-Application"
);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$body = GPG::encrypt($body, 'recipient@example.com');
$mail = Mail::factory('mail');
$mail->send('recipient@example.com', $hdrs, $body);
_____________________________________________________________
The GPG class is pretty simple, but the details of it are excluded as
it encrypts the messages fine, I just think I am doing something wrong
with the way I am sending it because when they decrypt the message,
they get the mime boundries, plain text, and the PDF base64 encoded.
:(
Thanks for any help you guys can provide.
Thanks,
JC