On Wed, Aug 4, 2010 at 10:38 AM, Paul <[email protected]> wrote:

>
>
> On 8/4/2010 10:31 AM, David Mintz wrote:
>
>
>
> On Tue, Aug 3, 2010 at 4:43 PM, Sudheer Satyanarayana <
> [email protected]> wrote:
>
>>
>>  but I think there's the disadvantage that your Zend_Mail resource would
>>> get instantiated at bootstrap time whether you need it or not -- true? --
>>> and not every controller/action in my app needs to send email.
>>>
>>>  Right.
>>
>>  Finally, I suppose you could set the email configuration data in its own
>>> separate config file.
>>>
>>> Any thoughts?
>>>
>>>  I have my email settings in the database. I have extended Zend_Mail and
>> added a method setup().
>>
>> Class My_Mail extends Zend_Mail
>> {
>>
>>   public function setup()
>>   {
>>        // get the info to setup the clss
>>        // set it up
>>   }
>> }
>>
>> Client code:
>>
>> $mail = new My_Mail();
>> $mail->setup();
>>
>>
>
>  Hmmm -- I am starting to think in this direction. Would you regard this
> class as a Model and stick it in your models directory?
>
>  Parenthetically, any reason you don't do the setup in your constructor?
> You could have your defaults and have your constructor acception options to
> override them.
>
>  I am also consider a controller action helper. What do you think of that
> idea?
>
>
>  --
> Support real health care reform:
> http://phimg.org/
>
> --
> David Mintz
> http://davidmintz.org/
>
>
> All my systems have an Email Service class located in
> application/services.   The benefit here is that I can lazy load all email
> objects AND have preconfigured email objects like System Email, Debug Email,
> etc.
>


And now I belatedly RTFM and discover Zend_Application_Resource_Mail and
wonder why not use it. I have been looking at some of the ZF source to try
to understand how much happens at bootstrap time and haven't yet figured
out:  the Zend_Mail object doesn't actually get instantiated until you
explicitly access the resource, or does it? Sorry for exposing my ignorance
of ZF internals. Just wondering if it makes sense to use this Resource
mechanism even when you know you app will not need it most of the time.


-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/

Reply via email to