use Tk;
use Net::SMTP;
use Net::SMTP::Multipart;
use IO::File;

my($userID)     = 'li_c_j';
my($password)   = 'woi1504';
my($mailTo)     = 'lichaoji@gmail.com';
my($mailCc)     = 'li_c_j@sohu.com';
my($mailServer) = 'smtp.sohu.com';
my($mailFrom)   = 'li_c_j@sohu.com';
my($realName)   = "Li Chaoji";
my($tmpfile)    = "n_o_t_e.txt";
END { unlink($tmpfile) or die "Couldn't unlink $name : $!" }
system("gvim -f $tmpfile");

my $body = "Content-Type: text/plain; charset=\"gb2312\"\n";
my $subject = "Note";
open FILE,"<$tmpfile";
my $tmp = "";
while(<FILE>) {
	$tmp = $tmp . $_;
}
$body = $body . $tmp;
close FILE;
exit if $tmp =~ /^\s*$/;
$smtp = Net::SMTP::Multipart->new($mailServer, Debug=>1,Timeout=>30);
$smtp->auth($userID, $password);
$smtp->Header(To   => $mailTo,
              Subj => $subject,
              From => $mailFrom);
$smtp->Text($body);
#$smtp->FileAttach("c:/tmp/myfile.xls");
$smtp->End();

