mailer.send() does not send immediately. As per the docs it uses the
transaction manager and sends the mail at the end of the request. You
can create an exception view for this exception, or call
mailer.send_immediately() instead. The transaction manager helps to
avoid sending emails when you get an exception in some part of your
code.

On Fri, Jun 8, 2012 at 6:42 PM, Alejandro Jatib <aja...@gmail.com> wrote:
> i have problems capturing exceptions with pyramid_mailer.
> When i send a mail using a server with smtp authentication activated and
> that fail, python raise a SMTPAuthenticationError: (535, '#5.7.0
> Authentication failed') and i try to catch like that:
>
>        try:
>             mailer = Mailer(host='smtpserver',
>                 port=25,
>                 username='m...@mail.com',
>                 password='pass')
>         except:
>             return Response('error', content_type='text/plain',
> status_int=500)
> or
>
>        try:
>             mailer.send(message)
>         except:
>             return Response('error', content_type='text/plain',
> status_int=500)
>
> I try to use SMTPAuthenticationError, SMTPResponseException, SMTPException
> imported from smtplib in "except" but a automatic debug page from pyramid
> appear:
>
>
> smtplib.SMTPAuthenticationError
>
> SMTPAuthenticationError: (535, '#5.7.0 Authentication failed')
>
>
> What i doing wrong???
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pylons-discuss/-/zGBYENv2eC8J.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-discuss+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to