mail based rss feed aggregator
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

add `smtp.sender_email` and `smtp.one_time_password_email`

ollie 06c3ffc5 045e1923

+27 -1
+27 -1
src/eater/smtp.gleam
··· 37 37 option.Some(#(environment.username, environment.password)), 38 38 message 39 39 |> message.set_from( 40 - environment.sender_email |> option.unwrap(environment.username), 40 + sender_email(environment), 41 41 sender_name: environment.sender_name 42 42 |> option.unwrap("ollies RSS aggregator") 43 43 |> option.Some, ··· 70 70 ) 71 71 } 72 72 73 + /// generate the `one time password` email 74 + /// 75 + pub fn one_time_password( 76 + email email: String, 77 + one_time_password one_time_password: String, 78 + ) -> message.Message { 79 + message.build() 80 + |> message.set_subject("Your one time password") 81 + |> message.add_recipient(email, message.To) 82 + |> message.set_html( 83 + html.html([], [ 84 + html.body([], [ 85 + html.h1([], [html.text("Your one time password")]), 86 + html.p([], [html.text(one_time_password)]), 87 + ]), 88 + ]) 89 + |> element.to_readable_string, 90 + ) 91 + } 92 + 73 93 // environment ------------------------------------------------------------------ 74 94 75 95 pub type SmtpEnvironment { ··· 81 101 sender_email: Option(String), 82 102 sender_name: Option(String), 83 103 ) 104 + } 105 + 106 + /// get the sender email 107 + /// 108 + pub fn sender_email(environment: SmtpEnvironment) { 109 + environment.sender_email |> option.unwrap(environment.username) 84 110 } 85 111 86 112 /// get the smtp_environment from the environment variables