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....
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|