I have created a script to mass email members from my database, i'm having problems it will not send any emails not even to the junk mail π can anyone help me out with this.
<?php
session_start(); //allow sessions
include("config.php"); //get database information
if(!$_POST[send]){ //if the form was not submitted
echo "<form action='' method='post' >
<table width='600' border='0' cellspacing='0' cellpadding='0' align='left'>
<tr>
<td height='35' colspan='2' align='left'><b>Send a email to all users</b></td>
</tr>
<tr>
<td height='35' align='left'><b>Subject:</b></td>
<td width='515' align='left'><input type='text' name='title' id='title' size='30' /></td>
</tr>
<tr>
<td width='85' height='150' align='left' valign='top'><b>Message:</b></td>
<td align='left' valign='top'><textarea name='msg' id='msg' cols='65' rows='9'></textarea></td>
</tr>
<tr>
<td height='35'> </td>
<td><input type='submit' name='send' id='send' value='Send' /></td>
</tr>
</table>
</form>"; //return with the form
}else{ //or if it was
$supportEmail = 'support@mysite.com';
$title = strip_tags(htmlspecialchars($_POST[titleβ¦
$date = date("F j, Y, g:i a");
$values = array();
$message = stripslashes($_POST[msg]); //message
$getusers = mysql_query("SELECT * FROM user");
$getemail = "SELECT email FROM user";
$result = mysql_query($getemail);
$to=$row['email'];
$link="<a href=\"http://mysite.com/contact.php\">C⦠here</a>";
if(empty($message)){
echo "<a href=\"history.go(-1)\">Go Back</a>You Can Not Send An Empty Message!";
}else{
while ($row = mysql_fetch_array($result)){
$email = $row['email'];
//send email
}
$body = <<<EOD
<br><hr><br>
=============================== <br>
<br>
Subject: $title <br>
Message: $message <br><br>
This message has been sent by My Site. Do not reply to this email. $link to contact support. <br>
=============================== <br><br>
EOD;
$headers = "From: $supportEmail\r\n";
$headers .= "Content-type: text/html\r\n";
$send_contact = mail($email,$title,$body,$headers);
// Check, if message sent to your email
if($send_contact){
echo "<script language='javascript'>
alert('Your site wide email has been sent.');
window.location.href = 'http://mysite.com/x9y6uw5e8_/admin_panel.php?page=mass_email';
</script>";
}
} //end check for empty message
} //end form check
?>