in reply to Re^8: Selecting DB
in thread Selecting DB

You have set the addresses you will be sending to like this:

To => join(", ", @$em),

but nowhere have you set $em to anything, so the array is empty, so you have no recipients. A quick SSCCE to show how to pull these AoAs together:

#!/usr/bin/env perl use strict; use warnings; my $user1 = [ [ 'alpha@foo.com', 'beta@foo.dom' ], [ 'gamma@foo.com' ] + ]; my $user2 = [ [ 'delta@foo.com' ], [ 'epsilon@foo.dom', 'zeta@foo.com' + ] ]; my $TotalEmails = [ @$user1, @$user2 ]; my @to; for my $em ( @$TotalEmails ) { push @to, @$em; } my $tostring = join ',', @to; print "Full list of addrs: $tostring\n";

See how that works? You don't even really need the intermediate $TotalEmails but I've left it in for clarity. You can now use $tostring when sending your emails and they should all go out.


🦛

Replies are listed 'Best First'.
Re^10: Selecting DB
by tybalt89 (Monsignor) on Jul 10, 2023 at 22:56 UTC
    my $tostring = join ', ', map @$_, @$TotalEmails;

    Too golfy ?

      For a novice, probably so. But it is a nice, concise solution (++). OTOH I might just reach for List::Flatten (or List::Flatten::Recursive if $TotalEmails were to be any deeper).

      use List::Flatten; my $tostring = join ',', flat @$TotalEmails;

      🦛

Re^10: Selecting DB
by frank1 (Monk) on Jul 10, 2023 at 15:41 UTC

    Thanks its working. delivering now to all emails

    Thanks much

      its working. delivering now to all emails

      Yes, but you may have created a privacy issue. Currently, each and every receipient sees all other receipient. If all mails go to receipients in your company, no problem. If they go to "random" users on the internet, you better send to each receipient individually.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)