E-mail private messages gathered in Irssi
by paulie
I usually have the IRC client irssi running in a screen session so I can stay connected to certain servers and channels all the time. Unfortunately, if I get a private message (PM), I tend to miss it if I neglect IRC for a few days at a time. To correct this, I looked around for an irssi script to send me an e-mail when I get these messages. The closest thing I could find was awayproxy.pl. It seemed to be overkill and relied on sendmail to relay e-mails.

So, I decided to write my own script that uses SendEmail. All you need to do is edit the $SENDEMAIL, $SRCEMAIL, $DESTEMAIL, and $SMTPSERVER variables. It's a VERY simple script, so don't expect a lot from it. You can always substitute sendEmail for sendmail, and you may want to add some extra options for username and password if your SMTP server requires it (mine doesn't).

use strict;
use vars qw($VERSION %IRSSI);

use Irssi;
$VERSION = '1.0.0';
%IRSSI = (
        author      => 'Paul Johnson',
        contact     => 'paulie@pauliesworld.org',
        name        => 'E-mail PM',
        description => 'E-mails a private message to you 
			from IRC.',
        url         => 'http://www.pauliesworld.org/emailpm/',
        changed     => '$Date: 2009-01-09 :00:00 +0100 
			(Sat, 9 Jan 2009) $'
);

my $SENDEMAIL   = "/location/of/sendEmail";
my $SRCEMAIL    = "source\@emailaddress.com";
my $DESTEMAIL   = "destination\@emailaddress.com;
my $SMTPSERVER  = "smtp.youremailserver.com";

sub parsePrivateMessage()
{
        my ($server,$message,$user,$address,$target) = @_;
        emailPrivateMessage($user,$message);
}

sub emailPrivateMessage()
{
        my ($user,$message)=@_;
        my $subject = "IRC message from $user";
        my $send=`${SENDEMAIL} -f ${SRCEMAIL} -t ${DESTEMAIL} 
		-u ${subject} -m ${message} -s ${SMTPSERVER}
}

Irssi::signal_add_last("message private", 
"parsePrivateMessage");
[ EmailPM.pl ]

11:54 PST — January 11, 2010

Powered by Perl