Having problem in Email::Send through windows ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vijayarl
    New Member
    • Sep 2008
    • 65

    #1

    Having problem in Email::Send through windows ?

    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:
    Code:
    ## In main function ##
    
    if($email_flag == 1){
       [B]&send_email;[/B] ## calling the send_email sub-function
       }
      else{
    print "There is some problem for process execution\n please check the script\n";
           }
    
    ### sub - function ####
    sub send_email {
    my $msg = q(From: abc.xyz@xyz.com
    	To:xyz.abc@xyz.co.uk
    	Subject:Time to Analyse - Report !!!
    	);
    		Email::Send->new({mailer => 'Sendmail'})->send($msg);
    	}
    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
  • Icecrack
    Recognized Expert New Member
    • Sep 2008
    • 174

    #2
    so when you call the function you should place debug method


    Code:
    &send_email || die "Error: $!";

    or try this,

    Code:
    if (my $error = $sender->send($message)) {
        die $error;
    }
    this should give you more detail.

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

    but please try printing this out

    Code:
    use Email::Send;
    
    my @available = $sender->all_mailers;

    this would print if you have any mailers that can send the mail with this module

    Comment

    Working...