sending mail using perl through windows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sending mail using perl through windows
# 1  
Old 01-06-2006
Question sending mail using perl through windows

Hi all this is the code which i tried executing in windows environment to send a test mail.

Code:
# Perl script to send mail on deliver complete.

package SendMail;
use Config;
use Mail::Send; 
@ISA = qw(Mail::Send); 
sub open {
my $me = shift;
my $how; # How to send mail
my $notused;
my $mailhost; 
# On Windows use SMTP 
if ($Config{'osname'} eq 'MSWin32') {
$how = 'smtp';
$mailhost = "smtp.dev.xxxxxxxx.com";
} 
# else use defaults supplied by Mail::Mailer 
Mail::Mailer->new($how, $notused, $mailhost)->open($me);
} 
#
##################################################################
# Main program 
my @to = "zzzz@dev.xxxxxxxxx.com";
my $subject = "Delivery complete"; 
my $body = join '',( "this is testing from perl in windows");
my $msg = new SendMail(Subject=>$subject); 
$msg->to(@to);
my $fh = $msg->open($me);
$fh->print($body);
$fh->close();
1; # return success
#
##################################################################

But i am getting an error as follows
[CODE>
Can't locate Mail/Send.pm in @INC (@INC contains: c:/Perl/lib c:/Perl/site/lib .
) at ml.pl line 10.
BEGIN failed--compilation aborted at ml.pl line 10.
[/CODE]

I have checked C:/Perl/lib, Send.pm doesnt exist.
how do i get this script run so that i can send mail using perl in the windows environment.


regard
Victor vinod Kumar
# 2  
Old 01-06-2006
Mail::Send (and Mail::Mailer) is in the "MailTools" package. Assuming you are using the Activestate Perl distribution, you can try to install this package from PPM, if available.

Please read the PPM help documents that come with Activestate Perl if you don't know how to use it.

As I last checked, that package is available from the PPM.
# 3  
Old 01-06-2006
Thanks

I'll Surely Check it.


Regards
Victor Vinod Kumar
# 4  
Old 01-06-2006
Hi

My System has already PPM installed , I have downloaded the source file of Mail:Send in placed in C:\perl\lib .
the problem is still not solved.what do i need to do further in making this script run

this is error displayed after downloading the source of Mail:Send ( i.e Send.pm) and placing it in the c:\perl\lib.


Code:
Can't locate Mail/Send.pm in @INC (@INC contains: c:/Perl/lib c:/Perl/site/lib .
) at ml.pl line 10.
BEGIN failed--compilation aborted at ml.pl line 10.

would you please provide me the links for installing the above said package

Thanks for the response though,

regards
victor vinod kumar
# 5  
Old 01-06-2006
Mail:Send

You need to place send.pm file under the folder Mail, not directly under lib...
Mail folder should be under lib...

Instead of downloading and copying it manually..

Run ppm and say install mail-send, it will automatically copy the files and also installs the dependencies.
# 6  
Old 01-06-2006
Quote:
Originally Posted by mahendramahendr
Run ppm and say install mail-send, it will automatically copy the files and also installs the dependencies.
The command should be "install MailTools" in this case, since Mail::Send is part of the "MailTools" bundle. If MailTools is not installed, the mailer script may fail for the lack of other modules even though you have Mail::Send.
# 7  
Old 01-10-2006
Power

Hi mahendramahendr & cbkihong

Thank you very very much , I was able to install send.pm file by specifying the command which cbkihong gave me that is "install MailTools".

and my script is working perfectly. Smilie

Thank you very much once again...


Regards
Very gratefully
Victor Vinod Kumar
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

2. Shell Programming and Scripting

sending mail in perl.. No errors and also no output

Hi folks, I am trying to send an email in Perl script with the below code. I have written the code in Padre IDE and installed all the required modules(Mail::Sendmail) and executed the code. It is neither showing errors nor giving the output. I havnt received an mail after running the below... (1 Reply)
Discussion started by: giridhar276
1 Replies

3. Shell Programming and Scripting

Stop sending mail after certain number of mail

Hi guys... I am busy writing a script to notify me via an mail if my application is down. I have done that. Now I want this script to stop sending mails after five mails were sent but the script should keep on checking the application. When the application is up again that count should be... (5 Replies)
Discussion started by: Phuti
5 Replies

4. Shell Programming and Scripting

Perl: Sending file from UNIX server to Windows server

I'm trying to write a Perl script where a file from a UNIX server box connects to a Windows server box and copies that file into the Window box. The main problem I have right now is that whenever I try to connect to the Windows box, the connection is refused. The error message that always pops... (2 Replies)
Discussion started by: kooshi
2 Replies

5. UNIX for Dummies Questions & Answers

Need help configuring Active Perl on Windows Vista.: Perl Scripting on Windows

Hi All, Need help configuring Active Perl on Windows Vista. I am trying to install Active Perl on Windows Vista. The version of Active Perl i am trying to install is : ActivePerl 5.10.1 Build 1006 After installing it through cmd, When i try to run perl -v to check the version, i get the... (2 Replies)
Discussion started by: Vabiosis
2 Replies

6. UNIX for Dummies Questions & Answers

sending mail

i want to send an email from the unix machine to the windows machine. now windows dont have any specified folder for the mail. mail has to be sent to the email-id like abc@xyz.com unix machine itself can not directly send mail. it has to be transferred via mail server. (11 Replies)
Discussion started by: parmeet
11 Replies

7. Shell Programming and Scripting

sending mail from perl using mailx

hi All, i am trying to send a mail from perl using mailx. the script runs fine if i hard code the file path which is to be attached to the mail. but when i give a variable containing the path of the file , perl is not able to send the file. ex: system('uuencode /attach/test.txt... (3 Replies)
Discussion started by: adityamahi
3 Replies

8. Ubuntu

help sending mail

Hi, I have kubuntu 8.10 and I would like to configure Ubuntu to can send mail from command line with mailx. I've saw that I need to install a MTA. But I don't know with install and how. Do you know some howto or url where I find how could I configure it? Many thanks and sorry for my... (2 Replies)
Discussion started by: mierdatuti
2 Replies

9. HP-UX

hp ux not sending mail

Hi.. In Hp ux box,, mails are not being sent. they are getting queued up in mail queue. (3 Replies)
Discussion started by: kkhan
3 Replies

10. UNIX for Dummies Questions & Answers

sending a mail to a mail client

Hi everyone! I'm trying to create a database monitoring script that reads an alert file and sends an error message if it can 'grep' a particular string. Is there a way to send this message to a mail client using SMTP? Even better, is there any place on this site that has these kinds of... (5 Replies)
Discussion started by: solaris73
5 Replies
Login or Register to Ask a Question