Sending a file as email body
|
|||
|
Rank: ? (1)
Member #: 25297 |
I'm writing a script that will pull the daily weather forecast for several locations and put put it all togeather into a html file. I then want to take that file and send it as a HTML formatted email to a subscriber list. So far I have been able to get all of the information, format the information, and put it into the html file. The problem I am running into is opening the file and sending it as the body of a email. Here is the code I am using (please excuse the mess I am new to PERL) any assistance would be appreciated.
use Net::SMTP; $from = 'someone@nowhere.com'; $to = 'somewhere_else@outthere.net'; $subject = 'Daily Weather Forecast'; local (*BODY, $/, $_); open(BODY, '<./datfiles/forecast.htm') or die $!; $body = <BODY>; close(BODY); $smtp = Net::SMTP->new('smtp.knology.net'); $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("Body: $body\n"); $smtp->dataend(); $smtp->quit; » Post edited 2005-09-12, 08:43pm by Armethous.
|
||
|
Please login or register to post a reply.