Net::SMTP error: Can't locate Mail/Sender.pm in @INC

Discussion in 'Perl Misc' started by 50295, May 19, 2005.

  1. 50295

    50295 Guest

    Hi!

    I'm trying to get this short email script to work:

    ####################################################

    #!/usr/bin/perl -w

    use strict;
    use warnings;
    use Net::SMTP;
    use Net::pOP3;


    my $mailhost = "smtp.mail.net";
    my $mailobj = "";

    if($mailobj = Net::SMTP->new($mailhost, Timeout=>10, Debug=>0)){
    print("Connected to $mailhost\n");
    } else {
    print("Could not connect to $mailhost\n");
    die;
    }


    my $username = "nobody\@mail.net";
    my $password = "secret";

    my $Rx1 = "invisible\@email.net";
    my $Rx2 = "nonsense\@web.net";
    my $from = "nobody\@mail.net";

    $mailobj->mail($from);
    $mailobj->recipient($Rx1, $Rx2,{SkipBad=>1});

    if($mailobj->data()){
    $mailobj->datasend("To:$Rx1\r\n");
    $mailobj->datasend("cc:$Rx2\r\n");
    $mailobj->datasend("Subject: Email from Perl script using web.de
    with authentication\r\n");
    $mailobj->datasend("This is a test message\n");
    print("Data sent successfully \n");
    } else {
    print("Send failed\n");
    }

    $mailobj->dataend() ;
    $mailobj->quit;

    #################################

    It works fine on WinXP but fails on Linux Redhat with the following
    error:

    Can't locate Authen/SASL.pm in @INC (@INC contains:
    /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl
    /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at
    /usr/lib/perl5/5.8.0/Net/SMTP.pm line 101.

    What can I do about this error?

    Thanks,

    - Olumide
     
    50295, May 19, 2005
    #1
    1. Advertisements

  2. 50295

    50295 Guest


    Problem is that I'm not the sys admin :-( . Is there another Perl
    module that does mail sending with authentication?

    Thanks,

    - Olumide
     
    50295, May 19, 2005
    #2
    1. Advertisements

  3. 50295

    50295 Guest

    The problem is with the authentication,
    $mailobj->auth($username, $password);

    Not the connecting to the smtp server. How can telnet or a socket
    connection perfom authentication?

    - Olumide
     
    50295, May 19, 2005
    #3
  4. The subject line does not match the rest of the message.

    Anyway, in a sub-thread in clpmisc you explained that you need to send
    emails with authentication, so the Mail::Sender module is problably a
    good tool. Install it, and follow the Mail::Sender documentation.

    Btw, Mail::Sender is a plain Perl module, so if you can't install it the
    regular way, you can just place Mail/Sender.pm in any suitable directory.
     
    Gunnar Hjalmarsson, May 19, 2005
    #4
  5. Mark Clements, May 19, 2005
    #5
  6. 50295

    50295 Guest

    50295, May 19, 2005
    #6
  7. Better still, try installing the module that it's actually looking for
    here: Authen::SASL.

    sherm--
     
    Sherm Pendley, May 19, 2005
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.