Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: How to send multiple user with one mail?

by GordonLim (Acolyte)
on Mar 24, 2013 at 14:29 UTC ( #1025147=note: print w/ replies, xml ) Need Help??


in reply to Re: How to send multiple user with one mail?
in thread How to send multiple user with one mail?

Hi vinoth.ree, Your script is fine to grep all the mail. But I don't know why it cannot work when I apply in

$smtp->mail(&xxx); $smtp->to(&xxx);
or even i assigned to scalar also same
my $email=&xxx; $smtp->mail($email); $smtp->to(email);
Only work when I manual keyin email like this
$smtp->mail('YYY@hotmail.com,' 'xxx@hotmail.com'); $smtp->to('YYY@hotmail.com,' 'xxx@hotmail.com');
below is the script that I modified a bit from the script your provided.
sub xxx { my $query = CGI->new; my $mail = CGI->new; my @recipient = (); open(my $file, "<", "users.txt") or die "Can't open input.txt: $!"; my $hotmail = "hotmail\.com"; my $gmail = "gmail\.com"; # print $query->header('text/html'); # create the HTTP header # print $query->start_html('Login Access'); # start the HTML while (<$file>) { chomp; my $emailid= (split/\s+/,$_) [2]; if (/$hotmail/) { push(@recipient,$emailid); } elsif (/$gmail/) { push(@recipient,$emailid); } } $email = join(', ', @recipient); return $email; }
The result of join is same like this www@hotmail.com, xxx@hotmail.com is it the ' ' symbol I didn't add in beside the mail address during join function? I have no idea how to add in there.


Comment on Re^2: How to send multiple user with one mail?
Select or Download Code
Re^3: How to send multiple user with one mail?
by GordonLim (Acolyte) on Mar 27, 2013 at 18:09 UTC
    Hi All, The function is work after disable the join function. :) Thanks all of you guys help me.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025147]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-10-22 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (118 votes), past polls