chb / indivo_server

The Indivo™ Personally Controlled Health Record
http://indivohealth.org
GNU General Public License v3.0
103 stars 40 forks source link

Message Notifications #8

Closed Bo0m closed 12 years ago

Bo0m commented 12 years ago

As a followup to http://mail.chip.org/pipermail/indivohealth/2012-March/000908.html, I am opening this issue.

I have an email server set up and working; the initial "Activate your Indiohealth account" and "Welcome to Indivohealth" emails send out just fine. To be thorough, here are the email settings from my settings.py: SEND_MAIL = True # Turn email on at all? EMAIL_HOST = "localhost" EMAIL_PORT = 25 EMAIL_FROM_ADDRESS = "Indivo support@indivo.localhost" EMAIL_SUPPORT_ADDRESS = "support@indivo.localhost" EMAIL_SUPPORT_NAME = "Indivo Support"

I tested the message_record API call within Indivo and received a 200 status code as well as the message in my inbox, but no notification email.

My test code is as follows:

client = get_indivo_client(request) record_id = request.session['record_id'] message_id = str(uuid.uuid4())

msgcallresobject = client.message_record(record_id=record_id, message_id=message_id, data={'subject':'Test Message!', 'body':'Test Message', 'num_attachments':'0', 'body_type': 'plaintext'})

msgresponse = msgcallresobject.response msgstatuscode = msgresponse['response_status']

return HttpResponse('Status Code: ' + str(msgstatuscode))

Also, not sure if this is related, but the following appears in the indivo.log as well: 2012-03-19 12:38:39,234 DEBUG oAuth: Consumer chrome Not Found 2012-03-19 12:38:39,285 DEBUG oAuth: Consumer chrome Not Found 2012-03-19 12:38:39,323 DEBUG oAuth: Consumer chrome Not Found 2012-03-19 12:38:39,507 DEBUG oAuth: Consumer chrome Not Found

thisisdhaas commented 12 years ago

Interesting. Try changing SEND_MAIL to False in your settings file, then run it again, paying attention to the output in indivo.log. There should be a log of the email that would have been sent, and the address(es) it would be sent to. Do these check out?

Bo0m commented 12 years ago

I set SEND_MAIL to False and received nothing new in indivo.log To be sure, I reset indivo and re-registered my account before testing again, still nothing when a message is sent.

Here is the output of my indivo.log after resetting: 2012-03-27 12:38:05,248 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:05,296 DEBUG send_mail to set to false, would have sent email to Mark Paone mdp26@njit.edu

Hello Mark Paone

To activate your account, please visit the following link: http://localhost/accounts/mdp26@njit.edu/init/byekRItTJJaahJPo

There you will be asked to enter the confirmation code displayed on the website. If you have lost your confirmation code, you can retrieve it here: http://localhost/accounts/mdp26@njit.edu/send_secret/byekRItTJJaahJPo

If you are having trouble activating your account, you can contact us via email: Indivo Support support@indivo.localhost

2012-03-27 12:38:06,041 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:29,563 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:30,341 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:44,053 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:44,161 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:44,250 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:44,317 DEBUG send_mail to set to false, would have sent email to Mark Paone mdp26@njit.edu

Welcome to Indivo, Mark Paone!

Your account mdp26@njit.edu has been activated. Please choose a username and password so you can login to your account here: http://localhost/accounts/mdp26@njit.edu/init/byekRItTJJaahJPo

If you are having trouble accessing your account, you can contact us via email: Indivo Support support@indivo.localhost

2012-03-27 12:38:45,274 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:45,551 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:45,661 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:45,806 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:53,794 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:53,905 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:53,972 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:54,062 DEBUG oAuth: Consumer chrome Not Found 2012-03-27 12:38:54,292 DEBUG oAuth: Consumer chrome Not Found

thisisdhaas commented 12 years ago

Well, looked in to this a bit more. I think this might be the issue: looks like the appropriate line is commented out! For the life of me, I can't remember why this is the case--maybe an attempt to avoid spamming accounts if an app goes rogue and sends a ton of messages?

Either way, I think we'd rather have the line enabled. If you make a pull request, I'll merge it in.

Bo0m commented 12 years ago

I can confirm this was the issue. Uncommenting account.notify_account_of_new_message() now sends out email notifications. Thanks.