Fenux.Net - The Life of a Geek
Perl
Stories about or somehow related to Perl.
Page 1 of 1
Posted on 1/18/2007 2:46 pm in Perl

I wrote a quick program today to filter a list of email addresses out of an old email that had been forwarded a couple times. The program itself is very simple, but it took me about 15 minutes. Most of that time was digging up the proper commands for reading in the input.

I think it's mostly because I haven't written any new Perl code in about 2 years. I need to find an excuse to write more Perl so I'm not so rusty when I need.

#!/usr/bin/perl
use IO::Handle;

open (INPUT, ")
{
        chomp $email;
        $email =~ s/^ *?>> +?(.+?),.*$/$1/;
        print "$email; ";       
}

close (INPUT);
Posted on 4/21/2006 12:51 pm in Perl

There isn't an easy way to do it. I've looked, but that's never stopped me before. I will finish out this post later, but for now, I'm getting the details in so I don't forget.

Requirements: (To do it the way I did.)

  • *.txt files from Mailman's list archives
  • Unix shell and FTP access
  • unix2dos command for Unix
  • minimail - Cut+paste perl code to parse/create mbox files and mail messages
  • Mark Lyon's GMail Loader (GML)
  • A POP email account
  • Outlook

Overview:

  • Combine *.txt files for a list into one *.mbox file. (cat *.txt > listname.mbox)
  • Append headers using minimail.pl.
  • Convert to DOS text file format.
  • Send to POP account using GML.

We append the "Sender:" and "To:" headers so that the rules I use in Outlook will auto sort them.

Append Headers Code: (Replace the last {} block in minimail.pl with this, making appropriate changes for each list.)

{
        sub rd { <> }
formail(&rd, sub {
        my $mymail = shift;
        append_header($mymail, "To: 'List Description' ");
        append_header($mymail, "Sender: listname-bounces@listserver.com");
        print mail2str($mymail);
        });
}

To Do List:

  • Need to unobscure the email addresses so they aren't all "user at server.com".

Posted on 4/8/2005 1:04 pm in Perl
I finally tested the cyrus2mbox.pl script on some real data in a production environment. The only limitation it seems to have is that you need to add it to the end up an existing inbox (let it receive at least one email first) or it will overwrite the data.
Posted on 4/5/2005 10:27 pm in Perl

In the process of moving to a new web server, I came across a small problem. On the old server, I'd been using Cryus for IMAP access. On the new server, to simplify things with Webmin/Virtualmin, I'm using IMAP-UW instead. It suits my purposes without overcomplicating matters like Cryus seemed to. The problem is that Cyrus uses a directory of email files and IMAP-UW uses one MBOX file with all the messages. I found several programs to convert from MBOX to Cyrus's format, but nothing to go the other way. After a lot of playing, I finally created something that works. And it works pretty well too.

Page 1 of 1
Creative Commons License  Subscribe with Bloglines  Get Daily Wisdom!
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
© 2000-2012 Jason Burgess