bigup401 has asked for the wisdom of the Perl Monks concerning the following question:

how can i send message to multiple addresses without showing cc, bcc emails to recipients. i want something like php mailer.

any idea

$msg = MIME::Lite->new( To => ,

Replies are listed 'Best First'.
Re: sending to multiple addressess
by Your Mother (Archbishop) on May 23, 2017 at 17:09 UTC

    From MIME::Lite’s documentation: Giving VALUE as an arrayref will cause all those values to be added. This is only useful for special multiple-valued fields like "Received"

    So, try–

    To => \@email_addresses, # or list them explicitly in an anonymous array- To => [ 'email1@doma.in', 'email2@doma.in' ],

      And along with what tobyink pointed out I’d missed, Bcc, can be swapped for the To. However, mass BCCing tends to be interpreted, quite rightly, as spam and filtered out. I hope we’re not helping you send spam. :|

      no am not using it for spam, i want to be able to mail all my users in my database

      its still showing same thing brings all recipients

      here is how the delivery looks like

      To: email1@gmail.com, email2@gmail.com, email3@gmail.com Reply | Reply to all | Forward | Print | Delete | Show original how are u

      here is my code

      my @email_addresses = ('email2@gmail.com', 'email2@gmail.com', 'email3 +@gmail.com'); $from = 'support@mydomain'; $subject = "hello users"; $message = "how are u"; $msg = MIME::Lite->new( From => $from, To => \@email_addresses, Subject => $subject, Data => $message ); $msg->send;

        Great. tobyink’s approach is right for what you want. Mail each separately.

Re: sending to multiple addressess
by tobyink (Canon) on May 23, 2017 at 17:46 UTC

    The answer above shows how to do it if you're happy for each recipient to see the full list of recipients in their mail headers (and be able to hit "Reply to All" in their email client).

    If not, just loop through your array of addresses.

    for my $address (@addresses) { my $msg = MIME::Lite->new( To => $address, ..., ); ...; # actually send the message or something }

      thanks guys for helpful response