CA BD NY
  • Categories

  • Recent Posts

  • RSS MySQL Hacker

  • RSS Apache Hacker

  • RSS Editor's Lists

  • Meta

  • Bringing Email Home Across the Globe

    Published May 24th, 2009

    This post will be published when I am just about to get on a flight to Singapore on my way back home in Sacramento, CA from Dhaka. My three-week Dhaka trip ends today.  For most of these three weeks, I spent working in our dev center in various “upgrades” but they are mostly business-ish and not really worth mentioning in this blog. However, I do wish to share one such upgrade with you — users in our Dhaka office always complain about bandwidth and this complain is amplified in the AM as everyone comes in and starts downloading email messages with attachments.  Even with a 1.5Mbps (T-1) connection, the load just cannot keep up. So finally, I gave in and decided to localize email using a simple relay. Here is how:

    Our primary corporate mail server is located behind a mail filter appliance from Mail Foundry in our Sacramento office. The users from Sacramento, New York, and Dhaka all connect to the mail server via POP3/IMAP and Web mail to access their daily dose of emails. However, the Dhaka staff always have a hard time as the mail download is horrible when large attachments are included by customers or spammers that get thru.

    So the idea behind the mail relay was to accept mail using user@evoknow.com but send them over to user@<dhaka specific host> running SMTP mail server. The local Dhaka users then simply point their mail clients to the local mail server which uses IMAP/POP3 to service them. Since most mails are sent from the US, they are already downloaded in the local mail server, which is extremely fast for the users on the same LAN.

    This trick involves the following on the US side:

    1. Edit /etc/postfix/virtual to add user@evoknow  to user@dhaka.specific.host mappings
    2. Recreate the virtual alias database using postmap hash:/etc/postfix/virtual
    3. That’s all for this end.

    On the Dhaka end, here is what was needed:

    1. Setup a CentOS 5.3 box as a mail server with Postfix for SMTP, DoveCot for POP3/IMAP
    2. Made sure that the IP address has a reverse DNS setup — i.e. PTR record from the ISP in Dhaka
    3. Since I compiled dovecot from source, I had to setup the /usr/local/etc/dovecot.conf with mail_location directive that looks as follows:
      mail_location = mbox:~/mail:INBOX=/var/mail/%u
    4. Restart Dovecot.

    To test the setup, I sent mail to user@evoknow.com which got relayed to user@<dhaka specific host> and when the user came in next morning, she picked up the email from the local mail server at high speed!

    I guess, mail is now flying high as I am. :)

    Cheers.

    Get a Trackback link

    No Comments Yet

    Be the first to comment!

    Leave a comment

    Comment Policy: First time comments are moderated. Please be patient.