http://www.perlmonks.org?node_id=1134525


in reply to Net::SMTP::SSL - sending HTML

Thanks to your help I was able to finally solve this issue. It seems that there was a problem sending the entire HTML message as one datsend so I solved it by negating the template (I only used 1 variable), loading the HTML into an array (I originally had it do an open/while but if I was sending to 50+ users I found it more efficient to load the file pre-looping through the desired emails).

my updated send email block looks like this

sub sendMail{ my $receiver = shift; my $name; if($test) { $receiver =~ /^(.+?)\@/; $name = ucfirst($1); } else { $name = shift; } my $subject = "Sociabull Weekly"; print "Sending to $receiver\n"; $smtp->mail($connect{sender}); $smtp->recipient($receiver); $smtp->data() or die "Failed to send! - Data initialize : $!\n"; $smtp->datasend("To: <$receiver> \n") or die "Failed to send! -- T +o : $!\n"; $smtp->datasend("From: $connect{sender_name} <$connect{sender}> \n +") or die "Failed to send! -- From : $!\n"; $smtp->datasend("Content-Type: text/html \n") or die "Failed to se +nd! -- Content-Type : $!\n"; $smtp->datasend("Subject: $subject\n") or die "Failed to send! - S +ubject : $!\n"; $smtp->datasend("\n") or die "Failed to send! - Line Break : $!\n" +; for my $html_lines(@html){ chomp $html_lines; if ($html_lines =~ /\<TMPL\_VAR NAME\=USER\_NAME\>/){ $html_lines =~ s/\<TMPL\_VAR NAME\=USER\_NAME\>/$name/; } $smtp->datasend($html_lines) or die "Failed to send! - Body : +$!\n"; } $smtp->dataend() or die "Failed to send! - Data End : $!\n"; }

Thanks again for all the help/suggestions