A Django reusable app to send email with postmark, as well as models and views to handle bounce integration.
项目描述
django-postmark是一个可重用的应用程序,包含用于通过Django发送电子邮件的EmailBackend以及模型和视图,用于实现与Postmark弹跳钩子API的集成。
安装
您可以使用pip通过输入以下命令安装django postmark:
pip install django-postmark
或者通过easy_install输入以下命令:
easy_install django-postmark
或者手动下载tarball并输入以下命令:
python setup.py install
安装完成后,将postmark添加到您的INSTALLED_APPS并运行
python manage.py syncdb
如果您正在使用south
python manage.py migrate
Django配置
如果您想将django-postmark用作默认的后端,您应该在settings.py中添加以下内容:
EMAIL_BACKEND = "postmark.backends.PostmarkBackend"
设置
django-postmark添加了1个必需设置和2个可选设置。
- 必需
指定您的Postmark服务器的API密钥。
POSTMARK_API_KEY = 'POSTMARK_API_TEST'
- 可选
指定视图所需的用户名和密码,该视图将通过基本认证传递。(http://exampleuser:examplepassword@example.com/postmark/bounce/)
POSTMARK_API_USER = "exampleuser" POSTMARK_API_PASSWORD = "examplepassword"
Postmark Bounce Hook
Postmark具有可选功能,可以在发送的消息弹跳时向URL发送POST请求。django-postmark附带一个urlconf和视图用于此目的。如果您想使用此功能,请添加以下内容:
url(r"^postmark/", include("postmark.urls")),
将此代码添加到您的根urls.py文件中。这将使您的跳转钩子位置位于/postmark/bounce/。然后,只需在Postmark设置中添加URL(如果设置了POSTMARK_API_USER/PASSWORD,则指定用户名和密码)即可,Django将接受来自Postmark的POSTS,通知它有新的跳转。
项目详情
django-postmark-0.1.6.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 1707f15adf096f76579f97554761e74468630aba40df4a4592659ee3bcfc709d |
|
MD5 | 63cd52f48e966562521680b22b5326fd |
|
BLAKE2b-256 | 946f34e5ff36eabeee286d0fe029e72f84b51b1a352906244474bd4172543ecc |