Email from DOS prompt using Perl

How can I email from DOS prompt using Perl script? I want to write a perl script that finds the IP address of the machine every 2 hours and send a user an email containing that IP address. An example script would be great. Operating system is NT Terminal Server and Outlook is properly configured on that.
masoudkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
khacharnConnect With a Mentor Commented:
hi masoudk..
what malec has suggested is great  and i was using the same MIME module UNTIL i cam across BLAT..
BLAT is a command line utility (.exe) program to send mails..
eg.
***************************************
blat file.txt -t masoudk@ee.com -b malec@ee.com -attach file.html
***************************************
What this does is it send a mail to masoudk@ee.com and a bcc to malec@ee.com with file.html as attachment and the body of the email will contain file.txt(contents of file.txt)
I think this is what you are looking for..
You can find more on BLAT at
http://www.interlog.com/~tcharron/blat.html..
IF you want you can give me your e-mail and i will send you the Blat.exe file
And Believe me..my life,my mailing programs have become real cool afeter i started using Blat
Regards
Nitin
0
 
malecCommented:
use MIME::Lite;

$msg = new MIME::Lite
                From    =>'me@myhost.com',
                To      =>'you@yours.com',
                Subject =>'A message from me..',
                Type    =>'TEXT',
               Path    => "ff";
MIME::Lite->send('smtp', "smtp.yourmailserver.ca", Timeout=>60);
$msg->send;

0
 
malecCommented:
Here's the whole thing. runs on NT.
Will need to install MIME::Lite (use ppm, install MIME-LITE)

Use it with scheduler.

#!/usr/bin/perl
use MIME::Lite;

`ipconfig.exe > ff`;
$ARGV[0] = 'ff';
for (<>) {
  $ip .= "$_\n" if(/IP Address/);
  }

$msg = new MIME::Lite
                From    =>'me@myhost.com',
                To      =>'d@perlnow.com',
                Subject =>'IP Address',
                Type    =>'TEXT',
                Data    => "$ip";

MIME::Lite->send('smtp', "smtp.sprint.ca", Timeout=>60);
$msg->send;



0
All Courses

From novice to tech pro — start learning today.