I am working on app in elixir
. It sends email to clients. I am using bamboo
library for sending emails.
So far, emails are working fine. But now, I am trying to send emails using templates.
Everywhere i see in the bamboo documentation is using
bamboo.phoenix
.
I am not using phoenix
for handling requests. I am using a library called plug
. Is there a way to send templates in email without phoenix
??
Adding answer to this post with the help @JustMichael comment.
Directory structure -
/priv
/static
/test.html.eex
Function used :
new_email
|> to("[email protected]")
|> 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>
But , we cannot add css just by adding <link rel="stylesheet" href="styles.css">
. I guess, There is a need for static server.
Do comment if there is another way to add css apart from inline css.