Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Send mail help

by dwm042 (Priest)
on Jun 29, 2011 at 22:14 UTC ( [id://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;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-24 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found