I am trying to plot my way through coding a BCC Bulk HTML email.
I can't get the code below to work and I want to also call another query to grab the emails for a BCC email. SPAM security would be helpful if it is easy enough to add tot he code.
<?
$Vol_Name = $_POST['Name'];
$id_Event = $_POST['id_Event'];
$Note = $_POST['Note'];
$sDate = $_POST['sDate'];
require_once('auth.php');
include("inc/interface.php");
include("inc/funct.php");
ServerConnect();
DB_Connect();
// Adds a NOTE to a table
$sql="INSERT INTO Ev_Notes (id_Event, Name, Note) VALUES ('$id_Event','$Vol_Name','$Note')";
print_r($sql);
$result = mysql_query($sql) or die(mysql_error());
// Get all the Emails to include for a BBC bulk email
<?php
$query = "select Email FROM Ev_SchVolunteers where id_Event='$id_Event' ORDER BY id_Sort, Name";
$results = mysql_query($query) or die("Error performing query");
?>
// NOT SURE WHAT DO TO TO HANDLE THE EMAIL ARRAY to GET IT INTO A FORMAT TO PASS TO THE VARIABLE $BCC that the EMAIL ACTION CAN HANDLE.
//Set Variables for the Email
$from = "me@web.net";
$to = "you@web.net";
$BBC = "????";
$subject = "New Note regarding the Event Date - $sDate"; // Why can't this pick up my Variable?
$message =
"
<html>
<body>
This new note is from: $sName.<br />
<br />
$Note<br />
<br />
<br />
Please do not reply directly to this message from your email program, but go<br />
back click the link below and log-in to the THE SITE:<br />
<br />
<strong><a href="http://www.web.com/VOH/login-form.php">THE SITE</a></strong>
</body>
</html>
"; // I can't get the body of the email to format in HTML
send_email($from, $to, $subject, $message, $BCC);
header("location: Service_Dates.php");
?>
Then funct.php code is:
<?php>
function send_email($from, $to, $subject, $message, $BCC){
$headers = "From: ".$from."\r\n";
$headers = "BCC: ".$BCC."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n";
if (mail($to,$subject,$message,$headers) ) {
echo "email sent";
} else {
echo "email couldn't be sent";
}
}
?>
I appreciate any help anyone can offer.