[Grok-dev] send mail queryUtility ComponentLookupError todoplus

DIVINE, PAUL (PAUL) paul.divine at alcatel-lucent.com
Mon Aug 23 03:02:56 EDT 2010

Hi Maurits van Rees,
Thanks for your help.
I have modified the configure.zcml two lines
And I restarted the server.
Then the same error is displayed.

Paul Diviné
The details are given in the following lines.

<<      msg["To"] = ','.join(recipient)
        msg["Subject"] = email.Header.Header(subject, 'UTF-8')
        mailer = getUtility(IMailDelivery, 'todoplus')
        mailer.send(sender, recipient, msg.as_string())>>  mailer = getUtility(IMailDelivery, 'todoplus')
Module zope.component._api:171 in getUtility        
<<      if utility is not None:
            return utility
        raise ComponentLookupError(interface, name)
    def queryUtility(interface, name='', default=None, context=None):>>  raise ComponentLookupError(interface, name)
ComponentLookupError: (<InterfaceClass zope.sendmail.interfaces.IMailDelivery>, 'todoplus')

-----Message d'origine-----
De : grok-dev-bounces at zope.org [mailto:grok-dev-bounces at zope.org] De la part de Maurits van Rees
Envoyé : vendredi 20 août 2010 18:16
À : grok-dev at zope.org
Objet : Re: [Grok-dev] send mail queryUtility ComponentLookupError todoplus

Op 20-08-10 11:24, DIVINE, PAUL (PAUL) schreef:
>      mailer = getUtility(IMailDelivery, 'todoplus')
>     <mail:smtpMailer
>       name="todoplus.smtp"
>       hostname="mailhost.xxxxx"
>       port="25"
>       username="xxxxx"
>       password="xxxx"
>       />
>   <mail:queuedDelivery
>       name="mailer"
>       permission="zope.Public"
>       mailer="todoplus.smtp"
>       queuePath="mailqueue"
>       />

In this zcml you have defined a mailer with name 'todoplus.smtp'.  So in 
the above python code you should use that name as well:

       mailer = getUtility(IMailDelivery, 'todoplus.smtp')

Or the other way around (both using 'todoplus' as name) of course.

Maurits van Rees
Programmer, Zest Software

Grok-dev mailing list
Grok-dev at zope.org

More information about the Grok-dev mailing list