Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Cleop opened this issue Mar 25, 2019 · 1 comment
Open

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

Cleop opened this issue Mar 25, 2019 · 1 comment

Comments

@Cleop
Copy link
Member

Cleop commented Mar 25, 2019

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("[email protected]")
  |> to(to_email_address)
  |> subject(subject)
  |> html_body(
    EEx.eval_file(
      "<your-file-path>"
    )
  )
end
@Cleop Cleop self-assigned this Mar 25, 2019
nelsonic added a commit that referenced this issue Mar 25, 2019
#124 Adds info on how to use html template in email
@Cleop
Copy link
Member Author

Cleop commented Mar 26, 2019

  • Adding section on how to make email templates responsive

nelsonic added a commit that referenced this issue Mar 26, 2019
#124 Adds section on responsive email templates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant