leafac / kill-the-newsletter

Convert email newsletters into Atom feeds
https://kill-the-newsletter.com
MIT License
2.4k stars 115 forks source link

Switching from sendgrid to existing postfix setup #12

Closed uriel1998 closed 4 years ago

uriel1998 commented 4 years ago

Because reasons, I had KTN set up on a bare-metal machine that also holds my mailserver using Dovecot, Postfix, and procmail. I had everything set up with sendgrid previously, but that's borked now, and I'm excited to see the new version of KTN is setup to be more selfhosted.

What's stopping me is that I'm an amateur, particularly with Ruby, and while I'm sure there's a way to modify your scripts/setup from Exim to use Postfix/Procmail, I don't know enough Ruby or about Exim to quite grasp where you're pulling the data from to route it elsewhere.

Are you familiar enough with postfix and procmail to give me some insight on where to start poking here to get it to work with my existing setup?

Thanks!

leafac commented 4 years ago

Hey, thanks for reaching out. You’re first person I know who runs their own instance of Kill the Newsletter!

The Ruby script expects the email to come in the standard input. I configured Exim so that it calls the Ruby script with a so-called pipe delivery method. You can try to Google for something like “ postfix/dovecot pipe mail to script”.

The Ruby script expects the email to include some headers with information about who sent the message, and the delivery time. In Exim you have to tell it to add those headers, but I don’t know what Postfix/Dovecot do there.

Also, because I didn’t know of anyone deploying their own instances, I didn’t bother to make this latest Ruby version configurable like that. You’ll have to find and modify places where I hard-coded things, for example, here.

Good luck and let me know how it goes.