hi guys,
i need a mail script that will launch after the insert record on my page.
problem is at the moment it works fine if ony one address is entered. however i have 3 queries on my page that is needs to get the email addresses from.
so i have 3 levels:
agent
regional
financial
my query checks to see if any involment in a case for those guys example:
$ParamSipp_rsAgentEmail = "-1";
if (isset($_GET['Sipp_Sale_Storepod_ID'])) {
$ParamSipp_rsAgentEmail = (get_magic_quotes_gpc()) ? $_GET['Sipp_Sale_Storepod_ID'] : addslashes($_GET['Sipp_Sale_Storepod_ID']);
}
mysql_select_db($database_cbank, $cbank);
$query_rsAgentEmail = sprintf("SELECT users.UserID, users.Email, sipp_sale_storepod.Sipp_Sale_Storepod_ID, sipp_sale_storepod.clients_ClientID, sipp_sale_storepod.UserID FROM users LEFT JOIN sipp_sale_storepod on users.UserID = sipp_sale_storepod.UserID WHERE users.Email is not null and sipp_sale_storepod.Sipp_Sale_Storepod_ID = %s", GetSQLValueString($ParamSipp_rsAgentEmail, "int"));
$rsAgentEmail = mysql_query($query_rsAgentEmail, $cbank) or die(mysql_error());
$row_rsAgentEmail = mysql_fetch_assoc($rsAgentEmail);
$totalRows_rsAgentEmail = mysql_num_rows($rsAgentEmail);
then in my form i have a hidden field with the value of:
<input type="hidden" name="AgentEmail" id="AgentEmail" value="<?php echo $row_rsAgentEmail['Email']; ?>" />
the email script i was using was an old extension used in dreamweaver.
function Trigger_SendEmail(&$tNG) {
$emailObj = new tNG_Email($tNG);
$emailObj->setFrom("{KT_defaultSender}");
$emailObj->setTo("enquiries@domain.com");
$emailObj->setCC("{POST.AgentEmail}");
$emailObj->setBCC("{POST.IFAEmail},{POST.RegionalEmail}");
$emailObj->setSubject("Note Added");
//WriteContent method
$emailObj->setContent("Note Added for client {rsNoteCash.ClientID} {rsNoteCash.App1FirstName} {rsNoteCash.App1LastName} / {rsNoteCash.App2FirstName} {rsNoteCash.App2LastName}\n<br>The note is:\n\n{Note}\n\nPlease login to view the client file.\n");
$emailObj->setEncoding("");
$emailObj->setFormat("Text");
$emailObj->setImportance("High");
return $emailObj->Execute();
if one of the addresses returns nothing on the form it breaks the email sending script. so does anyone know of an email script that will send after the form posted/inserted and will not have the issue of an email address missing?
thanks again