oficina / memoria Public

Clone
git clone https://amadan.net/oficina/memoria

Plain git — no account needed to clone.

Download

Download this file

1package memoria
2
3import (
4 "log/slog"
5
6 "amadan.net/rastrillo/rastrillo/mail"
7)
8
9// Mailer builds the sign-in sender. Call it only where memoria serves:
10// a CARLOS seed or one-shot runs with no control socket, and the agent
11// strips CARLOS_MAIL from it, so mail.FromCarlos there would refuse
12// once the app is switched to submission.
13//
14// mail.FromCarlos picks submission when CARLOS_MAIL=submit (From
15// CARLOS_MAIL_FROM, the stem of memoria's declared CARLOS_SMTP prefix),
16// else SMTP, and refuses with neither, or with submission half set up.
17// Logged mail is only what LoadConfig admitted:
18// MEMORIA_ALLOW_LOGGED_MAIL with no channel at all.
19func Mailer(config Config, logger *slog.Logger) (mail.Sender, error) {
20 if !config.MailConfigured {
21 return mail.FromEnv("CARLOS", logger), nil
22 }
23 return mail.FromCarlos("CARLOS", logger)
24}
25