Hi Monks
I am trying to grab a html page and send it as a html e-mail, but it's not working properly.
I am sending it, but the page doesn't show as html, it's showing the source html code instead.
Can anyone tell what is wrong here or how I could accomplish this better?
Thanks a lot!!!!
Here is my code:
my $content = get( "http://pagetest.html" ) or die $!;
my @mailto;
$mailto[0]="ok1\@ok.com";
$mailto[1]="ok2\@ok.com";
$mailto[2]="ok3\@ok.com";
foreach my $element (@mailto) {
my $sock = IO::Socket::INET->new (PeerAddr => 'my.mail.server.ip',
Type =>'Content-type: text/html; charset=us-ascii'
+,
PeerPort => 'smtp(25)',
Proto => 'tcp')|| die "That sucks, I can't open a
+port on the mail server. I'm going to take all my toys and go home no
+w..";
my $input = <$sock>;
print $sock "HELLO localhost\r\n";
$input = <$sock>;
print $sock "mail from:master-ok\@ok.com\r\n";
$input = <$sock>;
print $sock "rcpt to:$element\r\n";
print "rcpt to:$element\r\n";
$input = <$sock>;
print $sock "DATA\r\n";
print $sock "Subject: Hell is breaking loose!";
print $sock "From: Server Hell\r\n";
print $sock "To: $element\r\n";
print $sock "\r\n";
print $sock "$content\r\n";
print $sock ".\r\n";
$input = <$sock>;
print $sock "QUIT";
close ($sock);
}
Thanks....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.