Hello bujanga,

That's indeed what I am doing now, but it is a violation of the MVC principle.
So I'd like to do it the clean way, but I need a little help to get started.

Of course I'll publish any final code if it becomes a plugin/component ...


On Mon, Jul 18, 2011 at 10:21 PM, bujanga <buja...@gmail.com> wrote:
> I do something very similar. Though I send plain text email only. I
> create my data as fully formatted, sign/encrypt it and then send it to
> a template that just outputs the field.
>
> On Mon, Jul 18, 2011 at 12:16 PM, Christophe Vandeplas
> <christo...@vandeplas.com> wrote:
>> Hello,
>>
>>
>> My webapplication needs to send out emails that are signed with a GPG
>> signature.
>> However as I am using the Email component this seems a little more
>> complicated as I can't really figure out how to do it. Any help will
>> be appreciated and compensated with Belgian beer if we ever meet.
>>
>> Signing data using GnuPG (and the PEAR GPG classes) is relatively
>> easy:
>>        require_once 'Crypt/GPG.php';
>>        $gpg = new Crypt_GPG();
>>        $text = "Hello world";
>>        $gpg->addSignKey(Configure::read('GnuPG.email'),
>> Configure::read('GnuPG.password'));
>>        $text_signed = $gpg->sign($text, Crypt_GPG::SIGN_MODE_CLEAR);
>>        debug($text_signed);
>>
>> The code I use to send out the email is here. The "new_event" view
>> will be used to format my email message with the data from $event.
>>
>>        $this->Email->from = "foo <f...@bar.com>";
>>        $this->Email->to = "bar <b...@foo.com>";
>>        $this->Email->subject = "[foo] new event";
>>        $this->Email->delivery = 'debug';   // do not really send out
>> mails, only display it on the screen
>>        $this->Email->template = 'new_event'; // in views/elements/
>> email/html or text
>>        $this->Email->sendAs = 'text';        // both text or html
>>        $this->set('event', $event);
>>        $this->Email->send();
>>
>> Now the GPG magic needs to happen on the email body/message.
>> I've opened the EmailComponent class to find out that the ->send()
>> function _renders() the mail using the view and finally sends it using
>> the delivery method (mail, smtp,...).
>>
>> However I can't find a way to extract the rendered body, sign it, push
>> it back and then let it be sent.
>>
>> I guess I will probably need to make a new component class to handle
>> this. However I have absolutely no idea where or how to start.
>> Considering the few lines required to do the gpg signing it shouldn't
>> be to difficult though...
>>
>> Could you give me some advice to get this going?
>>
>> Thanks
>> Christophe
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
>> http://groups.google.com/group/cake-php
>>
>
> --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to