[ckan-dev] Trouble setting up email notifications

Stéphane Guidoin stephane at opennorth.ca
Wed Mar 12 23:37:25 UTC 2014


It seems correct...

First thing: check if your email configuration is working. Try to follow
the process to reset your password, just to make sure that mail is working
as supposed. If you don't receive the password reset email, it means you
have an issue there.

Second:
- In order to trigger the mail notif, you need 2 users: the user doing the
changes, the user notified. A user is not notified for changes he has done.
The notified user must follow the group or dataset where changes are done.
- The notified user should not open its dashboard (where he is notified of
all the activities). Once an activity has been seen in the dashboard, no
mail is triggered... because the user already knows about it.

When you call the notification trigger and that a mail is sent, you should
see the following in your log (the error log, not the access log:

[Wed Mar 12 19:28:53 2014] [error] 2014-03-12 19:28:53,893 INFO
 [ckan.lib.mailer] *Sent email to my.user at gmail.com <my.user at gmail.com>*
[Wed Mar 12 19:28:54 2014] [error] 2014-03-12 19:28:54,460 INFO
 [ckan.lib.base]  /api/action/send_email_notifications render time 1.853
seconds

Steph


On Wed, Mar 12, 2014 at 5:39 PM, Justin Lewis <jlewis at drcog.org> wrote:

>  Good catch on the "success".  It's still not working though.  Just to
> make sure it wasn't a lack of data I "followed" an organization and added a
> dataset through that organizations user.  I also have the box checked for
> "Subscribe to notification emails" in the admin account.   This created a
> red alert when I logged back in as admin and I can see the update in the
> News Feed. However, when i run the curl request I get these errors/messages
> in the log and no emails:
>
>
>
> *ckan_default.error.log:*
>
>     [Wed Mar 12 15:02:28 2014] [error] 2014-03-12 15:02:28,767 INFO
> [ckan.lib.base] /api/action/send_email_notifications render time 0.629
> seconds
>
>
>
> *ckan_default.custom.log:*
>
>     127.0.0.1 - - [12/Mar/2014:15:02:28 -0600] "POST
> /api/action/send_email_notifications HTTP/1.0" 200 676 "-" "curl/7.22.0
> (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4libidn/1.23 librtmp/2.3"
>
>
>
> I am able to ping the mail server (exchange.drcog.org) from the server.
>
>
>
>
>
> *These are my email and activity stream settings in the .ini:*
>
>
>
> ckan.activity_streams_enabled = true
>
> #ckan.activity_list_limit = 31
>
> ckan.activity_streams_email_notifications = true
>
> ckan.email_notifications_since = 2 days
>
>
>
> email_to = support at drcog.org
>
> error_email_from = support at drcog.org
>
> smtp.server = exchange.drcog.org
>
> smtp.starttls = True
>
> smtp.user = support at drcog.org
>
> smtp.password = <my-password>
>
> smtp.mail_from = support at drcog.org
>
>
>
>
>
>
>
> Thanks,
>
>
>
> Justin
>
>
>
> *From:* ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] *On Behalf Of *Stéphane
> Guidoin
> *Sent:* Wednesday, March 12, 2014 1:02 PM
>
> *To:* CKAN Development Discussions
> *Cc:* Jeff Socia
> *Subject:* Re: [ckan-dev] Trouble setting up email notifications
>
>
>
> You're reading too fast: you're not getting an error... you're getting a
> success:  ... "success": true, ...
>
>
>
> :)
>
>
>
> Look at your server logs to see if there is an error or a success
> message... or nothing. If you have nothing in your logs, it means you have
> no notification that needs to be sent.
>
>
>
> On Wed, Mar 12, 2014 at 2:55 PM, Justin Lewis <jlewis at drcog.org> wrote:
>
> Ohh yes... I forgot to mention that I configured the .ini file.
>
>
>
> I added the empty dictionary param and now I'm simply getting an
> authorization error:
>
>
>
> curl http://localhost/api/action/send_email_notifications  -H
> "X-CKAN-API-Key:<my-api-key>" -d '{}'
>
> {"help": "Send any pending activity stream notification emails to
> users.\n\n    You must provide a sysadmin's API key in the Authorization
> header of the\n    request, or call this action from the command-line via a
> `paster post ...`\n    command.\n\n    ", "success": true, "result": null}
>
>
>
> The api key was taken from the admin account page.
>
>
>
> I think I remember reading somewhere in the docs about needing to enable
> authorization on the server... Could this be an issue?
>
>
>
> Thanks for your help!
>
>
>
> Justin
>
>
>
> *From:* ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] *On Behalf Of *Stéphane
> Guidoin
> *Sent:* Wednesday, March 12, 2014 12:31 PM
> *To:* CKAN Development Discussions
> *Cc:* Jeff Socia
> *Subject:* Re: [ckan-dev] Trouble setting up email notifications
>
>
>
> Hey Justin,
>
>
>
> When posting a request to the email trigger via the API, you have to post
> an empty dictionnary.
>
>
>
> So with curl the command should look like that:
>
> curl http://my.domain/api/action/send_email_notifications  -H
> "X-CKAN-API-Key:ae475a5a-6a9f-4800-9e2d-x338847r" *-d '{}'*
>
>
>
> Also: did you configure all the SMTP stuff in the .ini?
>
>
>
> Even though it does not look interesting, please post any error you see,
> either in curl or in your web server error log.
>
>
>
> Steph
>
>
>
>
>
>
>
>
>
>
>
> On Wed, Mar 12, 2014 at 12:33 PM, Justin Lewis <jlewis at drcog.org> wrote:
>
> Hi,
>
>
>
> I'm trying to get e-mail notifications setup for a local CKAN instance and
> having some trouble.
>
>
>
> While trying to run the '/api/action/send_email_notifications' request
> through the terminal I get errors like this "Bad request - JSON Error: No
> request body data".  I have tried:
>
> 1.       sending as simple http request through a browser
>
> 2.       sending as a curl request - 'curl
> http://geodataportaldev/api/action/send_email_notifications -H
> "Authorization:my-api-key"'
>
> 3.       sending as a paster request as outlined in the docs  -  echo
> '{}' | /usr/lib/ckan/default/bin/paster --plugin=ckan post -c
> /etc/ckan/default/production.ini /api/action/send_email_notifications
>
> a.       ensuring that the paths are correct to production.ini in the
> paster request
>
> 4.       adding authorization (api_key) to all variations of the request
>
> 5.       ensured email notifications where enabled and sending to a valid
> email
>
> 6.       ensured there where recent changes to data that would trigger an
> email
>
>
>
> I'm unsure where to go from here.  If anyone has a working example of a
> request this could be helpful to make sure that I am getting the syntax
> correct.  Otherwise I am seeing little useful info in regards to log
> errors.
>
>
>
>
>
> *Thank You,*
>
>
>
>
>
> *Justin Lewis *| Software Developer | *Administration and Finance*
>
> *Direct* *303-480-6750 <303-480-6750>* | *Fax* *303-480-6790
> <303-480-6790> *| *jlewis at drcog.org <jlewis at drcog.org>*
>
>
>
> *[image: 2011-DRCOG-New-Email-Signature3]* <http://www.drcog.org/>
>
>
>
>
>
> [image: cid:image006.png at 01CF1D91.CA58BBB0]<http://www.denverregionalequityatlas.org/>
>
> *Check out the* *new* *interactive **Regional Equity Atlas*<http://denverregionalequityatlas.org/>*:
> **Mapping *
>
> *opportunity on a regional scale from a local perspective. *
>
>
>
> *[image: facebook]*<http://www.facebook.com/Denver.Regional.Council.of.Governments>
> *[image: twitter]* <https://twitter.com/DRCOGorg>   [image: linkedin]<http://www.linkedin.com/company/denver-regional-council-of-governments?trk=cp_followed_name_denver-regional-council-of-governments>
>
>
>
>
> _______________________________________________
> 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
>
>
>
>
>
> --
>
> Stéphane Guidoin
>
> Director, Transportation
> Open North
>
> 514-862-0084
>
> http://opennorth.ca
>
> Twitter: @opennorth / @hoedic
>
> _______________________________________________
> 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
>
>


-- 
Stéphane Guidoin
Director, Transportation
Open North
514-862-0084
http://opennorth.ca
Twitter: @opennorth / @hoedic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140312/84910c8c/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 8239 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140312/84910c8c/attachment-0003.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 7178 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140312/84910c8c/attachment-0012.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 2770 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140312/84910c8c/attachment-0013.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 2696 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140312/84910c8c/attachment-0014.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 1830 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140312/84910c8c/attachment-0015.png>


More information about the ckan-dev mailing list