in reply to Send email and attachement without MIME?
sub send_email { my $msg = shift; my $sender = Email::Stuffer->new; $sender->transport('SMTP', host => 'mail.example.com', sasl_username => 'username', sasl_password => 'password', helo => 'example.com', ssl => 1, debug => 1, ); $sender->to( $msg->{'to'} ); $sender->from( $msg->{'from'} ); $sender->subject( $msg->{'subject'} ); $sender->text_body( $msg->{'body'} ); if ( my $attachments = $msg->{'attachments'} ) { for my $attachment ( @$attachments ) { $sender->attach_file( $attachment ); } } my $sent = $sender->send; return $sent; }
|
|---|