Hi Monks,

I have a script that I use to send e-mail when I have added them to my ftp server, however, these individuals change daily and weekly. That said, previously I manually created an array and added the users and it worked, but now that I push users onto the array from the script, the script works but doesn't send the e-mail? I have come to a hard stop on this. Does anyone see a reason why this would not work? I have placed a snippet (not the whole script)for your thoughts. I thought--pushing users onto the array would work. As always, thank you.

my @addresses; print "Enter address(s) and press [Enter]: "; chomp($usermail= <STDIN>); print "\nE-mail Address(s) are: $usermail\n"; ## Push each user onto the array ## push(@addresses,$usermail); ### E-mail Routine ### if($usermail ne "") { $smtp = Net::SMTP->new( 'SMTPSERVERNAME' ); $smtp->mail('sender@mydomain.com'); $smtp->recipient(@addresses); $smtp->data(); #Send the header. $smtp->datasend( "To: @addresses\n" ); $smtp->datasend( "From: sender\@mydomain.com\n" ); $smtp->datasend( "Subject: FTP Access \n" ); $smtp->datasend( "\n" ); #Send the body $smtp->datasend("You have been invited to access the my projec +t FTP Site by using the following 'project name' and 'password.' \n"); my $msg = <"\nproject name is: $username\n\nPassword is: $user +passwd\n\n$MOTD">; $smtp->datasend( $msg ); $smtp->dataend(); $smtp->quit; };

In reply to Net::SMTP and Arrays by raj8

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.