I found an excellent example of making one on a site and I was able to configure it and it worked like a charm! And it uses MIME::Lite so kudos to
marto! Thanks bro! CASE CLOSED! I didn't even need Sendmail for this to work! Excellent!
Below is the script I found (I modified it a bit so I could get it through my head...Original link is here
http://www.bernzilla.com/item.php?id=483
=======================================================
#!/usr/bin/perl
# use MIME::Lite package
use MIME::Lite;
# set up email
$to = "toemail\@gmail.com";
$from = "fromemail\@inbox.com";
$subject = "Email Sent via Perl";
$message = "This email was sent using Perl.";
$file = "sample.txt";
# send email
email($to, $from, $subject, $message, $file);
# email function
sub email
{
# get incoming parameters
local ($to, $from, $subject, $message, $file) = @_;
# create a new message
$msg = MIME::Lite->new(
From => $from,
To => $to,
Subject => $subject,
Data => $message
);
# add the attachment
$msg->attach(
Type => "text/plain",
Path => $file,
Filename => $file,
Disposition => "attachment"
);
# send the email
MIME::Lite->send('smtp', 'smtp.yourisp.net', 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.