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

Show us the code that gives the uninitialized value error.


Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^4: Sending email in perl
by Eagle_f91 (Acolyte) on Sep 16, 2005 at 00:52 UTC
    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.
        The code work 100% before my host started requireing authentication. and I do have
        #!user/bin/perl -w use strict; use Net:SMTP;
        I just forgot to highlight that part.
      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!