#!/usr/bin/perl use Switch; use Text::Wrap; my $what=$ARGV[0]; $user="username"; #username for gmail account $pass="password"; #password for gmail account $file="/root/.gmail/gmail.html"; #temporary file to store gmail #wrap format for subject $Text::Wrap::columns=65; #Number of columns to wrap subject at $initial_tab=""; #Tab for first line of subject $subsequent_tab="\t"; #tab for wrapped lines $quote="\""; #put quotes around subject #limit the number of emails to be displayed $emails=4; #if -1 display all emails &passwd; #give password the proper url character encoding switch($what){ #determine what the user wants case "n" {&gmail; print "$new\n";} #print number of new emails case "s" { #print $from and $subj for new email &gmail; my $size=@from; if ($emailss!=-1 && $size>$emails){$size=$emailss;} #limit number of emails displayed for(my $i=0; $i<$size; ++$i){ print "From: $from[$i]\n"; #print from line $text=$quote.$subj[$i].$quote."\n"; print wrap($initial_tab, $subsequent_tab, $text); #print subject with word wrap } print "\n"; $size=@from; if ($emailss!=-1 && $size >$emails){print "$emails out of $size new emails displayed\n";} } case "e" { #print number of new emails, $from, and $subj &gmail; if($new==0){print "You have no new emails.\n";} else{ print "You have $new new email(s).\n"; my $size=@from; if ($emailss!=-1 && $size>$emails){$size=$emailss;} #limit number of emails displayed for(my $i=0; $i<$size; ++$i){ print "From: $from[$i]\n"; #print from line $text=$quote.$subj[$i].$quote; print wrap($initial_tab, $subsequent_tab, $text); #print subject with word wrap } print "\n"; $size=@from; if ($emailss!=-1 && $size >$emails){print "$emails out of $size new emails displayed\n";} } } else { print "Usage Error: gmail.pl