Re: Problems with PEAR::Mail_Mime and GPG
| From: | Jacques Marneweck | Date: | Thu, 10 Mar 2005 00:28:24 +0000 |
| Subject: | Re: Problems with PEAR::Mail_Mime and GPG | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17942@lists.php.net to get a copy of this message | ||
Hi James,
You need to first encrypt the file prior to attaching it. I've not
taken a look at the GPG stuff in ages, but the logic would be
something like:
GPG the attachment to temp file
Add attachment temporary file.
Send the mail message.
Regards
--jm
On Mon, 7 Mar 2005 14:15:21 +0000, James Carr <james.r.carr@gmail.com> wrote:
> 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
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Jacques Marneweck
http://www.powertrip.co.za/blog/