/tinyletter

The Programs of the Sophomore Slump Week

This Week’s Program: Oct 5 - Oct 9

This week, email was on my mind. I’m fascinated with TinyLetter. Not just because it facilitates a new (old) form of creative expression. It’s also because the systems that make email happen are neat. Having spent nearly my entire career speaking HTTP to different computers, it was time to try a new protocol: SMTP.

The goal for this week’s code was simple: Send this TinyLetter email programmatically.

Here are the major commits from this week to make that happen:

emacs.d: 007c9c46aeddddfe3a634ccf396873bc2b429cba

I set up Emac’s Message mode to send mail through my SMTP server. Now I can just type C-x m to pull up a compose mail buffer while in Emacs. Every time I do something that seems so typically Emacs-ian, I can’t help but feel a sense of triumph.

mwunsch.github.io: a402cbbcad1a1939ac362a49e85240764b30c868

Buoyed by my ability to send mail from Emacs, it was time to send email from my blog. In last week’s letter I referenced how I publish blog posts from GitHub pages to Tumblr in a git pre-commit hook (cf. Tumblelog POSSE). I wanted to do the same thing with this TinyLetter. I think TinyLetter is neat, but I’d love to own my work and publish it wherever and however I see fit thankyouverymuch. This commit starts the work of setting up a Ruby Net::SMTP connection.

This code uses the netrc gem to extract credentials for my SMTP server from my ~/.authinfo file. This is the same file that Emacs uses to find those same SMTP credentials.

mwunsch.github.io: 3af36ecc5772a7f17596299c34589e0c85a94d6e

Finishing out this functionality. I look for the special TinyLetter address in my ENV and compose a message from a categorized Jekyll blog post. I had fun learning how to generate Message IDs by implementing this recommendation.

If all goes well with this code, when I try to do a git push, you’ll see this in your inbox! (Though it will likely be some plain-text markdown.)

Next week, I think I’m going to focus on making this email look good. Until then, follow me on Twitter and GitHub. Maybe more of my code subtweets will end up cited in Today in Tabs.

Your pal, Mark