Blogging from Vim

With the new “Post by Email” feature from WordPress it is super simple to post directly from Vim. All you need are:

  1. your “secret” email handle for your blog
  2. Vim
  3. an smtp app that accepts cargo on standard input

My choice of smtp app is msmtp . Configuration is a lot simpler than trying to configure a monstrous MTA like exim.

A blast from the past

When you write a new blogpost to be sent from Vim via msmtp you have to format it as an email. i.e. Your file has to start with an email header. In the days of high-powered GUI email-clients this may be a lost artform – so here is the quick and dirty:

Subject: The headline of your post goes here

Important: There must be 2 linefeeds between the “Subject” line and the body of your post.

Once you have finished your oeuvre you can simply “write” it to msmtp with :w ! msmtp -t -a yourmailaccount. The -t switch makes msmtp read the recipient from the “To:” line of the header. The -a switch tells msmtp to send the email via the server specified under yourmailaccount in its runcontrol file (.msmtprc).

Suggested Reading



About dozykraut

Proud member of Hillbilly's on Linux, promoting open source redneckism in remote parts of the Milky Way.
This entry was posted in Web and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s