Help, send multiple mail.

Started on the old forum in April 2012 · view the original in the archive · old links redirect here

7 replies · 816 views · started 14 years ago · 1 min read

4 participants
Wintch Developer · 68 posts #1

Helo coderz pls help me with the code to send mail to all my users at once... Email are stored in database. Thanx

something else Fellow · 2,296 posts #2
$hmms = mysql_query("SELECT email FROM users");
while ($hmm = mysql_fetch_array($hmms))
{
$headers = 'From: 'admin@yoursite.tdl' . "\r\n" .'Reply-To: admin@yoursite.tdl' . "\r\n" .'X-Mailer: PHP/' . phpversion();
mail($hmm['email'],"Some title, "Your text",$headers);
}
Wintch Developer · 68 posts #3

thanx man let me try this out and give you feedback...

Wintch Developer · 68 posts #4

something else its not working for me

arnage Lead · 811 posts #5

Try this just check table names.

$emails = array();
$select = mysql_query('SELECT `email` FROM `users`');
while ($sel = mysql_fetch_array($select)) {
	$emails[] = $sel[0];
}
foreach ($emails as $email) {
	$subject = 'Subject...';
	$message = 'Message...';
	$header = 'MIME-Version: 1.0'.PHP_EOL;
	$header .= 'Content-type: text/html; charset=utf-8'.PHP_EOL;
	$header .= 'From: mailing@mail.com';
	
	@mail($email, $subject, $message, $header);

echo 'Sent!';
}
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
Wintch Developer · 68 posts #6

t anx man. it works

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close