And one more question... Please let me know if this would be more appropriate at Stackoverflow (or somewhere else again).
I'm having a bit of trouble getting a spirit instance to send emails. (Apparently setting up email is a bit of a hurdle for novices.) I did some Postmark configuation in the site's settings.py file like this.
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'POSTMARK_API_KEY = os.environ['POSTMARK_API_KEY']POSTMARK_SENDER = 'email@example.com'POSTMARK_TEST_MODE = FalsePOSTMARK_TRACK_OPENS = FalseDEFAULT_FROM_EMAIL = POSTMARK_SENDERSERVER_EMAIL = POSTMARK_SENDER
On the local server, the registration emails, etc., now go out fine. (Though this seemed to require changing the def sender(...) in utils/user/email.py so that "site" refers to "example.com" rather than to the result of get_current_site(request).)
Also, after deploying to heroku and running python there, I can send emails using send_mail(...) after importing settings from django.config and send_mail from django.core.mail.
When I load the forum in a browser and try to send activation email, the next page says to expect a message as usual. But the message doesn't show up, and the Postmark site doesn't register that it was sent.
Sorry if this is not quite the place for the novice technical query.
You probably need the Postmark Heroku Add-on.
It looks as though the Postmark add-on is already installed. At least, running "heroku addons:add postmark" gives "That add-on plan is already installed". When I do
heroku run python
from django.config import settingsfrom django.core.mail import send_mailsend_mail('test from heroku','body',settings.DEFAULT_FROM_EMAIL,['firstname.lastname@example.org'],fail_silently=False)
then the Postmark server sends the message. It's just when I request the activation message at e.g.
that it isn't sent.
Just regarding the third link above: is the idea to replace the spirit user registration system with that provided by the django-registration package? Or do these work together? (Sorry if that is a silly question.)
You need to follow instructions from a second link, e.g.https://devcenter.heroku.com/articles/postmark#sending-emails-in-python
Or try to install and configure Django Postmark:https://github.com/dstufft/django-postmark
There is a try ... except block around the send() call in utils.user.email.sender(), so if there is an error is being logged to nowhere, since you won't receive an email in case of exceptions (coz your email backend doesn't work ). You may try logging errors to a file by changing the settings.LOGGING setting, or remove the try ... except block, so you can see the traceback in the browser (set DEBUG=True first).
I'd set up Python-Postmark (following the instructions on that page, https://devcenter.heroku.com/articles/postmark#sending-emails-in-python). And it seems to work, in the heroku installation of the django site. Just the darn registration emails. Well, I'll futz around a little more, maybe try swapping the auth system. Thanks again,