Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use Mail::Sender; $sender = new Mail::Sender { smtp => 'smtp.server', from => 'email address', on_errors => undef, } or die "Can't create the Mail::Sender object: $Mail::S +ender::Error\n"; $sender->OpenMultipart({ to => 'emailaddress1, emailaddress2', cc => 'emailaddress3', subject => 'Log files.' }) or die "Can't open the message: $sender->{'error_msg'} +\n"; $sender->SendLineEnc("This is todays log files "); $sender->SendLineEnc("\nHI, J"); $sender->Attach( {description => 'Daily log', ctype => 'text/plain; charset="us-ascii"', encoding => '7bit', disposition => 'attachment; filename="textfile.txt"', file => 'textfile.txt' }); $sender->Close() or die "Failed to send the message: $sender->{'error_m +sg'}\n"; if ($@) { print "Error sending the email: $@\n"; } else { print "The mail was sent.\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Attachment displays in email's body using Mail::Sender
by olivierp (Hermit) on Nov 27, 2004 at 09:31 UTC | |
by Anonymous Monk on Jun 11, 2010 at 10:14 UTC |