Email

ID #275

Can I pipe email to a program?

Applies to: Grid System

We do not currently allow "piping" of email on the grid system for security reasons. However, there are other options for processing your mail with your own programs.

First, you should take a look at the Sieve filtering language. It's quite powerful, and while we do not currently offer a web interface, we will work with you to install a Sieve script.

You might also want to deploy a Perl or PHP script on a regular schedule that examines your mailbox and manipulates your email in any way you desire, such as adding messages to a MySQL database, forwarding them, deleting them (though Sieve would be a better choice for deleting), or nearly anything else.


Last update: 2010-09-27 15:59
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 (0 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
Here is a simple example of a Perl script which prints out the subject
line of any unseen mail in your inbox (marking them as seen in the process):


#!/usr/bin/perl

use Net::IMAP::Simple;

# open a connection to the IMAP server
$server = new Net::IMAP::Simple( 'mail.modwest.com' );

# login
$server->login( 'YOURUSERNAME', 'YOURPASSWORD' );

# select the desired folder
$number_of_messages = $server->select( 'inbox' );

# go through all the messages in the selected folder
foreach $msg ( 1..$number_of_messages )
{
if (! $server->seen( $msg ) )
{
$fh = $server->getfh( $msg );
while( )
{
$line = $_;

if($line =~ /Subject:/)
{
print $line;
}
}
close $fh;
}

}


Added at: 2004-07-27 11:39

Comment of Anonymous:
Hi,

I have recently had the same task to solve and found that one can have a workaround by using www.email2php.com.
Added at: 2007-11-22 09:13

Comment of kerryjames:
I would recommend looking at third-party service to pipe email to a program. They can also make parsing the email into parts easier. Some good ones are:

http://mailnuggets.com
http://smtp2web.com
http://mailhooks.com
Added at: 2010-10-03 19:20