Multiple recipients to SMTP subroutine not working 
Author Message
 Multiple recipients to SMTP subroutine not working

I've played around with this for way to long now so I'm asking for
help.

I need to send several reports, each with different distribution
lists, using SMTP.  I have attempted to create a subroutine so I can
easily pass the necessary info for each report and distribution list
to it for the actual processing.  The part that doesn't work is where
I try to pass the multiple email addresses to the subroutine.  It
seems like the "smtp->recipient" statement doesn't see the individual
addresses.  What am I doing wrong?  If I'm going about this all wrong
to begin with please feel free to point me in the right direction and
thanks.

Bryce Pursley

#!/usr/bin/perl -w  
use strict;
use Net::SMTP; # module to allow SMTP functions
###############################################################################
# Set up global variables
###############################################################################

my $subject;
my $recipients;
my $file1;


#==========================================================================
#==========================================================================
my $smtp = Net::SMTP->new('mysmtpsrvr.domain.com');
$file1 = "test.txt";
$subject = "Test Subject Line";


$smtp->dataend();
$smtp->quit;

sub sendsmtp
{
  my $file = shift;
  my $subject = shift;
  my $arrayref = shift;


  if ($smtp->recipient($recipients)) {
   print "Success with recipients.\n";
  }
   else
  {
   print "Recipients failed - \n";
  }
  $smtp->data();
  $smtp->datasend("Subject: $subject\n");
  $smtp->datasend("To: $hbp, $bph\n");
  $smtp->datasend("From: My Test Reports

  open TEST, "$file";
  while (<TEST>) {
    $smtp->datasend("$_");
  }
  close TEST;

Quote:
}



Sun, 22 Feb 2004 17:31:56 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Multiple Recipients and Net::SMTP problem

2. Email to multiple recipients with Net::SMTP

3. Help needed: Net::SMTP (multiple recipient???)

4. Help with Net::SMTP-multiple recipients

5. Multiple recipients using Net:SMTP

6. multiple recipients with Net::SMTP

7. Multiple recipients in Net::SMTP

8. multiple recipients using Net::SMTP

9. multiple recipients with Net::SMTP

10. Module Net::SMTP - using a file containing recipients

11. Net::SMTP -- why must I specify recipient twice?

12. Net::SMTP works sometimes and sometimes not??

 

 
Powered by phpBB® Forum Software