in reply to Re: SMTP mail not working for me
in thread SMTP mail not working for me

Hi. I add my use CGI::Carp qw(fatalsToBrowser); and I got: Can't locate Net/SMTP_auth.pm in @INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib .) at C:\HostingSpaces\zlinkexc\mortgagerefinancingpros.com\wwwroot\cgi-bin\smtp2.cgi line 5. BEGIN failed--compilation aborted at C:\HostingSpaces\zlinkexc\mortgagerefinancingpros.com\wwwroot\cgi-bin\smtp2.cgi line 5. For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
!C:\Perl\bin\perl.exe -w use CGI::Carp qw(fatalsToBrowser); use Net::SMTP_auth; $smtpserver = 'mail.mortgagerefinancingpros.com'; my $ServerAccount = "admin\@mortgagerefinancingpros.com"; my $ServerPwd = "pianos78997"; my $smtp = Net::SMTP->new($smtpserver, Hello => "mortgagerefinancingpr +os.com", Debug + => 1); $smtp->auth('CRAM-MD5', '$ServerAccount', '$ServerPwd'); $recipient = 'admin@mortgage-pros.com' ; $from = 'admin@mortgagerefinancingpros.com' ; #$smtp = Net::SMTP->new('', Timeout => 60, Debug => 1); ## smtp server requires authentication #$smtp->auth('admin@mortgagerefinancingpros.com','pianos78997'); $smtp->mail($from); $smtp->to($recipient); $smtp->data(); $smtp->datasend("To: $recipient\n"); $smtp->datasend("Subject: test message\n"); $smtp->datasend("\n"); $smtp->datasend("A simple test message\n"); $smtp->dataend(); $smtp->quit;

Replies are listed 'Best First'.
Re^3: SMTP mail not working for me
by chromatic (Archbishop) on Jan 13, 2012 at 06:53 UTC

    The error message means you need to install Net::SMTP_auth. In addition:

    my $smtp = Net::SMTP->new( ... );

    ... should probably be instead:

    my $smtp = Net::SMTP_auth->new( ... );

    ... and you almost certainly don't need the single quotes in:

    $smtp->auth('CRAM-MD5', '$ServerAccount', '$ServerPwd');

    ... if you want the values of the variables, and not the literal strings.


    Improve your skills with Modern Perl: the free book.