Microservice to bring 2FA to self hosted PDSes

Add support for sending emails with local Sendmail #6

open
opened by mackuba.eu targeting main from mackuba.eu/pds-gatekeeper: sendmail

I've run into a few problems trying to run Gatekeeper on my PDS. One thing is that I don't use SMTP for sending emails, but a local sendmail service (postfix).

I have it configured like this in pds.env (this is what Nodemailer accepts):

PDS_EMAIL_SMTP_URL=smtp:///?sendmail=true

But Gatekeeper didn't like it:

Error: lettre::transport::smtp::Error { kind: Connection, source: "smtp host undefined" }

I found that lettre supports sendmail, but with a separate SendmailTransport class: https://docs.rs/lettre/latest/lettre/transport/sendmail/index.html

With the help of my good friend GPT, I managed to make it work (the emails are sending) - it added a Mailer wrapper that has a send(msg) method which forwards to either AsyncSmtpTransport or AsyncSendmailTransport. I have no idea if this is how it should be done or how you'd want to do it, but I'm just giving you a starting point :)

0
by mackuba.eu 0 comments
expand 1 commit
added support for sending emails with sendmail
merge conflicts detected
  • Cargo.lock:84
  • Cargo.toml:22
  • src/main.rs:36
sign up or login to add to the discussion
Labels

None yet.

Participants 1
AT URI
at://did:plc:oio4hkxaop4ao4wz2pp3f4cr/sh.tangled.repo.pull/3magmui36pc22