dwyl / dwyl/learn-phoenix

Sending Emails using Amazon SES example: adding html to an email

Open
#124 1 comment 0 reactions 1 assignee Claimed by @Cleop View on GitHub
awaiting-review enhancement
Dominant language
No language data
Stars
664
Forks
41
PR merge metrics
No merged PRs in 30d

Description

I would like to add the following section:

### Adding Html to an email

If you want to style your emails you need to be able to add html and then use inline css.
To do this simply use `html_body()` instead of `text_body()`. Then add your html
as your argument.

If you've got lots of html to add you may prefer to add a html template. To do
this use `html_body()` but instead of using your html as your argument you want
to provide your file path within `EEx.eval_file()` so it would end up looking
something like this:

```
def send_html_email(to_email_address, subject) do
new_email()
# also needs to be a validated email
|> from("example@dwyl.com")
|> to(to_email_address)
|> subject(subject)
|> html_body(
EEx.eval_file(
""
)
)
end
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.