Today i just done an email blasting, so thought of posting it here. You can put in the bcc, cc, as you like. The email of the recipients is taken from the database. The body of the message will appear exactly as how you type it in.
Here's the code :
//do the query from the database
$query="SELECT name,fname,password,email from user where status='active'";
$result=mysql_query($query);
//if this line doesn't work, replace it with while(mysql_fetch_array(xxx))
while(list(,$arr)=each($query)) {
$email=$arr[email];
$name=$arr[name];
$password=$arr[password];
$fname=$arr[fname];
//check if a particular user has 2 emails account. change the '/' according to your database input
$twoemail=strstr($email,'/');
$pos=strpos($email,'/');
//if user has two emails
if($twoemail) {
$first=substr($email,0,$pos);
$second=substr($twoemail,1);
$to = $first.",".$second;
$from="mailto:$from=support@blablabla";
$bcc="whoever@lala.com";
$subject = "Welcome to BLABLABLA";
$body = "
Dear $name,
Welcome to the BLABLABLA
URL: http://www.alldogsworld.com/
Login-ID: $name
Password: $password
Best Regards
Administrator
______________________________________________
This is an auto-generated mail. Please do not reply to this mail.
";
if (mail($to, $subject, $body, "From: $from\r\nBcc:$bcc")) {
echo("I have spam your mailbox. Muahahhaa");
} else {
echo("Message delivery failed...go stand in a corner");
}
} else {
//user has only one email
$to = $email;
$from="support@xxxxxxx";
$bcc="iampig@gmail.com";
$subject = "Welcome to bla bla bla";
$body = "
Dear $name,
Welcome to the bla bla bla
URL: http://www.alldogsworld.com/ Login-ID: $name Password: $password
Best Regards
Administrator
______________________________________________
This is an auto-generated mail. Please do not reply to this mail.
";
if (mail($to, $subject, $body, "From: $from\r\nBcc:$bcc")) {
echo("I have spam your mailbox. Muahahaha");
} else {
echo(" Message delivery failed...go stand in a corner");
}
}
header('location:sent.php');
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment