in reply to Re: Sending email
in thread Sending email

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] });

Replies are listed 'Best First'.
Re^3: Sending email
by kcott (Archbishop) on Jul 22, 2023 at 15:42 UTC

    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);