Shadowmail for Winlink and Satphone users?

Sailmail offers a service called shadowmail to their subscribed clients. It allows users to monitor their land-based, non-Sailmail e-mail accounts via low-bandwidth Sailmail and to forward messages when requested. It even integrates nicely into the Airmail software, showing theses shadow folders like normal mailboxes. (See the official info page for more information.) For cruisers such a service is definitely a useful thing.

I am not a Sailmail member, but, like most other cruising HAM-radio amateurs, use the winlink network to send/receive e-mails via SSB radio. Still I’d like to have such a thing like shadowmail. So, I wrote a program that gives me the basic functionality of shadowmail: monitoring my (land-based) e-mail accounts and getting selected e-mails forwarded to my winlink account. Though it doesn’t integrate so nicely into Airmail as to show shadow folders, but that’s not really needed. How does it work? The program runs periodically on a server. Each time it logs into a dedicated e-mail account which can receive my e-mails (e.g. from winlink via SSB radio) with commands to remote-control my actual land-based e-mail accounts. For example, a command could be unread 20 christian_gmail. The program then logs into my account named christian_gmail and creates a list (From/Subject/Date/Size/UID) with at most 20 of the latest, unread messages. This list will be sent as a plain-text e-mail to my winlink account. To continue the example, the next command (as my response to the list) could be forward stripped 2345 christian_gmail. The program will log into my gmail account again to forward me the message with the UID 2345 without any attachments or html parts.

I am a fan of open-source software so I’m providing this program (written in Perl5) to whoever likes to use it. You can download my latest version from this link.

What do you need to set up your own shadowmail-like service?

  • A server to run the perl script periodically (you may ask your web-space provider).
  • Perl5 on that server with a handful of networking libraries such as Mail::IMAPClient or Courriel.
  • Basic programming skills (you only need to enter your server and account details in the script).
  • A dedicated e-mail account for the commands (or a dedicated e-mail folder/mailbox on your existing account; set up a filter to move command e-mails to that folder/mailbox).
  • One or more e-mail accounts to monitor (as many as you like).

Short usage description:

# Usage:
# ./myshadowmail.pl psswrd_cmd psswrd_remote1 psswrd_remote2 ...
# Run this perl script as a cron job to set up an email service
# to remote-control one or several remote accounts via a command
# account. The main idea is that you can send emails with
# commands from a low-bandwidth link (e.g. email via SSB radio or
# satphone) to the command acount and receive replies with info
# on the remote account(s) or get selected emails forwarded.
# The commands are in the body of the email for the command
# account. One command per line. Any number of commands is allowed.
# Those commands are currently implemented:
# unread NN ACCOUNTNAME ... returns mail which contains list
# of at most NN unread emails on
# remote account ACCOUNTNAME.
# the list contains FROM, DATE,
# latest NN ACCOUNTNAME ... returns mail which contains list
# of at most NN latest (read and
# unread) emails on remote account
# ACCOUNTNAME. list also includes
# search FIELD "SEARCH PHRASE" NN ACCOUNTNAME ... returns mail
# with at most NN search results.
# FILELD must be one of the following:
# TEXT searches the body as well as
# the entire header). Your SEARCH
# PHRASE must be delimited by double
# quotes.
# forward attached UID ACCOUNTNAME ... forwards mail with UID
# from remote account ACCOUNTNAME
# to requesting email address.
# the mail is sent as attachment.
# forward inline UID ACCOUNTNAME ... forwards mail with UID
# from remote account ACCOUNTNAME
# inline with ALL attachments.
# forward stripped UID ACCOUNTNAME ... forwards mail with UID
# from remote account ACCOUNTNAME
# inline without any attachments.
# (only the plain-text part. if the
# mail has none, a stripped version
# of the html part is sent.)
# mark as read UID ACCOUNTNAME ... marks mail with UID
# from remote account ACCOUNTNAME
# as read (or seen).

At this stage, all e-mail accounts (including the one for the commands) need to support IMAP access. I omitted POP3 access since I consider that protocol obsolete. In the rare case you should require POP3 support, you may modify the script yourself (which is not much work given how comprehensive perl’s module library is).

Copyright 2013-2014 Christian Feldbauer

This program is free software; you can redistribute under the same terms as Perl itself.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.

Leave a Reply

Your email address will not be published.