php emailer using an array?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikegotnaild
Forum Contributor
Posts: 173
Joined: Sat Feb 14, 2004 5:59 pm

php emailer using an array?

Post 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.
tisa
Forum Commoner
Posts: 27
Joined: Fri Nov 28, 2003 1:14 am

Post 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>")
}
}
tisa
Forum Commoner
Posts: 27
Joined: Fri Nov 28, 2003 1:14 am

Post 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
tisa
Forum Commoner
Posts: 27
Joined: Fri Nov 28, 2003 1:14 am

Post 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
Post Reply