I use this script to log into my deviantART account and mail me a copy of the page that displays the new art that has been submitted by the people I watch. I have removed my info from it but it can easily be customized for pulling the information from any website and sending it in an email.
#!/usr/bin/perl -w
use strict;
use WWW::Mechanize;
use MIME::Lite;
#Create new WWW::Mechanize Object to fetch the web page
my $mech = WWW::Mechanize->new();
#Fetch the page. The example is http://www.deviantart.com/
#but that could be replaced with anything
$mech->get( "http://www.deviantart.com/");
#Assign the page content to a scalar
my $message_body = $mech->content;
#Create the MIME::Lite Object to send the email to
my $msg = MIME::Lite->new (
From => 'someone@somedomain.com',
To => 'someone@somedomain.com',
Subject => 'Daily DeviantART Digest',
Type => 'multipart/mixed',
)
#Attach the body part of the email which is the actual web page
$msg->attach (
Type => 'text/html',
Data => qq{$message_body},
)
#This sends the email via the local smtp server. I chose this
#method so that it could be changed to a remote server if
#needed but per the MIME::Lite documentation, this can
#also be changed to send through the sendmail executable
MIME::Lite->send'(smtp', 'localhost', Timeout=>60);
$msg->send;
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.