Page 1 of 1

php emailer using an array?

Posted: Fri Mar 26, 2004 2:30 am
by mikegotnaild
Hey i want to send a bunch of emails to people i know would be interested in my site. I was wondering if it was possible to use an array? like this:

Code: Select all

<?php
$emailist = array('email1@email.com', 'email2@email.com', 'email3@email.com','email4@email.com','email5@email.com');

$subject = blah;
$message = blah;
$name = blah;
$email = blah;

mail("$emailist","$subject","$message","From: $name <$email>") or die("email error");

?>
Or if not could someone just give me a simple alternative or script i can download. All i want to do is send a simple all text message to about 150-200 email addresses ONCE so dont think im trying to spam. because i believe these people WILL be interested in my site anyway. I know this is probably alot more work than if i did it a different way lol.

Posted: Fri Mar 26, 2004 2:44 am
by tisa
i think it is better to use for loop function to send the mail
$emailist = array('email1@email.com', 'email2@email.com', 'email3@email.com','email4@email.com','email5@email.com');

if(!empty($emailist)){
for($a=0 ; $a < count($emailist); $a++){
mail($emailist[$a], $subject, $message, "From: $name<$email>")
}
}

Posted: Fri Mar 26, 2004 2:51 am
by tisa
if you have the database to store email addresses..it will be very easy to do it, just store the email address to array, and use for loop function to forward your mail

Posted: Fri Mar 26, 2004 3:03 am
by tisa
if you have the database to store email addresses..it will be very easy to do it, just store the email address to array, and use for loop function to forward your mail