title: Unexpected blank page from a PHP email script
body: <p>Ok I have redesigned it its not perfect but it works and tested this in the url and also tested via cronjobs.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;J~Net Birthday Test&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
  &lt;body style="background:#0066CC"&gt;
  &lt;font color="orange" font size="+1"&gt;
  &lt;center&gt;
  
  &lt;?php
  error_reporting(E_ALL); ini_set('display_errors', "0");
  $id = '';
  $email = '';
  $numrows = '';
  function sendHTMLemail($HTML,$from,$to,$subject) {
  $from = "admin@jnetscripts.com";
  $subject = "Happy Birthday ";
  $headers = "From: $from\r\n";
  $HTML = '
  &lt;body style="background:#0066CC"&gt;
  &lt;STYLE TYPE="text/css"&gt;
  BODY {background-image: url(\'http://www.jnetscripts.com/apps/balance/images/images(9).jpeg\');
  background-repeat; }
  &lt;/STYLE&gt; 
  &lt;font color="orange" font size="+1"&gt;&lt;center&gt;
  &lt;a href="http://www.jnetscripts.com"&gt;&lt;img src="http://www.jnetscripts.com/images/logo.png" height="80px" &gt;&lt;/img&gt;&lt;/a&gt;
  &lt;p&gt;&lt;br&gt;
  &lt;p&gt;
  Happy Birthday To You!&lt;p&gt; 
  Happy Birthday To You!&lt;p&gt;
  Happy Birthday To You!&lt;p&gt;
  Happy Birthday To You!&lt;p&gt;
  &lt;p&gt;&lt;br&gt;
  Have A Great Day From J~Net&lt;p&gt;
  &lt;a href="http://www.jnetscripts.com"&gt;&lt;img src="http://www.jnetscripts.com/images/logo.png" height="80px" &gt;&lt;/img&gt;&lt;/a&gt;';
  $headers .= "MIME-Version: 1.0\r\n";
  $boundary = uniqid("HTMLEMAIL");
  $headers .= "Content-Type: multipart/alternative;".
  "boundary = $boundary\r\n\r\n";
  $headers .= "This is a MIME encoded message.\r\n\r\n";
  $headers .= "--$boundary\r\n".
  "Content-Type: text/plain; charset=ISO-8859-1\r\n".
  "Content-Transfer-Encoding: base64\r\n\r\n";
  $headers .= chunk_split(base64_encode(strip_tags($HTML)));
  // Now we attach the HTML version
  $headers .= "--$boundary\r\n".
  "Content-Type: text/html; charset=ISO-8859-1\r\n".
  "Content-Transfer-Encoding: base64\r\n\r\n";
  $headers .= chunk_split(base64_encode($HTML));
  if (mail($to,$subject,"",$headers)) {
  global $success;
  $success++;
  }
  }
  $now = date("d-m-y");
  $out  = array('-');
  $in = array('');
  $new_now = str_replace($out, $in, $now);
  $new_now = substr($new_now, 0, 4);
  echo 'Todays Date Without The Year Is ';
  echo $new_now;
  echo '&lt;p&gt;';
  require_once("../php_includes/db_conx.php");
  $sql = "SELECT id, username, email, dob FROM users WHERE instr(dob, '$new_now') &gt;0";
  $query = mysqli_query($db_conx, $sql);
  if($query){
  while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
  $id = $row['id'];
  $email = $row['email'];
  $username = $row['username'];
  }
  if (sendHTMLemail($HTML,$from,$email,$subject)) {
  echo 'No Birthdays today!';
  } else {
  echo 'Messages Sent';
  }
  }
  ?&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I have posted this to help others who may want the date formatted in there database in UK English Format (the correct way).
  Soon i can answer my own questions (need more rep) please vote up so i dont have to edit original sections!</p>