mrbbq has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Sending Attachments PERL
by borisz (Canon) on Jan 09, 2004 at 18:45 UTC
    use MIME::Lite; $m = MIME::Lite->new( From =>'me@abcd.com', To =>'xx@y.com', Subject =>'Hi', Type =>'application/xls', Encoding =>'base64', Path =>'abcdef.xls' ); $m->send;
    Boris
Re: Sending Attachments PERL
by arden (Curate) on Jan 09, 2004 at 18:34 UTC
    Have you tried anything yet? What do you have on your unix box? Basically, you haven't given us much to work with here. Assuming that you have a standard load, just call "mail" with the appropriate arguments to add the attachment. To figure out what arguments you need for your mail, type man mail.
Re: Sending Attachments PERL
by zentara (Cardinal) on Jan 10, 2004 at 18:12 UTC
    Since you are sending excel files, I guess you might want to send it so that the Microsoft mail mechanisms can do their thing. This was posted by another monk earlier this year.
    #!/usr/bin/perl use MIME::Entity; use Net::SMTP; # create the multipart message with attachments $msg = MIME::Entity->build( Type => 'multipart/mixed', From => 'bogus@mail.com', # The "To" here is displayed in the message header as "To" # This is not the actual list of recipients To => '"Display Name" <user1@mail.com>, "Second Person" <user2@mail.com>', Subject => 'Automatic email of Excel report', ); $msg->attach( Type => 'application/msexcel', Path => $report, Filename => 'college_orders.xls', Encoding => 'base64' ); $msg->attach( Data => "Enclosed is the daily report of orders. (automated delivery)" ); # send the message $smtp = Net::SMTP->new("smtp.mail.com"); #authenticate if required $smtp->auth( "login", "passwd" ); # Identify yourself to the smtp server $smtp->mail('bogus@mail.com'); # The syntax for "To" is different in MIME::Entity and Net::SMTP # The "to" here is the list of actual recipients and is not displayed $smtp->to( 'user1@mail.com', 'user2@mail.com' ) || die "Bad address"; # Send the message and attachments $smtp->data( [ $msg->as_string ] ) || die "mail not accepted"; $smtp->quit; exit;
Re: Sending Attachments PERL
by Jenda (Abbot) on Jan 11, 2004 at 18:48 UTC

    Another option would be Mail::Sender.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature