From f7ff2946502aae9b2f4f9b31c92914653ba3320f Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Wed, 17 Jan 2024 23:43:10 +0100 Subject: [PATCH] Workaround SMTP "bare LF" error" --- lib/asciinema/emails/email.ex | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/asciinema/emails/email.ex b/lib/asciinema/emails/email.ex index 696134854..237b4d5aa 100644 --- a/lib/asciinema/emails/email.ex +++ b/lib/asciinema/emails/email.ex @@ -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