#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    3
    Rep Power
    0

    Post Unable to test Mail-Sendmail module of perl


    Hi All,
    Very good morning.
    I have installed Mail-Sendmail-0.79 module of perl to try few things.The readme says that I have to edit the test.pl to check if the mail is sent to my email ID.I have edited the test.pl according.But I have few queires here

    Code:
    # if you want to get a copy of the test mail, you need to specify your
         16 # own server here, by name or IP address
         17 $server = 'xx.xx.xx.xx';
         18 #$server = 'my.usual.mail.server';
    I am not sure of the IP address of the mail server that I am using.If I want to get the test mail to my yahoo account what settings do I need to give?


    This is the error that I am getting when I run the make test command
    PERL_DL_NONLAZY=1 /bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
    1..2
    Test Mail::Sendmail 0.79

    Trying to send a message to the author (and/or whoever if you edited test.pl)

    (The test is designed so it can be run by Test::Harness from CPAN.pm.
    Edit it to send the mail to yourself for more concrete feedback. If you
    do this, you also need to specify a different mail server, and possibly
    a different From: address.)

    Current recipient(s): 'Sendmail Test <xyz@yahoo.com>'

    ok 1
    Server set to: xx.xx.xx.xx
    Sending...
    connect to localhost failed (Invalid argument) no (more) retries!
    !Error sending mail:
    connect to 10.187.58.70 failed (Connection refused)
    connect to 10.187.58.70 failed
    connect to localhost failed (Connection refused)
    connect to localhost failed
    connect to localhost failed (Invalid argument) no (more) retries!
    Can anyone please tell me what I am doing wrong?

    Ajit
  2. #2
  3. No Profile Picture
    PerlGuy
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Posts
    720
    Rep Power
    42
    code?
    - dsb -
    Perl Guy
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    3
    Rep Power
    0

    Question


    How do i send a test mail to my yahoo account.I havent written any code yet.Its just the test.pl I am trying to run.
  6. #4
  7. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,264
    Rep Power
    1810
    That information is specific to your email provider. You need to go to the source.

    Try: http://help.yahoo.com/l/us/yahoo/sma...op/pop-03.html
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    3
    Rep Power
    0

    Question


    Keath,
    Thanks for the reply.What do I have to put in the server entry of the test.pl
    The code of test.pl is

    Code:
    #!/usr/bin/perl -w
    
    # unattended Mail::Sendmail test, sends a message to the author
    # but you probably want to change $mail{To} below
    # to send the message to yourself.
    # version 0.78
    
    # if you change your mail server, you may need to change the From:
    # address below.
    $mail{From} = 'Sendmail Test <xyz.yahoo.com>';
    
    $mail{To}   = 'Sendmail Test <abc.yahoo.com>';
    #$mail{To}   = 'Sendmail Test <sendmail@alma.ch>, You me@myaddress';
    
    # if you want to get a copy of the test mail, you need to specify your
    # own server here, by name or IP address
    $server = '10.187.58.70';
    #$server = 'my.usual.mail.server';
    
    BEGIN { $| = 1; print "1..2\n"; }
    END {print "not ok 1\n" unless $loaded;}
    
    print <<EOT
    Test Mail::Sendmail $Mail::Sendmail::VERSION
    
    Trying to send a message to the author (and/or whoever if you edited test.pl)
    
    (The test is designed so it can be run by Test::Harness from CPAN.pm.
    Edit it to send the mail to yourself for more concrete feedback. If you
    do this, you also need to specify a different mail server, and possibly
    a different From: address.)
    
    Current recipient(s): '$mail{To}'
    
    EOT
    ;
    
    use Mail::Sendmail;
    
    $loaded = 1;
    print "ok 1\n";
    
    if ($server) {
        $mail{Smtp} = $server;
        print "Server set to: $server\n";
    }
    
    $mail{Subject} = "Mail::Sendmail version $Mail::Sendmail::VERSION test";
    
    $mail{Message} = "This is a test message sent with Perl version $] from a $^O system.\n\n";
    $mail{Message} .= "It contains an accented letter:  (a grave).\n";
    $mail{Message} .= "It was sent on " . Mail::Sendmail::time_to_date() . "\n";
    
    # Go send it
    print "Sending...\n";
    
    if (sendmail %mail) {
        print "content of \$Mail::Sendmail::log:\n$Mail::Sendmail::log\n";
        if ($Mail::Sendmail::error) {
            print "content of \$Mail::Sendmail::error:\n$Mail::Sendmail::error\n";
        }
        print "ok 2\n";
    }
    else {
        print "\n!Error sending mail:\n$Mail::Sendmail::error\n";
        print "not ok 2\n";
    }

IMN logo majestic logo threadwatch logo seochat tools logo