我正在尝试使用事务模板 sendgrid 发送电子邮件。
我可以发送一封简单的邮件。
from_email = Email("useremail@gmail.com")
subject = "Welcome"
to_email = Email("toemail@gmail.com")
content = ("text/plane","Text here")
mail = Mail(from_email, subject, to_email, content)
我创建了一个模板,我想用它来发送电子邮件。我怎样才能做到这一点?
我正在使用 template_id 参数并通过 Mail(),但它不起作用。
template_id = "13b8f94f-bcae-4ec6-b752-70d6cb59f932"
我检查了具有 self._template_id 参数的类 Mail(object) 。Mail() 类中的字段如下:
if self.template_id is not None:
mail["template_id"] = self.template_id
我在这里想念什么?
我只想使用我创建的模板发送邮件。