Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Send mail help

by dwm042 (Priest)
on Jun 29, 2011 at 22:14 UTC ( #912053=note: print w/ replies, xml ) Need Help??


in reply to Send mail help

Just an FYI about Mime::Lite and other means of sending HTML emails.

Well configured HTML emails also have a pure text version as well. In part, this is because certain mail clients can't handle HTML emails. To note, one signature of HTML mail from viruses is that they only include the HTML version since their mails are intended to infect others (via urls bringing in nastiness). Therefore, HTML emails without a pure text equivalent have much higher spam scores.

I'm in the process of replacing hard coded text emails (coded much in the manner of the OP) with a Mime:Lite and Template based solution, that allows my internal customers to write their own emails to our external clients. And I'm asking my customers to write both a HTML version and a non-HTML version to place in an email.

A code snippet would be:

if ( $header->[2] =~ /html/i ) { $tt->process( $file_html, $tt_vars, \$html_out ) || warn $tt->error(), "\n"; $vars{Type} = 'multipart/alternative'; $msg = MIME::Lite->new( %vars ); # Add parts (each "attach" has same arguments as "new"): $msg->attach( Type => 'text/plain', Data => $text_out, ); $msg->attach( Type => 'text/html', Data => $html_out, ); } $msg->send;


Comment on Re: Send mail help
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-12-20 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls