跳转到主要内容

用于使用Django发送基于模板的电子邮件的Pythonic实用工具。

项目描述

Incuna Mail 构建状态 覆盖率状态 轮状态 最新版本

用于使用Django发送基于模板的电子邮件的Pythonic实用工具。

安装

安装此软件包

pip install incuna_mail

用法

导入send函数并调用它

from incuna_mail import send

send(
    to='foo@example.com',
    subject='Example email',
    template_name='plaintext_email.txt',
)

支持ccbcc...

send(
    to='foo@example.com',
    cc='bar@example.com',
    bcc='baz@example.com',
    ...
)

...收件人列表...

send(
    to=['foo@example.com', 'bar@example.com'],
    cc=['spam@example.com', 'eggs@example.com'],
    ...
)

...多部分电子邮件...

send(
    ...
    template_name='plaintext_email.txt',
    html_template_name='html_email.html',
)

...模板上下文...

send(
    ...
    context={'user': user},
)

...模板列表...

send(
    ...
    # Uses the first template found.
    template_name=['might-exist.html', 'will-exist.html'],
)

...回复地址...

send(
    ...
    reply_to=['another@example.com'],
)

...以及自定义电子邮件标题

send(
    ...
    headers={'Extra-Header': 'This will appear among the email headers'}
)

可以通过 settings.DEFAULT_FROM_EMAIL 全局设置电子邮件发送者,默认为 settings.SERVER_EMAIL。如果需要,可以在每次调用中显式设置

send(
    ...
    sender='eggy-mcspambot@example.com',
)

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码分发

incuna-mail-4.1.1.tar.gz (3.6 kB 查看哈希值)

上传时间 源代码

构建分发

incuna_mail-4.1.1-py2.py3-none-any.whl (3.8 kB 查看哈希值)

上传时间 Python 2 Python 3

由支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面