In the meantime - since you've extended Zend_Mail and overridden the 'send()' method, why don't you override the setBody() and/or setBodyHtml() as well and save the text in your mail object yourself before it's encoded?

Kind regards,

Ramon de la Fuente



Hector Virgen wrote:
You definitely have a good use case for accessing the raw content of a Zend_Mime_Part object. Looking over the code, it always returns the content encoded:

    public function getContent($EOL = Zend_Mime::LINEEND)
    {
        if ($this->_isStream) {
            return stream_get_contents($this->getEncodedStream());
        } else {
return Zend_Mime::encode($this->_content, $this->encoding, $EOL);
        }
    }

You should file a bug for this. Adding a "getContentRaw()" method should be easy :)

--
Hector


On Wed, Apr 7, 2010 at 10:51 AM, Саша Стаменковић <[email protected] <mailto:[email protected]>> wrote:

    Isn't that a bug? I mean, if you are able to set something, it's
    funny if can't get it later :)

    Regards,
    Saša Stamenković



    On Wed, Apr 7, 2010 at 7:48 PM, Hector Virgen <[email protected]
    <mailto:[email protected]>> wrote:

        There doesn't seem to be a way to get the unencoded content,
        so it looks like you just need to use the right decoding function.

        --
        Hector



        On Wed, Apr 7, 2010 at 10:45 AM, Саша Стаменковић
        <[email protected] <mailto:[email protected]>> wrote:

            Nice try, I think I was already trying this few months ago :)

            Result is now

2010-04-07T19:44:18+02:00 INFO (6): From: *
            To: array (
              0 => '*,
            )
            Subject: Kontakt sa automobi.li <http://automobi.li>
            Message (txt): Poruka od Sa=C5=A1a
            Stamenkovi=C4=87=0A=0Aasdasdadsdasdasda=0A=0A=E2=94=
            
=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
            
=80=E2=94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
            
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
            
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
            
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
            
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
            
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
            
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90=0A=E2=94=82IP=
=E2=94=82127.0.0.1 =E2=
            
=94=82=0A=E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
            
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=
            
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
            
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
            
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
            
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
            
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
            
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=A4=
            =0A=E2=94=82Browser   =E2=94=82Mozilla/5.0 (Windows; U;
            Windows NT 5.1;=
en-US; =E2=94=82=0A=E2=94=82 =E2=94=82rv:1.9.1.8) Gecko/2010= 0202 Firefox/3.5.8 =E2=94=82=0A=E2=94=94=E2=94=80=E2=94=80=E2=
            
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
            
=94=B4=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
            
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
            
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
            
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
            
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
            
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
            
=94=80=E2=94=80=E2=94=80=E2=94=98=0A=0A________________________=0A=0Ahtt=
            p://automobi.li/ <http://automobi.li/>
            Message (html): <html>=0D=0A=09<body style=3D"font-family:
            Verdana,Arial,sans-serif; fon=
            t-size: 1.1em;">=0D=0A=09=09<div
            style=3D"border-color:#F5F5F5; border-s=
            tyle:solid;">=0D=0A=09=09=09<div
            style=3D"background-color:#F5F5F5; padd=
            ing-bottom:5px; padding-top:5px;">=0D=0A=09=09=09=09<a
            href=3D"http://au=
            tomobi.li <http://tomobi.li>"><img style=3D"border:medium
            none;" src=3D"/images/logo-email.=
            png" /></a>=0D=0A=09=09=09</div>=0D=0A=09=09=09<div
            style=3D"padding-lef=
            t:15px;">=0D=0A=09=09=09=09<h3>Poruka od Sa=C5=A1a
            Stamenkovi=C4=87</h3>=
            =0A<p>asdasdadsdasdasda</p>=0A=0A<ul>=0A=09<li>IP:
            127.0.0.1</li>=0A=09<=
            li>Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1;
            en-US; rv:1.9.1.8)=
             Gecko/20100202
            Firefox/3.5.8</li>=0A</ul>=0A=09=09=09</div>=0D=0A=09=09=
            =09<div style=3D"background-color:#F5F5F5;
            font-size:0.7em; padding-bott=
            om:5px; padding-top:5px;
            text-align:center;">=0D=0A=09=09=09=09&copy; 20=
            10 automobi.li
            
<http://automobi.li>=0D=0A=09=09=09</div>=0D=0A=09=09</div>=0D=0A=09</body>=0D=
            =0A</html>


            Regards,
            Saša Stamenković



            On Wed, Apr 7, 2010 at 7:38 PM, Hector Virgen
            <[email protected] <mailto:[email protected]>> wrote:

                Interesting.. what about passing the string to
                Zend_Mime_Decode::decodeQuotedPrintable()?

                --
                Hector



                On Wed, Apr 7, 2010 at 10:33 AM, Саша Стаменковић
                <[email protected] <mailto:[email protected]>> wrote:

                    Sure, same thing:

