in reply to Sending email

Did you follow Email::Sender's QuickStart instructions for Bcc?

Based on that, and the envelope information section on the same page, I would think your sendmail command should be something like

$email_s->header_set('bcc'); # remove Bcc from headers, otherwise eve +ry recipient can still see the whole BCC list sendmail($email_s, { transport => $transport, to => [$bcc1, $bcc2, ... +] });

Replies are listed 'Best First'.
Re^2: Sending email
by frank1 (Monk) on Jul 22, 2023 at 12:29 UTC

    I have tried it but emails are not getting delivered

    my $email_s = Email::Simple->create( header => [ From => 'xxx@xxx.com', Subject => "test hi", 'Content-Type' => 'text/html', ], body => $message_s, ); $email_s->header_set('bcc'); sendmail($email_s, { transport => $transport, to => [$tostring] });

      You don't show it here, but in your OP you have:

      my $tostring = join ',', @to;

      There's not enough of your code in one place, but I'd suggest changing

      to => [$tostring]

      to something closer to

      to => [@to]

      The '[...]' construct creates an anonymous array reference. Between '[' and ']', you can put a single scalar or a list of scalars:

      [$scalar1] # OK [$scalar1, $scalar2] # OK ["$scalar1, $scalar2"] # NOT OK ['$scalar1, $scalar2'] # NOT OK

      — Ken

        i have tried most ways but i think its a module problem

        because this way, Bcc method is working. this method is working for me, but i wanted good module which supports smtp and html message

        my $to = ''; my $from = 'xxx@xxx.com'; my $subject = $subject; my $message = " $msg "; open(MAIL, "|/usr/sbin/sendmail -t"); print MAIL "To: $to\n"; print MAIL "Bcc: $emails\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; print MAIL $message; close(MAIL);