#!/usr/bin/perl use warnings; use strict; use Mail::Sender; my $sender = new Mail::Sender {smtp => 'your-smtp-server', from => 'testing@example.com'}; if (ref $sender->OpenMultipart({ from => 'testing@example.com', to => $to, subject => 'mail message', boundary => 'boundary-test-1', multipart => 'related', })) { print "Attaching body...\n"; $sender->Attach({ description => 'html body', ctype => 'text/html; charset=us-ascii', encoding => '7bit', disposition => 'none', file => 'file.html', }); print "Attaching jpeg...\n"; $sender->Attach({ description => 'file1.jpg', ctype => 'image/jpeg', encoding => 'base64', disposition => 'inline; filename="file1.jpg";', content_id => 'img1', file => 'file1.jpg' }); print "Attaching gif...\n"; $sender->Attach({ description => 'logo.gif', ctype => 'image/gif', encoding => 'base64', disposition => 'inline; filename="logo.gif";', content_id => 'img2', file => 'logo.gif' }); print "Closing / Sending\n"; $sender->Close() or die "Close failed! $Mail::Sender::Error\n"; } else { die "Cannot send mail: $Mail::Sender::Error\n"; }