Sponsored Content
Top Forums Shell Programming and Scripting sending mail using perl through windows Post 95061 by victorvvk on Friday 6th of January 2006 05:18:26 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Mail::Util(3)						User Contributed Perl Documentation					     Mail::Util(3)

NAME
Mail::Util - mail utility functions INHERITANCE
Mail::Util is a Exporter SYNOPSIS
use Mail::Util qw( ... ); DESCRIPTION
This package provides several mail related utility functions. Any function required must by explicitly listed on the use line to be exported into the calling package. FUNCTIONS
mailaddress Return a guess at the current users mail address. The user can force the return value by setting the MAILADDRESS environment variable. WARNING: When not supplied via the environment variable, <mailaddress> looks at various configuration files and other environmental data. Although this seems to be smart behavior, this is not predictable enough (IMHO) to be used. Please set the MAILADDRESS explicitly, and do not trust on the "automatic detection", even when that produces a correct address (on the moment) example: # in your main script $ENV{MAILADDRESS} = 'me@example.com'; # everywhere else use Mail::Util 'mailaddress'; print mailaddress; maildomain Attempt to determine the current uers mail domain string via the following methods o Look for the MAILDOMAIN enviroment variable, which can be set from outside the program. This is by far the best way to configure the domain. o Look for a sendmail.cf file and extract DH parameter o Look for a smail config file and usr the first host defined in hostname(s) o Try an SMTP connect (if Net::SMTP exists) first to mailhost then localhost o Use value from Net::Domain::domainname (if Net::Domain exists) WARNING: On modern machines, there is only one good way to provide information to this method: the first; always explicitly configure the MAILDOMAIN. example: # in your main script $ENV{MAILDOMAIN} = 'example.com'; # everywhere else use Mail::Util 'maildomain'; print maildomain; read_mbox(FILE) Read FILE, a binmail mailbox file, and return a list of references. Each reference is a reference to an array containg one message. WARNING: This method does not quote lines which accidentally also start with the message separator "From", so this implementation can be considered broken. See Mail::Box::Mbox SEE ALSO
This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/. AUTHORS
The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development. Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog. LICENSE
Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark Overmeer <perl@overmeer.net>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.12.1 2010-01-26 Mail::Util(3)
All times are GMT -4. The time now is 07:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy