有人使用Django herald发送通知吗
我已经努力了好几天让它工作起来,但是缺少文档和无声的失败使得调试问题变得不可能。如果我在邮件中添加附件,邮件似乎就不会被发送
from herald.base import EmailNotification
def sendMail():
SendThisMail(user, my_modal).send(user=my_user) # creates an error on this line as the file object is closed and inaccessible.
@registry.register_decorator()
class SendThisMail(SomeBaseClass, EmailNotification):
def __init__(self, user, my_modal: models.MyModal):
super().__init__(user, my_modal)
self.subject = "abc"
file = open('.staticfiles/assets/some.pdf', 'rb')
self.attachments = [('attachment_1', File(file))]
self.context = {
**self.context,
'subject': self.subject,
'attachment': self.attachments,
}
self.to_emails = [user.email]
怎么了
从项目文档中:
因此,代码的相关部分应该是:
相关问题 更多 >
编程相关推荐