Hi,
I recently set up an HR section on my website where people can apply for a job online and set up an interview time. I would now like to implement a script that will be executed once a day, that will remind anyone who has an interview set up for the next day. The reminder will be an email.
So I need there to be some kind of loop that will insert the email addresses from the database in the $to field one by one. Also there will be some personalization in the email such as the applicants name. So i need the applicant's names to correspond with the correct email address.
Here is the code i currently have: (i am new to php and have not used any arrays or looops yet, so i appreciate any help you can give. Thanks.)
<?php
//Connect To Database
//Linking to the database
$link = mysql_connect($host, $user, $password) or die (mysql_error());
Mysql_select_db("dmotion") or die(mysql_error());
//Query the database for email addresses
$query = mysql_query("SELECT emails, date, time, name FROM applicantInfo");
//execute query
mysql_query(($query) or die('Error, query failed'));
//HTML EMAIL auto responder
$to = $_REQUEST['txtemail'];
$subject = 'RE: GCB';
$message = '
<html>
<head>
<title>GCB</title>
</head>
<body><img src="
<font size="2" face="Geneva, Arial, Helvetica, sans-serif">
Thank you ['name'] for your interest in GCB Organizaiton!<p>
Please Remember your interview is scheduled for tomorrow at ['time'] <p>
We look forward to meeting with you! <p>
Sincerely,<br>
Your Friends at the GCB Organization
<p>
<img src="
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: GCB <Info@gcb.com>'. "\r\n";
mail($to, $subject, $message, $headers);
?>
I recently set up an HR section on my website where people can apply for a job online and set up an interview time. I would now like to implement a script that will be executed once a day, that will remind anyone who has an interview set up for the next day. The reminder will be an email.
So I need there to be some kind of loop that will insert the email addresses from the database in the $to field one by one. Also there will be some personalization in the email such as the applicants name. So i need the applicant's names to correspond with the correct email address.
Here is the code i currently have: (i am new to php and have not used any arrays or looops yet, so i appreciate any help you can give. Thanks.)
<?php
//Connect To Database
//Linking to the database
$link = mysql_connect($host, $user, $password) or die (mysql_error());
Mysql_select_db("dmotion") or die(mysql_error());
//Query the database for email addresses
$query = mysql_query("SELECT emails, date, time, name FROM applicantInfo");
//execute query
mysql_query(($query) or die('Error, query failed'));
//HTML EMAIL auto responder
$to = $_REQUEST['txtemail'];
$subject = 'RE: GCB';
$message = '
<html>
<head>
<title>GCB</title>
</head>
<body><img src="
<font size="2" face="Geneva, Arial, Helvetica, sans-serif">
Thank you ['name'] for your interest in GCB Organizaiton!<p>
Please Remember your interview is scheduled for tomorrow at ['time'] <p>
We look forward to meeting with you! <p>
Sincerely,<br>
Your Friends at the GCB Organization
<p>
<img src="
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: GCB <Info@gcb.com>'. "\r\n";
mail($to, $subject, $message, $headers);
?>