Tip of the Trade: ESMTP MTA
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 firstname.lastname@example.org -f email@example.com|
You'll receive a message that looks something like this:
From: firstname.lastname@example.org To:
It can also send mail to different accounts by using identities. In esmtprc they look like this:
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 email@example.com -f firstname.lastname@example.org|
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.