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

This is driving me nuts.

I'm use Net::SMTP, and have been for a few weeks now. It works fine from my machine, but I'm rebooting/rebuilding etc. pretty constantly, so I need to run it from a more stable machine.

I was never able to get it to run off of a server I've got, but goofed around enough last night to where it worked (I don't know how). Now, this morning it isn't working again. :(

After digging around, it seems that when I use a mail client, it caches my password, so i can send it out w/ authentication. (I just started a mail client on this server, sent a test mail, closed the client, tried my script again, and it worked.)

I remember looking around and finding the syntax for sending an authorized mail w/ Net::SMTP, but can't seem to find it. I guess in short, I'm asking for that syntax. Something like
$smtp->authen('me@me.com' 'password')
if memory serves. I have installed Authen.pm as well.

Not that great of a solution though as I need to make an extra mail account who's password I don't mind being out in the open.

Replies are listed 'Best First'.
Re: Net::SMTP questions
by Thelonius (Priest) on May 27, 2003 at 03:11 UTC
    It sounds like your mail server is configured to use POP before SMTP authentication, a kludge which is older than any SMTP authorization methods.

    So you have to use Net::POP3 before you use SMTP. That is,

    my $pop3 = Net::POP3->new($smtphost) or die "Cannot connect to host $smtphost: $!\n"; $pop3->login('me@me.com', 'password') or die "Cannot login: $pop3->message\n"; $pop3->quit; undef $pop3 my $smtp = Net::SMTP->new(etc...);
Re: Net::SMTP questions
by TVSET (Chaplain) on May 27, 2003 at 09:08 UTC
    IIRC, Net::SMTP haven't always supported SMTP authentication. Check the version that you are using and make sure that it's the one that has support. If not - upgrade.

    Leonid Mamtchenkov aka TVSET