Tip of the Trade: ESMTP MTA

By Carla Schroder (Send Email)
Posted May 31, 2006


The ESMTP MTA (Extended Simple Mail Transfer Protocol Mail Transport Agent) is a small, relay-only MTA suitable for a variety of uses. Its especially useful on embedded devices like routers and wireless access points, which cannot support a full-blown MTA but have about 800 KB to spare for an executable, configuration file, and core library. ESMTP MTA is a small, relay-only mail transport agent especially useful on embedded devices that cannot support a full-blown MTA but have the space for an executable, configuration file, and core library.

Why would you want an MTA on a router or wireless access point? So it can send you messages in case of trouble, or routine reports, or logfiles, or whatever you want. A regular mail server is still necessary, except for local delivery. For local delivery you'll also need an MDA like Procmail or Courier Maildrop. ESMTP relays messages from whatever program wants to talk to you from your regular mail server. It runs in userspace, so no special privileges are needed to set it up.

The configuration file can be as simple as entering the account information for a regular SMTP server:

hostname = mail.myisp.com:25
username = "myloginname"
password = "sekkritword"

And testing it is equally easy. Simply send yourself a test message, and give it a return address with the -f flag (text should not have any forced line breaks):

$ echo "This is an ESMTP test" | /usr/bin/esmtp me@myisp.com -f me@myhostname.com

You'll receive a message that looks something like this:

From: me@myhostname.com
 To: 
This is an ESMTP test Date: Sat, 13 May 2006 18:51:19 -0700 From: me@myhostname.com Message-Id: <1147571479.0@windbag>

It can also send mail to different accounts by using identities. In esmtprc they look like this:

identity me@isp2.com
hostname mail.myisp2.com:25
username = "myloginname"
password = "sekkritword"

esmtprc can be anywhere. Some distributions install it in /etc/esmtprc. You may use a different location, like your home directory. Just specify it with the -C option (again, no line breaks):

$ echo "This is a real message this time" | /usr/bin/esmtp -C ~/esmtprc me@isp2.com -f me@myhostname.com

This all lends itself nicely to scripting. Various services can be scripted to send exactly the information you want to the e-mail address of your choice.

Page 1 of 1


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.