Skip to content

Commit

Permalink
Workaround SMTP "bare LF" error"
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Jan 17, 2024
1 parent 9600846 commit f7ff294
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions lib/asciinema/emails/email.ex
Expand Up @@ -5,21 +5,27 @@ defmodule Asciinema.Emails.Email do
def signup_email(email_address, signup_url) do
hostname = instance_hostname()

base_email()
|> to(email_address)
|> subject("Welcome to #{hostname}")
|> render("signup.text", signup_url: signup_url, hostname: hostname)
|> render("signup.html", signup_url: signup_url, hostname: hostname)
email =
base_email()
|> to(email_address)
|> subject("Welcome to #{hostname}")
|> render("signup.text", signup_url: signup_url, hostname: hostname)
|> render("signup.html", signup_url: signup_url, hostname: hostname)

%{email | text_body: String.replace(email.text_body, "\n", "\r\n")}
end

def login_email(email_address, login_url) do
hostname = instance_hostname()

base_email()
|> to(email_address)
|> subject("Login to #{hostname}")
|> render("login.text", login_url: login_url, hostname: hostname)
|> render("login.html", login_url: login_url, hostname: hostname)
email =
base_email()
|> to(email_address)
|> subject("Login to #{hostname}")
|> render("login.text", login_url: login_url, hostname: hostname)
|> render("login.html", login_url: login_url, hostname: hostname)

%{email | text_body: String.replace(email.text_body, "\n", "\r\n")}
end

def test_email(email_address) do
Expand Down

0 comments on commit f7ff294

Please sign in to comment.