Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using sendmail perl module but it does not always send email and I don't get any error value returned from my die statement :
my $sender = new Mail::Sender{smtp => 'localhost'}; ref ($sender->MailMsg({to => $mailing_address, from => 'X Y Z', subject => 'HELP HELP, msg => $inputLine})) || die "$Mail::Sender::Error\n"
-- Am i doing anything wrong or is there an problem with localhost?? -----code_of_the_day

Replies are listed 'Best First'.
Re: sendmail module problems
by tachyon (Chancellor) on Jul 07, 2001 at 01:42 UTC

    Hi your usage seems incorrect, here is an example from the official Mail::Sender documentation which you can see here

    If everything you need is to send a simple message you may use: use Mail::Sender; ref ($sender = new Mail::Sender({ from => 'somebody@somewhere.com', smtp => 'ms.chipnet.cz'}) ) or die "$Mail::Sender::Error\n"; (ref ($sender->MailMsg({ to => 'Jenda@Krynicky.czX', subject => 'this is a test', msg => "Hi Johnie.\nHow are you?"}) ) and print "Mail sent OK." ) or die "$Mail::Sender::Error\n"; __END__

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: sendmail module problems
by arhuman (Vicar) on Jul 07, 2001 at 01:38 UTC
    RTFL ;-)
    Check your MTA (Sendmail, Postfix...) logs !
    The answer is probably there waiting for you

    Note: I can't test your code yet and assume the syntax error I can see is a typo...
    and that your script doesn't die (wasn't so clear for me...)

    "Only Bad Coders Code Badly In Perl" (OBC2BIP)