#!/usr/bin/perl use warnings; use strict; use MIME::Lite; # Standard CPAN module my $from_address = 'selector@selectorweb.com'; my $to_address = 'selector@selectorweb.com'; my $subject = 'MIME test - HTML with image'; my $mime_type = 'multipart/related'; # Create the message headers my $mime_msg = MIME::Lite->new( From => $from_address, To => $to_address, Subject => $subject, Type => $mime_type ) or die "Error creating MIME body: $!\n"; # Attach the HTML content my $message_body = '

Hello world!

'; $mime_msg->attach(Type => 'text/html', Data => $message_body); # Attach the image $mime_msg->attach( Type => 'image/gif', Id => 'myid.gif', Encoding => 'base64', Path => 'pikachu.gif'); $mime_msg->send;