To add in excel a body and a subject in the mail link, append the mail address with an attribute part like this in Excel:
=(Hyperlink("Mailto:me@home.com?Subject=Emailing From Excel&Body=This
+is a test"))
Some fragments that could be handy if you want to send the mail directly with perl.
If you want to read excel file to obtain the emails given inside.
use Spreadsheet::Read; #use only for simply excel files
# take the filename from commandline and try to take in the excel file
my $file1 = ReadData ($excelfile);
# obtain the last line on the first sheet
my $max_row1 = $file1->[1]{maxrow};
# loop through the rows
for (my $i; $i <= $max_row1; $i++) {
# read the name on the cell A $i
my $name = $file1->[1]{cr2cell ( 1, $i)};
# read the file on the cell B $i
my $file = $file1->[1]{cr2cell ( 2, $i)};
}
To compose an email with perl.
use MIME::Lite;
my $from_address = 'me@home.com';
my $out_server = 'out.home.com';
my $subject = "subject";
my $body = <<"MAIL";
blabla
MAIL
my $document = 'some data' #open and put data into this
my $filename = 'see above'
### Create a new multipart message:
my $msg = MIME::Lite->new(
From => $from_address,
To => $email_address,
Subject => $subject,
Type => 'multipart/mixed'
);
### Add parts (each "attach" has same arguments as "new"):
$msg->attach(
Type => 'TEXT',
Data => $body
);
$msg->attach(
Type => $mime_type,
Data => $document,
Filename => $file,
Disposition => 'attachment'
);
### use Net:SMTP to do the sending. Depends on your system what to use
+.
eval {$msg->send('smtp', $out_server);}; # via a outbound mailserver
eval {$msg->send();}; # sending via local send command on linux system
have a nice day
Martell |