2010-04-07T19:32:17+02:00 INFO (6): From: ***
                    To: array (
                      0 => '***',
                    )
                    Subject: Kontakt sa automobi.li <http://automobi.li>
                    Message (txt): Poruka od Sa=C5=A1a
                    Stamenkovi=C4=87=0A=0Adasdadasdasd=0A=0A=E2=94=8C=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90=0A=E2=94=82IP
                         =
=E2=94=82127.0.0.1 =E2=94=82=
                    
=0A=E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
                    
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=
                    
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
                    
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
                    
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
                    
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
                    
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
                    
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=A4=0A=E2=
                    =94=82Browser   =E2=94=82Mozilla/5.0 (Windows; U;
                    Windows NT 5.1; en-US;=
=E2=94=82=0A=E2=94=82 =E2=94=82rv:1.9.1.8) Gecko/20100202 Fi= refox/3.5.8 =E2=94=82=0A=E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=B4=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
                    
=94=80=E2=94=80=E2=94=98=0A=0A________________________=0A=0Ahttp://autom=
                    obi.li/ <http://obi.li/>
                    Message (html): <html>=0D=0A=09<body
                    style=3D"font-family: Verdana,Arial,sans-serif; fon=
                    t-size: 1.1em;">=0D=0A=09=09<div
                    style=3D"border-color:#F5F5F5; border-s=
                    tyle:solid;">=0D=0A=09=09=09<div
                    style=3D"background-color:#F5F5F5; padd=
                    ing-bottom:5px;
                    padding-top:5px;">=0D=0A=09=09=09=09<a
                    href=3D"http://au=
                    tomobi.li <http://tomobi.li>"><img
                    style=3D"border:medium none;"
                    src=3D"/images/logo-email.=
                    png"
                    /></a>=0D=0A=09=09=09</div>=0D=0A=09=09=09<div
                    style=3D"padding-lef=
                    t:15px;">=0D=0A=09=09=09=09<h3>Poruka od Sa=C5=A1a
                    Stamenkovi=C4=87</h3>=
                    =0A<p>dasdadasdasd</p>=0A=0A<ul>=0A=09<li>IP:
                    127.0.0.1</li>=0A=09<li>Br=
                    owser: Mozilla/5.0 (Windows; U; Windows NT 5.1;
                    en-US; rv:1.9.1.8) Gecko=
                    /20100202
                    
Firefox/3.5.8</li>=0A</ul>=0A=09=09=09</div>=0D=0A=09=09=09<di=
                    v style=3D"background-color:#F5F5F5;
                    font-size:0.7em; padding-bottom:5px=
                    ; padding-top:5px;
                    text-align:center;">=0D=0A=09=09=09=09&copy; 2010 aut=
                    omobi.li
                    
<http://omobi.li>=0D=0A=09=09=09</div>=0D=0A=09=09</div>=0D=0A=09</body>=0D=0A</h=
                    tml>


                    Regards,
                    Saša Stamenković



                    On Wed, Apr 7, 2010 at 7:23 PM, Hector Virgen
                    <[email protected] <mailto:[email protected]>>
                    wrote:

                        Did you try $this->getBodyText(true) ?

                        --
                        Hector



                        On Wed, Apr 7, 2010 at 10:13 AM, Саша
                        Стаменковић <[email protected]
                        <mailto:[email protected]>> wrote:

                            I extended Zend_Mail in order to log all
outgoing emails.
                            overriden

                                public function send($transport = null) {
                                 // Send
                                 parent::send($transport);

                                 // Log
                                 $this->log();

                                 return $this;
                            }

                            private function log() {
                            $log = new Zend_Log();
                            $log->addWriter(new Zend_Log_Writer_Stream(
                            realpath(APPLICATION_PATH .
                            '/../data/logs') . '/email-' .
                            Zend_Date::now()->toString('YYYY-MM-dd') .
                            '.log'
                            ));

                            $tpl = '
                            From: %s
                            To: %s
                            Subject: %s
                            Message (txt): %s
                            Message (html): %s';

                            $log->info(sprintf(
                            $tpl,
                            $this->getFrom(),
                            var_export($this->getRecipients(), true),
                            $this->getSubject(),
                            $this->getBodyText()->getContent(),
                            $this->getBodyHtml()->getContent()
                            ));
                            }

                            But message bodies are encoded, how can I
                            get normal mail bodies inside Zend_Mail class?

                            Regards,
                            Saša Stamenković









Reply via email to