Hi,
I need to send email through perl using CSS.Eventhough the mail is sent,all i see in my thunderbird is html code.
Css file:
Code:
table.pretty {
margin: 1em 1em 1em 2em;
background: whitesmoke;
border-collapse: collapse;
}
table.pretty th, table.pretty td {
border: 1px silver solid;
padding: 0.2em;
}
table.pretty th {
background: gainsboro;
text-align: left;
}
table.pretty caption {
margin-left: inherit;
margin-right: inherit;
}
Script:
Code:
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Lite;
my $text2=<<CSS;
<html><body>
<LINK REL=StyleSheet HREF="pretty.css" TITLE="Contemporary">
<table class="pretty.css">
<tr>
<th>Key</th><th>Value</th>
</tr>
<tr>
<td>ACT</td><td>Australian Capital Territory</td>
</tr>
<tr>
<td>NSW</td><td>New South Wales</td>
</tr>
<tr>
<td>NT</td><td>Northern Territory</td>
</tr>
<tr>
<td>QLD</td><td>Queensland</td>
</tr>
<tr>
<td>SA</td><td>South Australia</td>
</tr>
<tr>
<td>TAS</td><td>Tasmania</td>
</tr>
<tr>
<td>VIC</td><td>Victoria</td>
</tr>
<tr>
<td>WA</td><td>Western Australia</td>
</tr>
</table>
</body>
</html>
CSS
my $msg = MIME::Lite->new(
From => 'user@id.com',
To => 'user@id.com',
Subject => "test",
Type => "text/css",
Encoding => 'base64',
Data => "$text2"
);
$msg->attach(Type=> 'multipart/mixed',
Path =>'/home/user/pretty.css',
Filename =>'pretty.css',);
$msg->send;
This works but with out stylesheets if i use text/html,and i see html code if iuse text/css.Thanks