【发布时间】:2018-05-07 18:45:37
【问题描述】:
我正在尝试通过电子邮件发送具有 html 变量的模板文件,例如 {{user_name}},html 在我的邮件客户端中正确呈现,但是 {{user_name}} 没有得到解析并显示为字符串 {{user_name}}
- name: Send e-mail to a bunch of users, attaching files
mail:
host: mail.server.com
subtype: html
subject: email template
body: '{{ lookup("file", "roles/binding/templates/email.j2") }}'
to: "{{ user_email }}"
示例输出
Hi {{ user_name }} ....
期望的输出
Hi John Doe
关于如何解决此问题的任何想法?
【问题讨论】: