Jump to content

Mass E-mail


mycro

Recommended Posts

i think the best way of doing this would be:

[code]
<?php
$query = mysql_query("SELECT * FROM user");
while($user = mysql_fetch_assoc($query)) {
  $to = $user['email'];
  $subject = "This is the subject";
  $message = "This mail is going out to all my members...";
  $headers = "From: [email protected]\r\n" .
  'X-Mailer: PHP/' . phpversion() . "\r\n" .
  "MIME-Version: 1.0\r\n";
  mail($to, $subject, $message, $headers)or die('The email could not send!');
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/22189-mass-e-mail/#findComment-99374
Share on other sites

[code]Yep that is the best way I made one of these about an 2 hours ago.
function/inputsettings.php
[code]
<?php
function inputsettings($value,$type,$name){
return '<input type="'.$type.'" value="'.$value.'" name="'.$name.'">';
}
?>
[/code]

[/code]
[code]
<?php
include("./config.php");
require_once("./functions/inputsettings.php");

if($logged[username] != 5){
echo "Sorry you do not have permissions to view this area";
exit;
}

$subject = $_POST['subject'];
$message = $_POST['message'];
$sendmasse = $_POST['massemail'];
$uone = mysql_query("SELECT * FROM users WHERE id='1' ") or die(mysql_error());
$adminone = mysql_fetch_array($uone);
$admin = $adminone[email];
$adminname = $adminone[username];

if(isset($sendmasse)){
$user_emails = mysql_query("SELECT * FROM users") or die(mysql_error());
while($alluseremails = mysql_fetch_array($user_emails)){
$allusers = $alluseremails[email];
mail($allusers,$subject,$message,"From: "."Webmaster - $adminname"."<".$admin.">\n");
}
}else{
?>
<form method='post'>
<table border='1' width='100%'>
<tr>
<td style='text-align: center;'>
Send email
</td>
</tr>
</table>
<table border='1' width='100%' colspan='2'>
<tr>
<td>
<center>Subject</center>
</td>
<td>
<center><input type='text' name='subject' size='27'></center>
</td>
</tr>
<tr>
<td>
<center>Message</center>
</td>
<td>
<center><textarea name='message'></textarea></center>
</td>
</tr>
</table>
<?php
echo "<center>".inputsettings('submit','submit','massemail')."</center>";
?>
</form>
<?php } ?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/22189-mass-e-mail/#findComment-99375
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.