[ckan-dev] Email Config: SMTPException - SOLVED - Mail on Registration?- SOLVED TOO

Forum forum at hello-web.net
Wed Oct 19 11:50:24 UTC 2016


Dear Lucia,

May I ask you to explain what you did, and how to setup your changes?

I am also looking to send a e-mail when a user register, but I did not 
understand exactetly what do:

https://github.com/espona/ckanext-restricted/blob/master/ckanext/restricted/plugin.py

I can not find ckanext-restricted folder!

Thank a lot
Cheers
Pierre

On 10/17/16 9:23 PM, lucia.espona at wsl.ch wrote:
> Thanks Adria
>
> It worked, in case it helps someone else this is the code: 
> https://github.com/espona/ckanext-restricted/blob/master/ckanext/restricted/plugin.py
>
> Best,
> Lucia
> _________________________________________________________
> Dr. Lucia Espona Pernas
>
> Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> Hauptgebäaude Labortrakt (HL C21)
> Zürcherstrasse 111
> 8903 Birmensdorf
> Switzerland
>
> +41 44 739 28 71 phone direct
> +41 44 739 21 11 reception
>
> www.wsl.ch <http://www.wsl.ch>
>
> -----"ckan-dev" <ckan-dev-bounces at lists.okfn.org> wrote: -----
> To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
> From: Adrià Mercader
> Sent by: "ckan-dev"
> Date: 17.10.2016 12:44
> Subject: Re: [ckan-dev] Email Config: SMTPException - SOLVED - Mail on 
> Registration?
>
> Hi Lucía,
>
> There is nothing built in to send emails after user registration, but
> you can override the user_create action, wrapping the core one and
> sending the email afterwards. Something like this should get you
> started:
>
>
>
> from ckan.lib.mailer import mail_recipient, MailerException
>
> class MyPlugin(...):
>
>     implements(p.IActions)
>
>     def get_actions(self):
>
>         return {'user_create': my_user_create}
>
>
> def my_user_create(context, data_dict):
>
>     user_dict = core_user_create(context, data_dict)
>
>     # Send your email, check ckan.lib.mailer for params
>     try:
>         mail_recipient(name, email, subject, body)
>     except MailerException:
>         log.error(...)
>         pass
>
>
>     return user_dict
>
>
> Hope this helps,
>
> Adrià
>
> On 15 October 2016 at 21:55,  <lucia.espona at wsl.ch> wrote:
> > Dear all,
> >
> > Sorry for the mail, it turned out my SMTP server "really" did not 
> support
> > AUTH and I just needed to comment out the user and password in the 
> config:
> >
> > ## Email settings
> > email_to = envidat at wsl.ch
> > error_email_from = envidat at wsl.ch
> > smtp.server = xxxxx.wsl.ch
> > smtp.starttls = False
> > #smtp.user = envidat at wsl.ch
> > #smtp.password = xxxxxxx
> > smtp.mail_from = envidat at wsl.ch
> >
> > I have another question now, how can I get a mail sent to a particular
> > address every time a new user registers?
> >
> > Thanks,
> > Lucia
> >
> > _________________________________________________________
> > Dr. Lucia Espona Pernas
> >
> > Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> > Hauptgebäaude Labortrakt (HL C21)
> > Zürcherstrasse 111
> > 8903 Birmensdorf
> > Switzerland
> >
> > +41 44 739 28 71 phone direct
> > +41 44 739 21 11 reception
> >
> > www.wsl.ch
> >
> > -----"ckan-dev" <ckan-dev-bounces at lists.okfn.org> wrote: -----
> > To: "CKAN Development Discussions" <ckan-dev at lists.okfn.org>
> > From: lucia.espona at wsl.ch
> > Sent by: "ckan-dev"
> > Date: 15.10.2016 22:17
> > Subject: [ckan-dev] Email Config: SMTPException(
> >
> > Dear all
> >
> > I am trying to set up the SMTP server from my institution so that CKAN
> > Server can send mails.
> > My configuration is following (@ replaced by ' at '):
> >
> > ## Email settings
> > email_to = envidat at wsl.ch
> > error_email_from = envidat at wsl.ch
> > smtp.server = xxxxx.wsl.ch
> > smtp.starttls = False
> > smtp.user = envidat at wsl.ch
> > smtp.password = xxxxxxx
> > smtp.mail_from = envidat at wsl.ch
> >
> >
> > When I try to reset the password (user/reset), it fails to send a 
> mail with
> > the following message:
> >
> > Could not send reset link: SMTPException('SMTP AUTH extension not 
> supported
> > by server.',)
> >
> > Further messages in the console:
> >
> > 2016-10-15 22:14:13,808 DEBUG [ckan.logic] check access OK - 
> request_reset
> > user=
> > 2016-10-15 22:14:13,812 DEBUG [ckan.logic] check access OK - 
> user_show user=
> > 2016-10-15 22:14:13,831 DEBUG 
> [ckan.lib.activity_streams_session_extension]
> > session had no _object_cache or no revision, skipping this commit
> > Traceback (most recent call last):
> >   File
> > 
> "/usr/lib/ckan/default/src/ckan/ckan/lib/activity_streams_session_extension.py",
> > line 52, in before_commit
> >     revision = session.revision
> > AttributeError: 'Session' object has no attribute 'revision'
> > 2016-10-15 22:14:13,842 ERROR [ckan.lib.mailer] SMTPException('SMTP AUTH
> > extension not supported by server.',)
> > Traceback (most recent call last):
> >   File "/usr/lib/ckan/default/src/ckan/ckan/lib/mailer.py", line 80, in
> > _mail_recipient
> >     smtp_connection.login(smtp_user, smtp_password)
> >   File "/usr/lib/python2.7/smtplib.py", line 585, in login
> >     raise SMTPException("SMTP AUTH extension not supported by server.")
> > SMTPException: SMTP AUTH extension not supported by server.
> > 2016-10-15 22:14:13,845 DEBUG [ckan.lib.base] rendering
> > /usr/lib/ckan/default/src/ckan/ckan/templates/user/request_reset.html
> > [jinja2]
> >
> >
> > Is this a CKAN configuration issue or is the STMP server of my 
> institution
> > not compatible? Any hints will be appreciated.
> >
> > Thanks a lot and best regards,
> > Lucia
> >
> >
> >
> >
> > _________________________________________________________
> > Dr. Lucia Espona Pernas
> >
> > Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> > Hauptgebäaude Labortrakt (HL C21)
> > Zürcherstrasse 111
> > 8903 Birmensdorf
> > Switzerland
> >
> > +41 44 739 28 71 phone direct
> > +41 44 739 21 11 reception
> >
> > www.wsl.ch
> > _______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org
> > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> >
> > _______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org
> > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> >
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20161019/2aa31afa/attachment-0003.html>


More information about the ckan-dev mailing list