#!/usr/bin/perl use strict; use warnings; use autodie qw(open close); use CGI qw(-oldstyle_urls :standard); use CGI::Carp qw(fatalsToBrowser); use MIME::Lite; use POSIX qw/strftime/; my $date = strftime "%m/%d/%Y", localtime; print header(); send_reg_email( first_name => 'Joe', last_name => 'Doe', ); sub send_reg_email { my (%args) = @_; my $first_name = $args{first_name} || ''; my $last_name = $args{last_name} || ''; my $e_from = 'Form Registration '; my $e_to = 'Form Support '; my $msg = MIME::Lite->new( From => $e_from, To => $e_to, Subject => "Registration", Type => 'multipart/related') or die "Error Creating Message: $!\n"; $msg->attach( Type => 'text/html', Data => qq| Registration Email
 
  Registration Information
 
  Name: $first_name $last_name
 
 
 
|, ); # Attach GIF image $msg->attach( Type => 'image/png', Id => 'logo', Encoding => 'base64', Path => '../images/logo.png'); $msg->send(); } # end mail sub print "
DONE
";