in reply to How to send multiple user with one mail?
Open the input.txt file, I hope the email id will be in the third filed of each line separated by space, So you will get all the email ids.grep for hotmail.com if matches push into an array, finally use the aray with the recipient function from Net::SMTP.
use strict; use warnings; my @recipient; open(my $file, "<", "input.txt") or die "Can't open input.txt: $!"; my $string = "hotmail\.com"; while (<$file>) { chomp; my $emailid= (split/\s+/,$_) [2]; if (/$string/) { print "found string $string:$emailid\n"; push(@recipient,$emailid); } else { print "did not find the string\n"; } }
All is well
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to send multiple user with one mail?
by GordonLim (Acolyte) on Mar 24, 2013 at 14:29 UTC | |
by GordonLim (Acolyte) on Mar 27, 2013 at 18:09 UTC |
In Section
Seekers of Perl Wisdom