Code: Select all
<?php
//
// Step 2, grab the question that was just added and email it
//
$sql = "SELECT f.faq_id, f.faq_passcode, f.faq_from_fname, f.faq_from_lname, f.faq_from_email, a.admin_id, a.admin_fname, a.admin_lname, a.admin_email
FROM nummi_faqs f, nummi_admins a
WHERE a.admin_id = f.admin_id
ORDER BY f.faq_id DESC
LIMIT 0,1";
if ( !($result = $db->sql_query($sql)) )
{
set_error('Could not find the last question.');
}
while ( $row = $db->sql_fetchrow($result) )
{
$faq_id = $row['faq_id'];
$passcode = $row['faq_passcode'];
$ffname = $row['faq_from_fname'];
$flname = $row['faq_from_lname'];
$femail = $row['faq_from_email'];
$admin_id = $row['admin_id'];
$afname = $row['admin_fname'];
$alname = $row['admin_lname'];
$aemail = $row['admin_email'];
$to = "$afname $lname <$aemail>";
$itsabout = "PEP Website Question";
$mcontent = "Hi $afname, someone has just asked you a PEP question.\n";
$mcontent .= "To view this question, answer it and add it to the database, visit\n ";
$mcontent .= "http://nummi.purelyauto.com/questions_admin.php?mode=ans&admin=$admin_id&ques=$faq_id&check=$passcode \n";
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
/* additional headers */
if ( ($femail !='') ) //if there is a from email
{
if ( ($ffname !='') && ($flname !='') ) //if there is a first AND last name
{
$headers .= "From: $ffname $flname <$femail>\r\n";
}
else
{
$headers .= "From: <$femail>\r\n";
}
}
else
{
$headers .= "From: Site Admin <noreply@purelyauto.com>\r\n";
}
/* send it */
mail($to, $itsabout, $mcontent, $headers);
}// End While
?>In this email, the Sender in the header is shown as Sender Unspecified.Content-type: text/plain; charset=iso-8859-1
From: Robert Gonzalez <robert@everah.com>
Hi Robert, someone has just asked you a PEP question.
To view this question, answer it and add it to the database, visit
http://nummi.purelyauto.com/questions_a ... 1087565982
Thanks in advance. As always, all help would be appreciated.