Search This Blog

Sunday, March 29, 2009

yahoo2mbox.pl error: Unexpected title page format

The problem


c:\emails\yahoo2mbox-0.24>perl yahoo2mbox.pl --user=pooja13pandey --pass=<password>
1 --delay=5 desimasala
Logging in as pooja13pandey... ok.
Getting number of messages in group desimasala...
Unexpected title page format (DesiMasala).

The solution


This simply means that the user with which we are trying to archive the yahoo group's messages locally, is not part of the yahoo group yet. So now I make pooja13pandey user a part of the desimasala yahoo group.
c:\emails\yahoo2mbox-0.24>perl yahoo2mbox.pl --user=pooja13pandey --pass=<password>
1 --delay=5 desimasala
Logging in as pooja13pandey... ok.
Getting number of messages in group desimasala...
Retrieving messages 1..12389:
Endless redirect loop detected while retrieving message 1.
This error is often due to using incorrect case in the group name.
Saved 0 message(s) in desimasala.

Hmm, so there is still some problem. Although, there is a yahoo group called Desimasala, Im not able to login to it through yahoo2mbox.pl script for some reason. On closer look, one can see that the group name is case-sensitive. It needs to be DesiMasala, instead of Desimasala or desiMasala or desimasala.

So, lets make that correction and try again.
c:\emails\yahoo2mbox-0.24>perl yahoo2mbox.pl --user=pooja13pandey --pass=<password>
1 --delay=5 DesiMasala
Will resume at message 1
Logging in as pooja13pandey... ok.
Getting number of messages in group DesiMasala...
Retrieving messages 1..12389:

.. And, Bingo! It worked.

Saturday, March 28, 2009

quick script to extract email ids from a detailed mail header

Since my creative juices are flowing so much today, I thought of posting the simple, yet effective awk script to extract sender's email ids from a detailed mail message (even though if the mail id be ecrypted).

A word of caution is that the file being processed should have a line with "EOF" value (without strings) ONLY at the end of file, otherwise the awk script will hang.

BEGIN { print FILENAME | "wc -l |cut -f1 -d' '" ; }
/^X-Sender:/ || /^From / { #print NR, $0;
#
# get the real userid from where the email came
#
m=split($0,b,"@");
from=b[1];
#print from;
x=split(from,c," ");
realfrom=c[x];
gsub("<","",realfrom);
#print realfrom;
#
# get the domain name of the smtp server now
#
while ($0 !~ /HELO/ && $0 != "EOF") getline;
if ($0 == "EOF") exit;
domain=$5; gsub(")","",domain); n=split(domain,a,".")
#print n, domain;
realdomain=a[n-1]"."a[n];
if (n>1) print realfrom"@"realdomain;
next;
}

How to uninstall a CPAN module ?

CPAN module does not have the option of un-installing a perl module as of now. This can be especially frustrating for newbies (as it was for me). I struggled quite a bit on google and found this solution. For this, you need the CPANPLUS module, which needs to be first installed through CPAN.
C:\Users\Pooja Verma>perl -MCPAN -e shell

cpan> install CPANPLUS

cpan> exit

Unlike CPAN, you cannot invoke CPANPLUS by typing cpanplus on command prompt, even if its installed.
C:\Users\Pooja Verma>cpanplus
'cpanplus' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Pooja Verma>perl -MCPANPLUS -e shell
CPANPLUS::Shell::Default -- CPAN exploration and module installation (v0.84)
*** Please report bugs to <bug-cpanplus@rt.cpan.org>.
*** Using CPANPLUS::Backend v0.84.  ReadLine support disabled.

*** Type 'p' now to show start up log

Did you know...
    The documentation in CPANPLUS::Module and CPANPLUS::Backend is very useful
CPAN Terminal> help

[General]
    h | ?                  # display help
    q                      # exit
    v                      # version information
[Search]
    a AUTHOR ...           # search by author(s)
    m MODULE ...           # search by module(s)
    f MODULE ...           # list all releases of a module
    o [ MODULE ... ]       # list installed module(s) that aren't up to date
    w                      # display the result of your last search again
[Operations]
    i MODULE | NUMBER ...  # install module(s), by name or by search number
    i URI | ...            # install module(s), by URI (ie http://foo.com/X.tgz)
    t MODULE | NUMBER ...  # test module(s), by name or by search number
    u MODULE | NUMBER ...  # uninstall module(s), by name or by search number
    d MODULE | NUMBER ...  # download module(s)
    l MODULE | NUMBER ...  # display detailed information about module(s)
    r MODULE | NUMBER ...  # display README files of module(s)
    c MODULE | NUMBER ...  # check for module report(s) from cpan-testers
    z MODULE | NUMBER ...  # extract module(s) and open command prompt in it
[Local Administration]
    b                      # write a bundle file for your configuration
    s program [OPT VALUE]  # set program locations for this session
    s conf    [OPT VALUE]  # set config options for this session
    s mirrors              # show currently selected mirrors

Now you can uninstall the module that you want to. If needed, you can use the --verbose and --force option with it.
CPAN Terminal> u MIME::Head --force --verbose