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
ex1:
if ($sender->MailMsg({
smtp => 'mail.yourISP.com',
from => '[EMAIL PROTECTED]',
to =>'[EMAIL PROTECTED]',
subject => 'this is a test',
msg => "Hi Johnie.\nHow are you?"
}) < 0) {
die "$Mail::Sender::Error\n";
}
print "Mail sent OK."
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."
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/