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....