Category Archives: Technology

Hosting Your Own Disposable Email Service

Disposable email service is an online service where you can get a temporary email address or an anonymous email account for signing up on certain websites that require email verification.

Why does such service exist?

Many people are concerned that their email will get compromised if they handed out their email address to a third party website. They might get unnecessary promotion materials or more commonly called spams. They could create a temporary Yahoo or GMail account for that purpose but it requires too much effort or too many steps for such a simple thing.

For that reason, disposable email service is created. People can turn to a disposable email service to test the website without revealing their identity. Or sometimes people just want to get the free stuff offered by the third party website by exchanging their email without long-term commitment. They don’t have to worry about creating too many email addresses.

There are many such services available online.

As you can see some are open sources. I wanted to host my own disposable email service as a simple project. So I looked around all the available open source solutions.

Most have complicated implementation like requiring Amazon Web Service to run which cost money, or requiring Node.js which my web hosting provider does not allow unless I upgrade to a private server (which also cost money), etc.

Among the open source projects, 2Prong’s implementation is the simplest (also it contains the least code). However, there are still some technical challenges to overcome: piping email to PHP using a .forward file. I could not get it to work on my server (Dreamhost) after following the guides provided like Email to Script and Shell-linked Email.

I spent many hours trying and testing different configurations but to no avail. Dreamhost does not provide support to such feature (email to script) and my conclusion is that in order to make it work, I need a private server. So I gave up.

Leveraging IMAP (Internet Message Access Protocol)

After cooling down, I realized that I could leverage the IMAP protocol which Dreamhost is using for handling email. In fact, all managed email accounts created on the server are using IMAP. I just need to be able to login to the webmail using PHP through IMAP and the job is done. There is indeed such PHP function that allow me to connect and read mail through IMAP for example imap_open and sample code here and sample code.

With this new insight, I created a catch-all email for my reducespam.org domain. A catch-all email will intercept every email sent to that domain. I setup the appropriate setting like only keeping the messages for 2 days or no more than 200 messages at a time etc to avoid getting too many spams.

Then I proceeded to update 2prong source code by removing the dependency on email piping and MySQL table (since the emails are now being handle by IMAP).

Simplest disposable email service solution

After simplifying the source code, these are the new requirements for running a self-hosted disposable email service:

  • no virtual private server (VPS)
  • no Amazon Web Service (AWS)
  • no Node.js and MongoDB
  • no email piping
  • no .forward or .alias files
  • no cronjob to delete mails
  • not even MySQL table
  • what you need is a web host with IMAP email account

The following the is the service that I am hosting at reducespam.org.

Reducespam.org - Disposable Email Service

Reducespam.org – Disposable Email Service

You can try it! 🙂

Source code for download Reduce Spam Source Code 150610. There is a readme.txt file with instructions on how to make it work on your server.





Visual Studio for Mac: Developing C# on OS X

If you only had a Mac with you and you need to work on a project which was written in Microsoft proprietary language (C#), what would you do? I did a quick search on Google and most of the results pointed me to the Mono solution.

Mono is a cross platform, open source .NET framework. It is being sponsored by Xamarin, a popular C# development platform for mobile (Android, iOS) apps, Mac and Windows. Without further ado, I quickly downloaded and installed the Mono solution.

To start using Mono, you will need to install 2 things:

  1. Mono MDK package (.pkg), an open source .NET framework, which will occupy around 600+ MB of space once installed.
  2. Xamarin Studio, MonoDevelop IDE (Integrated Development Environment), which will occupy around 300+ MB of space once installed. The IDE is free as long as you are not developing for iOS/Android projects.

After installing the Mono package and Xamarin Studio (the installation process was quick and painless), I started playing with the Xaramin Studio. To my surprise, the interface is very similar to Visual Studio. I can even say that Xamarin Studio is the Visual Studio for Mac. 🙂 This is good news for C# developers since they don’t have to go through the steep learning curve of picking up a new development tool.

Visual Studio for Mac

Xamarin Studio

Xamarin Studio

Xamarin Studio can open the solution file (.sln) of an existing C# project directly and build the solution without any additional configuration. This is very good. Another good thing is it also has the Nuget package manager integrated in the IDE. NuGet is helpful for finding useful open source packages like Selenium which I need for development.

NuGet in Xamarin Studio

NuGet in Xamarin Studio

Xamarin Studio has built-in Git and SVN version controls support. If your project is version controlled, it will auto-detect the setting and track your pending changes in the IDE. Cool.

It also has the powerful auto-complete feature which literally helps you write your program. The contextual menu has the common options as in Visual Studio like auto-resolve namespace if you are using a class from a non-referenced namespace, rename variable throughout the solution, refactor selected code, etc.

I haven’t tried the debugger fully due to the exception encountered during run-time for the library that I was using. It does have the step-over, step-into, step-out features.

The program that is built using Xamarin Studio can run on a Windows directly too (as long as you don’t use any Mono specific libraries according to this and vice versa where you don’t use any Microsoft/Windows specific libraries such as WPF, Workflow Foundation, COM+ etc in order for the program to build correctly using Mono). I tested the program on the Amazon Elastic Compute Cloud (Amazon EC2) service with Microsoft Windows Server 2012 Base 64-bit (which is free).

Well that’s it. Xamarin Studio, the Visual Studio for Mac.