跳转到主要内容

与guillotina集成的Mailer

项目描述

guillotina_mailer

配置

config.json可以包含Mailer部分

"applications": ["guillotina_mailer"],
"mailer": {
  "default_sender": "foo@bar.com",
  "endpoints": {
    "default": {
      "type": "smtp",
      "host": "localhost",
      "port": 25
    }
  }
}

打印Mailer

对于开发/调试,您可以使用控制台打印Mailer

"applications": ["guillotina_mailer"],
"mailer": {
  "default_sender": "foo@bar.com",
  "endpoints": {
    "default": {
      "type": "smtp",
      "host": "localhost",
      "port": 25
    }
  },
  "utility": "guillotina_mailer.utility.PrintingMailerUtility"
}

发送邮件

POST http://localhost:8080/zodb/container/@mailer

{
  "sender": "foo@bar.com",
  "recipient": "john@doe.com",
  "subject": "Some subject",
  "text": "Hello"
}

权限

guillotina_mailer 定义了一个权限 mailer.SendMail,默认情况下,只有 guillotina.ContainerAdmin 角色被分配。

在代码中使用Mailer

您也可以直接在代码中使用Mailer

from guillotina.component import queryUtility
from guillotina_mailer.interfaces import IMailer
mailer = queryUtility(IMailer)
await mailer.send(recipient='john@doe.com', subject='This is my subject', text='Body of email')

1.1.3 (2019-06-18)

  • 限制guillotina版本

1.1.2 (2018-11-21)

  • 添加用户名和密码选项[bloodbare]

1.1.1 (2018-11-15)

  • 修复获取空设置[vangheem]

1.1.0 (2018-09-17)

  • 使用可重试的异步队列发送电子邮件[vangheem]

1.0.5 (2018-09-12)

  • 修复测试[vangheem]

1.0.4 (2018-09-12)

  • 修复队列[vangheem]

1.0.3 (2018-09-12)

  • 修复以与最新guillotina兼容[vangheem]

1.0.2 (2017-04-13)

  • 注册smtp端点[vangheem]

1.0.1 (2017-04-10)

  • 移除对repoze.sendmail和transaction的依赖[vangheem]

  • 测试Mailer未提供正确的签名[vangheem]

1.0.0 (2017-04-04)

  • 从guillotina_mailer迁移初始版本

项目详情


下载文件

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

源分布

guillotina_mailer-1.1.3.tar.gz (6.8 kB 查看散列值)

上传时间

由以下支持