Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use warnings;
- use Email::MIME;
- use Email::Sender::Transport::SMTP;
- use Email::Sender::Simple qw(sendmail);
- use Archive::Zip qw( :ERROR_CODES :CONSTANTS);
- use IO::All;
- my $message =
- Email::MIME->create(
- header_str => [
- From => $sender,
- To => $recipient,
- Subject => $subject,
- ],
- attributes => {
- filename => $filename,
- content_type => 'application/zip',
- disposition => 'attachment',
- name => $filename,
- },
- body => io($fileToSend)->binary->all,
- #body => io($fileToSend)->all,
- );
- $message->encoding_set( 'base64' );
- my $transport = Email::Sender::Transport::SMTP->new({
- host => $smtpserver,
- port => $smtpport,
- sasl_username => $smtpuser,
- sasl_password => $smtppassword,
- ssl => 'starttls'});
- Email::Stuffer->from('a@a.com')
- ->to('b@b.com')
- ->text_body('hello')
- ->attach_file ('zipfile')
- ->transport($transport)
- ->send();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement