Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Net::SMTP::SSL - sending HTML

by edimusrex (Monk)
on Jul 13, 2015 at 15:09 UTC ( #1134525=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1134525]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2021-09-18 18:01 GMT
Find Nodes?
    Voting Booth?

    No recent polls found