#!/usr/bin/perl
use CGI qw/:cgi-lib/;
use CGI::Carp qw(fatalsToBrowser);
print "Content-type: text/html\n\n";
use GMail::Checker;
use Excel::Writer::XLSX;
my $gwrapper = new GMail::Checker();
my $gwrapper = new GMail::Checker(USERNAME => "username", PASSWORD => "password");
$gwrapper->login("username","password");
my ($nb, $size) = $gwrapper->get_msg_nb_size();
my @headers = $gwrapper->get_msg_headers(HEADERS => "FULL", MSG => 74);
@addys=();
foreach $head (@headers) {
$foundit = $email =~ /^[-\w.]+@([a-z0-9][a-z-0-9]+\.)+[a-z]{2,4}$/i
push(@addys,$foundit);
}
my $workbook = Excel::Writer::XLSX->new( 'customers.xls' );
$worksheet = $workbook->add_worksheet();
$format = $workbook->add_format();
foreach $line(@addys) {
$count=1;
$col = 0;
$row = $count;
$worksheet->write( $row, $col, '$line', $format );
$count++;
print "Writing to Excel: $line\n";
}