Postfix SMTP Delegation

Sat 23 December 2017 by Thejaswi Puthraya

Email still continues to be a popular communication and collaboration tool especially within enterprises. And Postfix (configurable SMTP server) has withstood the test of time and remains popular.

Programmable SMTP servers like Haraka, Lamson make building applications on top of email easy but I am not comfortable exposing them as the primary server. In comes SMTP delegation; Postfix forwards mails over to Haraka which then process the mails based on javascript (user-configured) rules.

Postfix needs to be made aware of the domains whose mails are to be delegated. This is achieved through the virtual_mailbox_domains setting in the configuration file.

Then in the transport configuration file, you need to list out the domains and the locations where the mails have to be delegated/forwarded.

Here's an snippet of a config file with the relevant change:

virtual_mailbox_domains =

And the transport file forwarding the emails to Haraka running on port 2525:     smtp:     smtp:

Finally, you restart postfix to reflect the changes.

Hosting multiple python apps different url mount points

Fri 22 December 2017 by Thejaswi Puthraya

If you host multiple (virtual hosting) python web apps (django, flask etc) behind nginx on a single server, you have two options:

  1. Using subdomains
  2. On different URL mount points

Using subdomains, you will have to update your DNS records for every app that you deploy. While the deployment is cleaner …

read more

Self-signed TLS Certificate in Linux

Sun 21 August 2016 by Thejaswi Puthraya

Today, I had the necessity to embed an iframe on an HTTPS web page and most browsers now won't allow you to embed an HTTP resource on an HTTPS page raising the mixed content warning. Since the code was quite experimental, I didn't want to deploy it out of localhost …

read more

Elasticsearch autocomplete on related keywords

Thu 21 April 2016 by Thejaswi Puthraya

Recently, I had to work on a client request to add autocomplete to their site's search based not just on a specific list but on related keywords.

For example, suppose you had a list of TV series like Simpsons, Futurama, Tom and Jerry etc. The autosearch had to suggest the …

read more

Simple Command Line Dropbox Uploader in Python

Sun 10 April 2016 by Thejaswi Puthraya

I don't use Dropbox frequently. In fact, I would prefer not to use it but work requires me to use it from time to time. My only use case was to upload files onto a shared folder. So for my usage, it makes no sense to run the desktop client …

read more

Nginx Basic Auth without htpasswd-tools

Mon 10 November 2014 by Thejaswi Puthraya

Sometimes you may want to hide your staging server or project under development from search engines and prying eyes but you don't want to take a lot of pain. HTTP Basic Auth is one solution (can be used as a proper authentication mechanism for web-apps as well) to allow only …

read more

Resize Qemu Image

Wed 30 October 2013 by Thejaswi Puthraya

The default cloud image on Ubuntu has a root partition size of 2GB. I wanted a way to resize the root without going through the hassle of setting up LVM.

To be able to resize the qemu images, we need the Guestfish package.

qemu-img create -f qcow2 -b base_disk.img …
read more

Upload a directory to Rackspace Cloud Files from command line

Wed 02 January 2013 by Thejaswi Puthraya

Here's a simple bash script that uploads a directory to Rackspace Cloud Files and may later on be served as a static website.

First we have to authenticate to get the authentication token that has to be passed for every request:

$ curl -v -X GET -H "X-Auth-User: <username>" -H "X-Auth-Key …
read more

The missing documentation for django.utils.datastructures

Thu 01 November 2012 by Thejaswi Puthraya

Cross posted from my work blog.


django.utils.datastructures is intentionally not documented by the django core devs because it is an internal API and is liable to change without any notice. This file is not governed by django's lenient backwards-compatible policy. You have been sufficiently warned!

With the …

read more

Dissecting Phonegap's architecture

Thu 06 September 2012 by Thejaswi Puthraya

Cross-posted from my work blog.

Apache Cordova is a open source cross-platform framework for building native mobile applications using HTML, CSS and JavaScript. It started off as Phonegap, a project of Nitobi Software before it was acquired by Adobe Systems. The code for the platform was donated to the Apache …

read more