<?php
error_reporting(E_ALL);

$to  = 'whom@yahoo.com'; 
$subject = 'The Playboys!';
$message = '
<html>
<head>
  <title>TESTING!</title>
</head>
<body>
  <p>Playboy in the Philippines</p>
  <table>
    <tr>
      <th>Name</th><th>Sex</th><th>Age</th><th>Vitamin</th>
    </tr>
    <tr>
      <td>Tukmol</td><td>Twice a Day</td><td>75</td><td>Viagra</td>
    </tr>
    <tr>
      <td>Tamulmol</td><td>M ...W.....F</td><td>80</td><td>Tongkat Ali</td>
    </tr>
  </table>
</body>
</html>
';

// Content-type header 
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers

$headers .= 'From: Birthday Reminder <business@yahoo.com>' . "\r\n";
$headers .= 'Bcc: [email]you@hotmail.com[/email]' . "\r\n";

// EMail it
mail($to, $subject, $message, $headers);


if (mail)
{
   echo "mail sent...";
}
else
{
   echo "unable to send mail";
}

?>

Well actually, there is a phrase error or bug in that code and should be the following:

<?php
error_reporting(E_ALL ^ E_NOTICE); //this has been fixed

$to  = 'whom@yahoo.com'; 
$subject = 'The Playboys!';
$message = '
<html>
<head>
  <title>TESTING!</title>
</head>
<body>
  <p>Playboy in the Philippines</p>
  <table>
    <tr>
      <th>Name</th><th>Sex</th><th>Age</th><th>Vitamin</th>
    </tr>
    <tr>
      <td>Tukmol</td><td>Twice a Day</td><td>75</td><td>Viagra</td>
    </tr>
    <tr>
      <td>Tamulmol</td><td>M ...W.....F</td><td>80</td><td>Tongkat Ali</td>
    </tr>
  </table>
</body>
</html>
';

// Content-type header 
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers

$headers .= 'From: Birthday Reminder <business@your_website.com>' . "\r\n"; //this has been fixed
$headers .= 'Bcc: you@hotmail.com' . "\r\n";


if (mail($to, $subject, $message, $headers)) //this has been fixed
{
   echo "mail sent...";
} else {
   echo "unable to send mail";
}

?>

Well actually, there is a phrase error or bug in that code and should be the following:

<?php
error_reporting(E_ALL ^ E_NOTICE); //this has been fixed

$to  = 'whom@yahoo.com'; 
$subject = 'The Playboys!';
$message = '
<html>
<head>
  <title>TESTING!</title>
</head>
<body>
  <p>Playboy in the Philippines</p>
  <table>
    <tr>
      <th>Name</th><th>Sex</th><th>Age</th><th>Vitamin</th>
    </tr>
    <tr>
      <td>Tukmol</td><td>Twice a Day</td><td>75</td><td>Viagra</td>
    </tr>
    <tr>
      <td>Tamulmol</td><td>M ...W.....F</td><td>80</td><td>Tongkat Ali</td>
    </tr>
  </table>
</body>
</html>
';

// Content-type header 
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers

$headers .= 'From: Birthday Reminder <business@your_website.com>' . "\r\n"; //this has been fixed
$headers .= 'Bcc: you@hotmail.com' . "\r\n";


if (mail($to, $subject, $message, $headers)) //this has been fixed
{
   echo "mail sent...";
} else {
   echo "unable to send mail";
}

?>

they can delete the error_reporting if they want.

Also may want to point out that some shared web host environments disable the mail function in PHP. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.