使用没有凤凰的竹子的电子邮件模板
Email templates using bamboo without phoenix
我正在 elixir
开发应用程序。它向客户发送电子邮件。我正在使用 bamboo
库发送电子邮件。
到目前为止,电子邮件工作正常。但是现在,我正在尝试使用模板发送电子邮件。
我在 bamboo 文档中看到的所有地方都在使用
bamboo.phoenix
.
我没有使用 phoenix
来处理请求。我正在使用一个名为 plug
的库。有没有办法在没有 phoenix
的情况下通过电子邮件发送模板??
在 @JustMichael 评论的帮助下添加对此 post 的回答。
目录结构 -
/priv
/static
/test.html.eex
使用的函数 :
new_email
|> to("vivek29vivek@gmail.com")
|> from(@from_email)
|> subject("test")
|> html_body(EEx.eval_file("priv/static/mail_templates/#test.html.eex",[foo: "bar"])) //this will render the template.Also can pass variables
test.html.eex
<h3>Foo: <%= foo %></h3>
但是,我们不能仅通过添加 <link rel="stylesheet" href="styles.css">
来添加 css。我想,需要静态服务器。
如果除了内联 css.
还有另一种添加 css 的方法,请发表评论
我正在 elixir
开发应用程序。它向客户发送电子邮件。我正在使用 bamboo
库发送电子邮件。
到目前为止,电子邮件工作正常。但是现在,我正在尝试使用模板发送电子邮件。
我在 bamboo 文档中看到的所有地方都在使用
bamboo.phoenix
.
我没有使用 phoenix
来处理请求。我正在使用一个名为 plug
的库。有没有办法在没有 phoenix
的情况下通过电子邮件发送模板??
在 @JustMichael 评论的帮助下添加对此 post 的回答。
目录结构 -
/priv
/static
/test.html.eex
使用的函数 :
new_email
|> to("vivek29vivek@gmail.com")
|> from(@from_email)
|> subject("test")
|> html_body(EEx.eval_file("priv/static/mail_templates/#test.html.eex",[foo: "bar"])) //this will render the template.Also can pass variables
test.html.eex
<h3>Foo: <%= foo %></h3>
但是,我们不能仅通过添加 <link rel="stylesheet" href="styles.css">
来添加 css。我想,需要静态服务器。
如果除了内联 css.