Home: Perl Programming Help: Intermediate:
Mailing list



ortora
Deleted

Feb 2, 2001, 10:30 PM


Views: 435
Mailing list

Hi, I have a question related to mailing list management. The script I am using lets me add subscribers to the list, but one at a time. Is it possible to modify it so that it'd let me add bulk email addresses? If so, how can it be done?

The script checks the validity of the email addresses with this portion...

sub checkaddress {

$INPUT{'email'} =~ s/\s//g;

unless ($INPUT{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(,)/
|| $INPUT{'email'} !~
/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)
{
$legalemail = 1;
} else {
$legalemail = 0;
}

How can I change it so that it allowes me to add several addresses at once?

Thanks.




muinatit
Deleted

Feb 4, 2001, 5:50 AM


Views: 426
Re: Mailing list

I'm just going to change up everything....


Code
$INPUT{'email'} = CheckAddress($INPUT{'email'}); 

###
sub CheckAddress {
###
my (@emails) = @_;

foreach $email (@emails) {
if ($email =~ /(\w{1}[\w-.]*)\@([\w-.]+)\.(\w{1,3}$)/) {
$email = "$1\@$2\.$3";
push (@return, $email);
}
}

return (@return);
}



ortora
Deleted

Feb 7, 2001, 5:41 AM


Views: 415
Re: Mailing list

thanks a lot. does this also allow me to remove a batch of emails? or is it just to add?



ortora
Deleted

Feb 7, 2001, 6:19 AM


Views: 413
Re: Mailing list

unfortunately it did not work. i can't get it to work.



muinatit
Deleted

Feb 7, 2001, 2:52 PM


Views: 406
Re: Mailing list

Look through the code and get rid of the things that check for the $legal_email variable.

muinatit
muinatit@hotpop.com


muinatit
Deleted

Feb 7, 2001, 2:55 PM


Views: 406
Goofed on some of the code...

I goofed up some of the code on this. After the if loop is done add this.....


Code
if ($email =~ /(\w{1}[\w-.]*)\@([\w-.]+)\.(\w{1,3}$)/) { 
# the stuff from the previous post
} else {
$email = "";
}

muinatit
muinatit@hotpop.com