I am using a perl script through which i want to send email to multiple users. The Script is working fine for a single user and doing my work fine. But when i want to send the same mail to multiple users, i get errors. I am posting my script below. Kindly help me out.
ORIGINAL SCRIPT :#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use Email::Send; use Email::Send::Gmail; use Email::MIME::Creator; use IO::All; my $basefolder = "/Users/Abc/Desktop/"; my $from = "test1\@gmail.com"; my $to = 'test2l\@hotmail.com'; my $subject = "DSMS"; my $url = "http://abc.com/search?q=%22M%22&t=blogs&f=csv"; my $file = $basefolder . "M-B.csv"; my $status = mirror($url,$file); die "Cannot retrieve $url" unless is_success($status); my $url1 = "http://abc.com/search?q=%22M%22&t=microblogs&f=csv"; my $file1 = $basefolder . "M-MB.csv"; my $status1 = mirror($url1,$file1); die "Cannot retrieve $url" unless is_success($status1); my @parts = ( Email::MIME->create( attributes => { filename =>"M-B.csv", content_type =>"application/csv", disposition =>"attachment", Name =>$basefolder . "M-B.csv", }, body => io( $basefolder . "M-B.csv" )->all, ), Email::MIME->create( attributes => { filename =>"M-MB.csv", content_type =>"application/csv", disposition =>"attachment", Name =>$basefolder . "M-MB.csv", }, body => io( $basefolder . "M-MB.csv" )->all, ), ); my $email = Email::MIME->create( header => [ From => $from, To => $to, Subject => $subject, ], parts => [@parts] ); my $sender = Email::Send->new( { mailer => 'Gmail', mailer_args => [ username => 'test1@gmail.com', password => '1234qwerty', ] } ); eval { $sender->send($email) }; die "Error sending email: $@" if $@;
I've tried adding multiple emails to My $to. Besides that i have tried adding a My $to1. i don't want to send them as cc or bcc.
But both of theses did not work for me. Is there an other way. If yes kindly specify. Thanx in advance.In reply to Email::Mime and Multiple Recipients by Appy16
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |