By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,663 Members | 1,375 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,663 IT Pros & Developers. It's quick & easy.

Having problem in Email::Send through windows ?

P: 65
Hi All,

I need to send a email based on the flag value, am using Email::Send module(CPAN).
Requirement :
1.Based on the $email_flag, call the send_email function so, script goes like this:
Expand|Select|Wrap|Line Numbers
  1. ## In main function ##
  2.  
  3. if($email_flag == 1){
  4.    &send_email; ## calling the send_email sub-function
  5.    }
  6.   else{
  7. print "There is some problem for process execution\n please check the script\n";
  8.        }
  9.  
  10. ### sub - function ####
  11. sub send_email {
  12. my $msg = q(From: abc.xyz@xyz.com
  13.     To:xyz.abc@xyz.co.uk
  14.     Subject:Time to Analyse - Report !!!
  15.     );
  16.         Email::Send->new({mailer => 'Sendmail'})->send($msg);
  17.     }
  18.  
When i run this script, it goes to the sen_email sub function but only problem is
not getting the mail.
don't know where is the mistake nor the script give any clue while running...
Am using Acitvestate perl v5.10.0 & OS is win2k.
Is there any other method where i can send simple mail ???

Regards,
Vijayarl
Sep 22 '08 #1
Share this Question
Share on Google+
1 Reply


Icecrack
Expert 100+
P: 174
so when you call the function you should place debug method


Expand|Select|Wrap|Line Numbers
  1. &send_email || die "Error: $!"; 

or try this,

Expand|Select|Wrap|Line Numbers
  1. if (my $error = $sender->send($message)) {
  2.     die $error;
  3. }
  4.  
this should give you more detail.

also i don't think that this is for Windows OS,

but please try printing this out

Expand|Select|Wrap|Line Numbers
  1. use Email::Send;
  2.  
  3. my @available = $sender->all_mailers;

this would print if you have any mailers that can send the mail with this module
Sep 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.