in reply to Re: Sending email in perl
in thread Sending email in perl

I have tryed the Net:SMTP module and I get an error of not being able to call AUTH on an uninitialized value. (The same goes for NET::SMTP_Auth) For Mail::Mailer I can not figure out how to call the auth command. As for Email::Send::SMTP::Auth I have looked at it but I can not figure out how to send header information and message text. I am really new to perl so these online docs cpan gives really do not help me. It seams to me the docs are eather poorly written or geared to you pros.

Replies are listed 'Best First'.
Re^3: Sending email in perl
by GrandFather (Saint) on Sep 16, 2005 at 00:47 UTC

    Show us the code that gives the uninitialized value error.


    Perl is Huffman encoded by design.
      THis is the code that gives me the error. Even if I change it to use Net::SMTP_auth I will get the same error. Note I have removed my UID and PASS for security and the @ in my email to prevent harvisting
      #!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); print "Content-type: text/html\n\n"; use Net::SMTP; $smtp = Net::SMTP -> new('mail.ffinfo.com'); $smtp -> auth('UID', 'PASS'); $smtp -> mail('ffxils ffinfo.com'); $smtp -> to('ffxils ffinfo.com'); $smtp -> data(); $smtp -> datasend("To: \"Crystal Reverine Admins\" <ffxils\@ffinfo.com +>\r\n"); $smtp -> datasend("From: \"Crystal Reverine Registration Script\" <ffx +ils\ ffinfo.com>\r\n"); $smtp -> datasend("X-Mailer: Crystal Rebberine Registration Script Net +::SMTP\r\n"); $smtp -> datasend("Subject: New Member Reqestrations\r\n"); $smtp -> datasend("\r\n"); $smtp -> datasend('A new member has registered at the LS website and i +s waiting for approval. Please click on the below link to get a list +of all waiting members'); $smtp -> dataend(); $smtp -> quit();

        $smtp = Net::SMTP -> new('mail.ffinfo.com') is failing so $smtp is not created. Have you got the address of the smtp server right?

        As a general comment: you should use warnings; use strict;.


        Perl is Huffman encoded by design.
        Have you tried to wrap your code in an eval and evaluate the error message that comes back?
        eval { # code here }; if ($@) { confess "$@"; }

        Don
        WHITEPAGES.COM | INC
        Everything I've learned in life can be summed up in a small perl script!