Date sent: Mon, 18 Aug 2008 17:50:16 +0800 From: loody <[EMAIL PROTECTED]> To: beginners@perl.org Subject: Question about email address problem
> Dear all: > I use Mail::Sender to send mails. > But I have a problem. > How could I pass email address to the sendto parameter. > > Usually we use ' ' or "\@" to avoid taking care of @. > just like ex1 below. > > But I use an array to save my receivers and I want to pass them one by one. > like ext2 below. > And perl tells me I pass the wrong email address. > '$_' is wrong I know, since the parameter will not be interpreted. The > to will be $_. > "$_" is also wrong either, since @ in email address will cause the problem. > What can I do to have the same effect like "[EMAIL PROTECTED]" or '[EMAIL > PROTECTED]'. > appreciate your help, > miloody > > ex2: > foreach (@receivers) > { > if ($sender->MailMsg({ > smtp => 'mail.yourISP.com', > from => '[EMAIL PROTECTED]', > to =>$_, > subject => 'this is a test', > msg => "Hi Johnie.\nHow are you?" > }) < 0) { > die "$Mail::Sender::Error\n"; > } > print "Mail sent OK." > } The problem is elsewhere. Namely at the place where you populate the @receivers. Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/