@@ -55,21 +55,26 @@ defmodule Algora.Mailer do
5555
5656 def text_template ( template_params ) do
5757 """
58-
5958 ==============================
6059
6160 #{ text_sections ( template_params ) }
6261
63- Algora - https://algora.io/
64-
6562 ==============================
6663 """
6764 end
6865
6966 defp text_sections ( template_params ) do
7067 template_params
71- |> Keyword . values ( )
72- |> Enum . join ( "\n \n " )
68+ |> Enum . map ( fn { type , value } -> text_section ( type , value ) end )
69+ |> Enum . intersperse ( "\n \n " )
70+ end
71+
72+ defp text_section ( :cta , % { href: href } ) do
73+ ~s| #{ href } |
74+ end
75+
76+ defp text_section ( _ , value ) do
77+ value
7378 end
7479
7580 defp html_sections ( template_params ) do
@@ -96,13 +101,19 @@ defmodule Algora.Mailer do
96101 html_section_by_type ( type , value ) <> ~s| </p>|
97102 end
98103
104+ defp html_section_by_type ( :cta , % { href: href , src: src } ) do
105+ ~s| <a href="#{ href } " style="word-break: break-all; word-wrap: break-word;">| <>
106+ ~s| <img src="#{ src } " style="width: 100%; height: auto;">| <>
107+ ~s| </a>|
108+ end
109+
99110 defp html_section_by_type ( :url , value ) do
100- ~s| <a href="#{ value } " style="word-break: break-all; word-wrap: break-word; color: #727cf5; ">| <>
111+ ~s| <a href="#{ value } " style="word-break: break-all; word-wrap: break-word;">| <>
101112 value <> ~s| </a>|
102113 end
103114
104115 defp html_section_by_type ( :img , value ) do
105- ~s| <img src="cid: #{ value } " style="width: 100%; height: auto;">|
116+ ~s| <img src="#{ value } " style="width: 100%; height: auto;">|
106117 end
107118
108119 defp html_section_by_type ( _ , text ) do
0 commit comments