#### Subroutine for sending email message: #### Subroutine for sending email message: sub mailfunc { my($to, $from, $subject, @body) = @_; use MIME::Lite; use Net::SMTP; my $relay = "gorillatrades.com"; ## Mail Server. my $smtp = Net::SMTP->new($relay); ## Mail Object Handler. die "Could not commicate with $relay. $!" if (!defined $smtp); my @images; ## Stores Images references; my $message = join(' ', @body),"\n"; # Create the initial text of the message my $mime_msg = MIME::Lite->new( From => $from, To => $to, Subject => $subject, Type => "multipart/mixed", ) or die "Error creating MIME body: $!\n"; ##Find all image references ##Converting MIME type into String: #print "$message"; #HTML $mime_msg-> attach(Type => 'text/html', Data => "$message"); my $message_body = $mime_msg-> body_as_string(); #### Send out Email. ## Second Send Message Using ONLY MIME MIME::Lite->send('smtp', $mailserver, Timeout=>60); eval { $mime_msg-> send(); }; $@ and warn "Exception caught: $@\n\n"; print "Sent Normally to $to.\n\n"; $@ and warn "Exception caught: $@\n\n"; }