http://www.e-nef.com/perl/ntperl.html.en
http://qaix.com/perl-web-programming/84-789-perl2exe-read.shtml
http://alma.ch/perl/Mail-Sendmail-FAQ.html
http://www.perl.com/pub/a/2003/09/03/perlcookbook.html?page=2
SOURCES:
# ppm install MIME::Lite
#perldoc MIME::Lite
$msg = MIME::Lite->new(
To =>'you@yourhost.com',
Subject =>'HTML with in-line images!',
Type =>'multipart/related'
);
$msg->attach(Type => 'text/html',
Data => qq{ <body>
Here's <i>my</i> image:
<img src="cid:myimage.gif">
</body> }
);
$msg->attach(Type => 'image/gif',
Id => 'myimage.gif',
Path => '/path/to/somefile.gif',
);
$msg->send();
How to send attachments?
In a way very similar to the HTML mail above. Be aware that you will put the whole file(s) in memory, so this method isn't suitable for very big files. For files of reasonable size though, you can adapt this example:
==================================================START
use HTML::Entities;
use Mail::Sendmail 0.75; # doesn't work with v. 0.74!
$html = <<END_HTML;
<p><strong>HTML mail demo</strong>
<p>This is the message text
<p>It will only be displayed correctly by HTML-capable Mail clients
since it has no "text/plain" alternative part.
END_HTML
$html .= "<p>" . encode_entities("Voilà du texte qui sera encodé") . "\n"
. "<pre>This is text in " . encode_entities("<pre> and <code> tags") . "</code></pre>\n"
;
%mail = (
from => 'you@domain.tld',
to => 'whoever@someplace.tld',
subject => 'Test HTML mail',
'content-type' => 'text/html; charset="iso-8859-1"',
);
$mail{body} = <<END_OF_BODY;
<html>$html</html>
END_OF_BODY
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
==================================================END
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!