Using the following code I'm able to send files, but when I send an excel file it comes out the other in the right size, but excel fails to open it. I'm betting this is something obvious, but any help is appreciated. BTW This is a command line script, i just use CGI to handle command line parameters because i'm lazy and it works.
use strict; use warnings; use MIME::Lite; use CGI; my $cgi = new CGI; MIME::Lite->send('smtp', '192.168.11.203', Timeout=>60); my $to = $cgi->param("to"); my $from = $cgi->param("from"); my $subject = $cgi->param("subject"); my $text = $cgi->param("text"); my @files = ($cgi->param("files")); my $msg = MIME::Lite->new( To => $to, From => $from, Subject => $subject, Type => 'multipart/mixed', ); $msg->attach(Type => 'TEXT', Data => $text ); for my $file (@files) { $msg->attach(Id => $file, Path => $file ); } $msg->send; ### will now use Net::SMTP as shown above
In reply to Sending Email Attachment by eric256
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |