HomeThe Old Onesv8 Website Redesign

Setting Up an Email Based Feedback System.

Published: | Updated:

While I want feedback on my posts, I couldn’t be bothered to set up a commenting system for three reasons.

  1. I want to boast about how fast my website is, part of which is doing away with “unecessary” bloat. I consider comments to be part of said bloat. since I have to include a js-based library.
  2. I’m too lazy and broke to set up a proper commenting system.
  3. I’m unwilling to do proper moderation. Ironic considering that I want to launch a YouTube channel, but that leads to my next point.
  4. I want this website to be slow unlike the fast pace of social media.

So instead of setting up comments, I’ve decided to implement an email-based feedback system. Here’s how.

1. Aliasing My Email For Feedback

Most web hosts support aliasing email with something like account+Folder@example.com. It’s great for sorting out emails and finding out which service shared your email with marketers.

Since I use Fastmail with my own domain, I have the benefit of setting up and alias without the +Folder, letting me add up to 600 email aliases that go into various folders. For feedback, I created an address gandiyafarai+feedback@gmail.com which resolved to the+gandiyafarai+feedback@gmail.com that directs emails to the folder Feedback.

2. Adding A Prepopulated Email

I wanted to add a simple link that would allow someone to quickly send feedback. Basically, you need to do something like this

<a href="mailto:<email>?subject=<subject>&body=<body>">send me feedback</a>

Note that the subject and body need to be URI encoded.

Here’s how I implemented this using Hugo, a Go-based static site generator. At the end of each post, there’s something like this

Thanks for reading this post. If you want to send me some feedback, send an email to gandiyafarai+feedback at gmail dot com. Don’t forget to mention the post you’re refering to!

To make something like that in Hugo, I configured the single.html file (the template responsible for the blog posts on this site). Like this

<a href="mailto:gandiyafarai+feedback@gmail.com?subject={{ .Title }}&body={{ printf "Concerning: %s\n\nThanks for the great article! I know you put words in my mouth by populating this email for me, but I totally thought you wrote something great!" .Permalink }}">send an email to gandiyafarai+feedback at gmail dot com</a>

The default body is rather contrived but ¯\(ツ)/¯, you can change it and tell me how you really feel1.

This results in output that looks something like this.

<a href="mailto:gandiyafarai+feedback@gmail.com?subject=Setting%20Up%20an%20Email%20Based%20Feedback%20System.&body=Concerning%20Setting%20Up%20an%20Email%20Based%20Feedback%20System.%3a%0a%0aThanks%20for%20the%20great%20article%21%20I%20know%20you%20put%20words%20in%20my%20mouth%20by%20populating%20this%20email%20for%20me%2c%20but%20I%20totally%20thought%20you%20wrote%20something%20great%21">send an email to gandiyafarai+feedback at gmail dot com</a>.

Note that the subject and body are URI encoded, which the Go templating system that Hugo uses does that automatically in the context of hrefs.

With this, once someone navigates to the link, it’ll open up an email client with the recipient, subject and body pre-populated. This is what it looks like on iOS’s Mail app.

The iOS email app with the recipient, subject and body prepopulated.

Mind the typo. Still works either way.

Not sure how many emails I’ll get giving me feedback, but I can’t wait to hear it2.

  1. I kinda did that with the body though… ↩︎

  2. Unless it’s abusive deivel. I don’t want that here. ↩︎