Hi, I am working on having my contacts in gmail converted into a mutt alias file (this is because I am using an android phone). I am not sure if there is a similar project going on. In any case, this is my first version of it. Any comments appreciated. Cheers!
#!/usr/bin/perl use strict; use warnings; use WWW::Google::Contacts; my $google = WWW::Google::Contacts->new( username => 'username', password => 'password' ); my $contacts = $google->contacts; while ( my $c = $contacts->next) { if (ref($c->email) ne "") { my $name = $c->full_name; # Substitute spaces with dots and create the alias (my $al = $name) =~ s/ /\./g; my $mails = scalar @{$c->email}; foreach my $mail (@{$c->email}) { my $address = $mail->value; my $alias = $al; # Add the domain to alias if more than 1 address if ($mails > 1) { (my $domain = $address) =~ s/.*@(.*)\..*/$1/; $alias = "$alias.$domain"; } else { $address = $mail->value; } print "alias $alias $name <$address"> \n"; } } } -- Mimosinnet Linux User: #463211 41:25:16N (41.421110) 2:11:28E (2.188333)
pgpkcfo6xGv6o.pgp
Description: PGP signature