maniero.me

My personal blog - the place I talk about development and my frustrations


1 Email as comments backend

This is a static blog, and static blogs usually lakes comments because a backend is needed to do so. Or when available it mostly uses some solution that involves adding a 3rd-party javascript file that communicate with some sort of platform.

But if you had the chance to check my comments section you will see that it requests you to send an email to myself with a specific title.

And the entire comment system is build on top of two Perl scripts.

1.1 Categorization

The first script, receives the post title, and check my INBOX to see if there is any comment there. Look how simple it is:

$imap->select('INBOX');

foreach my $post (@ARGV) {
  my $folder = $post;
  $folder =~ s/ /-/g;
  $folder =~ s/[^a-zA-Z0-9-]//g;
  $folder = "INBOX.blogpost." . $folder;

  my $messages = $imap->search({SUBJECT => 'blogpost: ' . $post}, 'DATE');

  $imap->create_folder($folder);
  $imap->copy(\@$messages, $folder);

  $imap->delete_message(\@$messages, '\\Deleted');
  $imap->expunge();
}

It just copy comments to a specific holder.

1.2 Displaying

There are another script, that fetch email from the create folder, and display renders them in HTML.

And cron job runs every a couple of minutes to repeat this process and build this static HTML.

1.3 Why I love this so much?

I’m really happy with the results and there are a couple of reasons why:

Spam filter

My email has a spam filter so I don’t need to worry about it.

No login required

You don’t need to create an account anywhere to comment. You just need an email.

Notifications

I don’t need to have a system to notify you if someone replied your comment, people will send a reply email, so, you will know.

Moderation

I can moderate the comments by just deleting an email.

Cheap

It was both cheap to implement and to maintain, once I already pay for may email server (which could even be free).


Subscribe to my mailing list

Get notified when a new post is released.

Send an email to carlos@maniero.me with the subject 'blog: subscribe' or click here if your browser supports mailto.

Unsubscribe

I'm sorry you wanna leave :(

Send an email to carlos@maniero.me with the subject 'blog: unsubscribe' or click here if your browser supports mailto.


Commments:

Add a comment

Send a plain-text email using this link link if your browser/OS supports mailto.

Alternatively, send an email using your email client as bellow:

To:Subject:
carlos@maniero.meblogpost: Email as comments backend

It may take a few minutes to this page to be updated.

Note: Comments submitted via email will be publicly available on the blog.

Comments updated at: 2025-06-06 23:47:20 UTC

There is no comment yet. Be the first one!