email script

S

Shawn

Hi,

I have been using the below script to attach text files to a email and send
the email to whoever. But, I'd like to change the file Type to attach a
Excel file instead of a text file. What type of changes would I need to
make?

Thanks,
Shawn

#!/usr/local/bin/perl5.6

use lib "lib";
use MIME::Lite;

$msg = new MIME::Lite
From => "$ARGV[0]",
To => "$ARGV[1]",
Subject => "$ARGV[2]",
Type => 'TEXT',
Path => "$ARGV[3]",
Encoding => '7bit';
attach $msg
Type => 'TEXT',
Path => "$ARGV[4]",
Filename => "$ARGV[5]";
$msg->send;

--
 
B

Bob Walton

Shawn wrote:

....
I have been using the below script to attach text files to a email and send
the email to whoever. But, I'd like to change the file Type to attach a
Excel file instead of a text file. What type of changes would I need to
make? ....
Shawn

#!/usr/local/bin/perl5.6

use lib "lib";
use MIME::Lite;

$msg = new MIME::Lite
From => "$ARGV[0]",
To => "$ARGV[1]",
Subject => "$ARGV[2]",
Type => 'TEXT',
Path => "$ARGV[3]",
Encoding => '7bit';
attach $msg
Type => 'TEXT',
Path => "$ARGV[4]",
Filename => "$ARGV[5]";
$msg->send;


Try [untested]:

...
attach $msg
Type => 'application/msexcel',
Disposition=>'attachment',
Path => "$ARGV[4]",
Filename => "$ARGV[5]";
...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top