What modern information handling system do we probably interact with most each day? For the majority of us, it is probably our email. We send and recive dozens of emails each day. So how about enabling repository deposit via email?
It has certainly been talked about from time to time, and a plugin to the Thunderbird email client has even been written that allows you to deposit attachments into repositories using SWORD (no mention is made of metadata). This plugin should work with any SWORD enabled repository, but only works with one email client. Wouldn’t it be great if there was a more general solution that worked with all repositories, and all email clients?
Now there is! The latest version of the SWORD PHP library (version 0.8) contains an example script showing SWORD and the PHP library in use. To make it work, just fill out a configuration file with your email address, password and IMAP mailbox details, and your repository login, password and deposit URL. After the configuration file has been filled in, all you need to do is run the script ‘imap-mail.php’ on the command line. The script will connect to your mailbox and look at each unread message. It will package each one up and deposit it into the repository.
How does it work?
It uses the standard PHP IMAP library to connect to your inbox. For each unread message it finds, it extracts the name of the sender of the email, the email subject, and the body of the message. It uses these for metadata:
- From name -> Author
- Subject -> Title
- Message body -> Abstract
Along with the metadata, the script adds each email attachment to the deposited item. An example of an email deposited this way can be seen at: http://dspace.swordapp.org/jspui/handle/123456789/318
If you want to try it out, but don’t want to set it all up, for a limited time I’ll leave it running against the email@example.com mailbox. Send an email to firstname.lastname@example.org and when I periodically run the script, your email will be deposited into the test DSpace/SWORD repository at http://dspace.swordapp.org/. Please bear in mind that the repository is open access to the world, so anyone can see what your email and optional attachments contain! (Please consider working hours / timezones etc when working out when I am likely to next run the script! You will receive a confirmation email when your deposit has taken place.)
A few further thoughts:
- What is the use of this script? I can think of a few. If you want to allow faculty members to deposit full texts easily, and you are happy to update the record with better metadata, this script could help you out. Alternatively if you have a system that for example generates weekly reports, and you want to archive these, you may find it easier to get the system to email the reports to the SWORD script than to develop a SWORD deposit interface to the system.
- n for the price of 1: As far as I know, none of the major SWORD enabled repository platforms has an email deposit facility. This script shows one aspect of the real power of interoperability and SWORD’s part in creating an interoperable environment. Rather than developing an email deposit facility for just one repository, I have developed one for any SWORD compliant repository.
- Extensions to the script: The following idea came up in a conversation with Kim Shepherd, the LCoNZ DSpace programmer who suggested that the ‘local part’ of an email address could be used to set further options. Email addresses can have extra tags applied following a ‘+’ or ‘-‘ (for example username-XYZ@example.com). So if for example you wanted your users to be able to choose which collection in the repository they wanted to deposit an item into, they could change the deposit email to something like email@example.com or firstname.lastname@example.org. These emails would all end up in the same mailbox, but the script could process them differently. Or of course the parameters could be used to set other options.
If I get time, my next extension to the PHP SWORD library will be a basic web client (similar to http://client.swordapp.org/ except written in PHP, and will create packages from files for you). If you have any other suggestions, please leave a comment!