| 1 |
WHAT IS THIS ? |
| 2 |
|
| 3 |
This is MIME::Lite::HTML, a module which provide routine |
| 4 |
to transform a HTML page in a MIME::Lite mail |
| 5 |
|
| 6 |
HOW DO I INSTALL IT ? |
| 7 |
|
| 8 |
To install this module, cd to the directory that contains |
| 9 |
this README file and type the following: |
| 10 |
|
| 11 |
perl Makefile.PL |
| 12 |
make |
| 13 |
make test |
| 14 |
make install |
| 15 |
|
| 16 |
If you can't do that, you can put HTML.pm file in |
| 17 |
directory $root/MIME/Lite/HTML.pm and then put use lib |
| 18 |
$root in your program (make same thing if you haven't MIME-Lite |
| 19 |
module). |
| 20 |
So it give: |
| 21 |
$root/MIME/Lite/HTML.pm |
| 22 |
$root/MIME/Lite.pm |
| 23 |
|
| 24 |
and in your script: |
| 25 |
|
| 26 |
#!/usr/bin/perl |
| 27 |
use lib '/home/alian/mylibperl'; |
| 28 |
use MIME::Lite; |
| 29 |
use MIME::Lite::HTML; |
| 30 |
|
| 31 |
REQUIREMENT ? |
| 32 |
|
| 33 |
libnet, MIME::Lite |
| 34 |
|
| 35 |
DOCUMENTATION ? |
| 36 |
|
| 37 |
You'll find documentation in the file HTML.pm in POD format |
| 38 |
See too the eg directory |
| 39 |
|
| 40 |
When you install MIME::Lite::HTML, the MakeMaker program |
| 41 |
will automatically install the manual pages for you |
| 42 |
(on Unix systems, type "man MIME::Lite::HTML"). |
| 43 |
|
| 44 |
Here an extract of POD documentation: |
| 45 |
|
| 46 |
NAME |
| 47 |
MIME::Lite::HTML - Provide routine to transform a HTML page in a |
| 48 |
MIME-Lite mail |
| 49 |
|
| 50 |
SYNOPSIS |
| 51 |
use MIME::Lite::HTML; |
| 52 |
|
| 53 |
my $mailHTML = new MIME::Lite::HTML |
| 54 |
From => '[email protected]', |
| 55 |
To => 'alian@saturne', |
| 56 |
Subject => 'Mail in HTML with images'; |
| 57 |
|
| 58 |
$MIMEmail = $mailHTML->parse('http://www.alianwebserver.com'); |
| 59 |
$MIMEmail->send; # or for win user : $mail->send_by_smtp('smtp.fai.com'); |
| 60 |
|
| 61 |
DESCRIPTION |
| 62 |
This module is a Perl mail client interface for sending message that |
| 63 |
support HTML format and build them for you.. This module provide routine |
| 64 |
to transform a HTML page in MIME::Lite mail. So you need this module to |
| 65 |
use MIME-Lite-HTML possibilities |
| 66 |
|
| 67 |
What's happen ? |
| 68 |
|
| 69 |
The job done is: |
| 70 |
|
| 71 |
* Get the file (LWP) if needed |
| 72 |
|
| 73 |
* Parse page to find include images |
| 74 |
|
| 75 |
* Attach them to mail with adequat header if asked (default) |
| 76 |
|
| 77 |
* Include external CSS,Javascript file |
| 78 |
|
| 79 |
* Replace relative url with absolute one |
| 80 |
|
| 81 |
* Build the final MIME-Lite object with each part found |
| 82 |
|
| 83 |
Usage |
| 84 |
|
| 85 |
Did you alread see link like "Send this page to a friend" ?. With this |
| 86 |
module, you can do script that to this in 3 lines. |
| 87 |
|
| 88 |
It can be used too in a HTML newsletter. You make a classic HTML page, |
| 89 |
and give just url to MIME::Lite::HTML. |
| 90 |
|
| 91 |
Construction |
| 92 |
|
| 93 |
MIME-Lite-HTML use a MIME-Lite object, and RFC2257 construction: |
| 94 |
|
| 95 |
If images and text are present, construction use is: |
| 96 |
|
| 97 |
--> multipart/alternative |
| 98 |
------> text/plain |
| 99 |
------> multipart/related |
| 100 |
-------------> text/html |
| 101 |
-------------> each images |
| 102 |
|
| 103 |
If no images but text is present, this is that: |
| 104 |
|
| 105 |
---> multipart/alternative |
| 106 |
-------> text/plain if present |
| 107 |
-------> text/html |
| 108 |
|
| 109 |
If images but no text, this is: |
| 110 |
|
| 111 |
---> multipart/related |
| 112 |
-------> text/html |
| 113 |
-------> each images |
| 114 |
|
| 115 |
If no images and no text, this is: |
| 116 |
|
| 117 |
---> text/html |
| 118 |
|
| 119 |
Documentation |
| 120 |
|
| 121 |
Additionnal documentation can be found here: |
| 122 |
|
| 123 |
* MIME-lite module |
| 124 |
|
| 125 |
* RFC 822, RFC 1521, RFC 1522 and specially RFC 2257 (MIME |
| 126 |
Encapsulation of Aggregate Documents, such as HTML) |
| 127 |
|
| 128 |
Clients tested |
| 129 |
|
| 130 |
HTML in mail is not full supported so this module can't work with all |
| 131 |
email clients. If some client recognize HTML, they didn't support images |
| 132 |
include in HTML. So in fact, they recognize multipart/relative but not |
| 133 |
multipart/related. |
| 134 |
|
| 135 |
Netscape Messager (Linux-Windows) |
| 136 |
100% ok |
| 137 |
|
| 138 |
Outlook Express (Windows) |
| 139 |
100% ok |
| 140 |
|
| 141 |
Eudora (Windows) |
| 142 |
If this module just send HTML and text, (without images), 100% ok. |
| 143 |
|
| 144 |
With images, Eudora didn't recognize multipart/related part as |
| 145 |
describe in RFC 2257 even if he can read his own HTML mail. So if |
| 146 |
images are present in HTML part, text and HTML part will be |
| 147 |
displayed both, text part in first. Two additional headers will be |
| 148 |
displayed in HTML part too in this case. Version 1.0 of this module |
| 149 |
correct major problem of headers displayed with image include in |
| 150 |
HTML part. |
| 151 |
|
| 152 |
KMail (Linux) |
| 153 |
If this module just send HTML and text, (without images), 100% ok. |
| 154 |
|
| 155 |
In other case, Kmail didn't support image include in HTML. So if you |
| 156 |
set in KMail "Prefer HTML to text", it display HTML with images |
| 157 |
broken. Otherwise, it display text part. |
| 158 |
|
| 159 |
Pegasus (Windows) |
| 160 |
If this module just send HTML and text, (without images), 100% ok. |
| 161 |
|
| 162 |
Pegasus didn't support images in HTML. When it find a |
| 163 |
multipart/related message, it ignore it, and display text part. |
| 164 |
|
| 165 |
If you find others mail client who support (or not support) |
| 166 |
MIME-Lite-HTML module, give me some feedback ! If you want be sure that |
| 167 |
your mail can be read by maximum of people, (so not only OE and |
| 168 |
Netscape), don't include images in your mail, and use a text buffer too. |
| 169 |
If multipart/related mail is not recognize, multipart/alternative can be |
| 170 |
read by the most of mail client. |
| 171 |
|
| 172 |
|
| 173 |
Have fun, and let me know how it turns out! |
| 174 |
|
| 175 |
Alain BARBET |
| 176 |
[email protected] |