in reply to Net::SMTP and Arrays

Is this what you meant?

if($usermail ne "") {

This is going to send email when $usermail is not blank. From the stuff inside the condition, it appears that you're sending to every address entered so far. So, for example:

  1. You enter u1@example.com, mail is sent to:
    • u1@example.com
  2. Then you enter u2@example.com, mail is sent to:
    • u1@example.com
    • u2@example.com
  3. Then you enter u3@example.com, mail is sent to:
    • u1@example.com
    • u2@example.com
    • u3@example.com

Then again, you say that the mail is not sent at all, so perhaps I'm way off in the weeds here.

I'd suggest that you use Data::Dumper to show the contents of @addresses before the attempt at delivery.

use Data::Dumper; print Dumper \@addresses;

It's a good idea to show $usermail before you push it into the list too.

warn "\$usermail = '$usermail'\n";

Those two should give you a better idea of what's going on.

Replies are listed 'Best First'.
Re^2: Net::SMTP and Arrays
by raj8 (Sexton) on Feb 25, 2008 at 21:12 UTC

    It doesn't send e-mail to anyone. When I print the $usermail out to the console, it shows all the e-mail addresses. However, it doesn't send the mail. I don't know if it is the recipient and I should change it to 'to' or, if that it doesn't accept something about the array.