use MIME::Lite; use Net::SMTP; my $from_address = 'myname@host.com'; my $to_address = 'toname@host.com'; my $mail_host = 'mail.domain.com'; # Adjust subject and body message my $subject = 'A message with 2 parts ...'; my $message_body = "Here's the attachment file(s) you wanted"; # Adjust the filenames my $my_file_jpg = 'C:\cookies.jpg'; my $your_file_jpg = 'sweet.jpg'; # Create the multipart container $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating multipart container: $!\n"; # Add the text message part $msg->attach ( Type => 'TEXT', Data => $message_body ) or die "Error adding the text message part: $!\n"; # Add the JPG file $msg->attach ( Type => 'image/jpg', Path => $my_file_jpg, Filename => $your_file_jpg, Disposition => 'attachment' ) or die "Error adding $your_file_jpg: $!\n"; # Send the Message MIME::Lite->send('smtp', $mail_host, Timeout=>60); $msg->send;