I know support has been discontinued, but maybe another user has an idea on how to help me??
I am using the Send Mail to Recipients from Record Set, with MX Send Email version 3.6.5 (PHP/MySql).
Program is located at: http://www.masonicpathways.com/testcontact.php.
After submitting the form, two things are not happening...
1. The email is not getting sent
2. The redirect should go to contact_us_autorespond.html, but it goes to testcontact.php? - which does nothing.
Here is the code:
<?php require_once('Connections/connform.php'); ?>
<?php
// Load the common classes
require_once('includes/common/KT_common.php');
// Load the tNG classes
require_once('includes/tng/tNG.inc.php');
// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("");
// Make unified connection variable
$conn_c KT_connection($connform, $database_connform);
// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("name_con", true, "text", "", "1", "", "Please enter a valid Name.");
$formValidation->addField("email_con", true, "text", "email", "", "", "Please enter a valid E-mail Address");
$formValidation->addField("phone_con", false, "text", "phone", "", "", "Please enter a valid Phone Number");
$formValidation->addField("message_con", true, "text", "", "1", "", "Please enter a valid message.");
$tNGs->prepareValidation($formValidation);
// End trigger
//start Trigger_EmailRecordset trigger
//remove this line if you want to edit the code by hand
function Trigger_EmailRecordset(&$tNG) {
$rsemailObj = new tNG_EmailRecordset($tNG);
$rsemailObj->setRecordset("rsMail");
$rsemailObj->setFrom("{email_con}");
$rsemailObj->setTo("email_dep");
$rsemailObj->setSubject("Masonic Pathways Contact Submission from {name_con}");
//WriteContent method
$rsemailObj->setContent("<P>Masonic Pathways Contact Submission for {id_dep_con}</P>\n<P></P>\n\n<P>Name: {name_con}</P>\n<P>Email: {email_con}</P>\n<P>Phone: {phone_con}</P>\n<P>Address: {address_con}</P>\n<P>Preferred Contact Method: {preferred_con}</P>\n<P></P>\n<P>Feedback/Message: {message_con}</P>\n");
$rsemailObj->setEncoding("ISO-8859-1");
$rsemailObj->setFormat("HTML/Text");
$rsemailObj->setImportance("Normal");
return $rsemailObj->Execute();
}
//end Trigger_EmailRecordset trigger
//In order for the rsDepartment recordset to only contain UNIQUE departments:
//First seven (7) records in the department_dep table must be:
//Masonic Village Estates, Michigan Masonic Home, Sanders Health Care Center, Rehab Center, Doig Chapel/Conference Center, Volunteer Opportunities, and Employment Opportunities
//If add any more departments then add as record number 8, 9, 10 etc. this will take some manipulating of the id_dep field, AND change the
//query statment below to include the total number of unique departments.
mysql_select_db($database_connform, $connform);
$query_rsDepartment = "SELECT * FROM department_dep WHERE id_dep <= 7 ORDER BY id_dep ASC";
$rsDepartment = mysql_query($query_rsDepartment, $connform) or die(mysql_error());
$row_rsDepartment = mysql_fetch_assoc($rsDepartment);
$totalRows_rsDepartment = mysql_num_rows($rsDepartment);
$colname_rsMail = "-1";
if (isset($HTTP_POST_VARS['name_dep'])) {
$colname_rsMail = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['name_dep'] : addslashes($HTTP_POST_VARS['name_dep']);
}
mysql_select_db($database_connform, $connform);
$query_rsMail = sprintf("SELECT * FROM department_dep WHERE name_dep = '%s'", $colname_rsMail);
$rsMail = mysql_query($query_rsMail, $connform) or die(mysql_error());
$row_rsMail = mysql_fetch_assoc($rsMail);
$totalRows_rsMail = mysql_num_rows($rsMail);
// Make an insert transaction instance
$ins_contact_con = new tNG_insert($conn_connform);
$tNGs->addTransaction($ins_contact_con);
// Register triggers
$ins_contact_con->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_contact_con->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_contact_con->registerTrigger("AFTER", "Trigger_EmailRecordset", 40);
$ins_contact_con->registerTrigger("END", "Trigger_Default_Redirect", 99, "contact_us_autorespond.html");
// Add columns
$ins_contact_con->setTable("contact_con");
$ins_contact_con->addColumn("id_dep_con", "NUMERIC_TYPE", "POST", "id_dep_con");
$ins_contact_con->addColumn("name_con", "STRING_TYPE", "POST", "name_con");
$ins_contact_con->addColumn("email_con", "STRING_TYPE", "POST", "email_con");
$ins_contact_con->addColumn("phone_con", "STRING_TYPE", "POST", "phone_con");
$ins_contact_con->addColumn("address_con", "STRING_TYPE", "POST", "address_con");
$ins_contact_con->addColumn("preferred_con", "NUMERIC_TYPE", "POST", "preferred_con");
$ins_contact_con->addColumn("message_con", "STRING_TYPE", "POST", "message_con");
$ins_contact_con->setPrimaryKey("id_con", "NUMERIC_TYPE");
// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset
$rscontact_con = $tNGs->getRecordset("contact_con");
$row_rscontact_con = mysql_fetch_assoc($rscontact_con);
$totalRows_rscontact_con = mysql_num_rows($rscontact_con);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" c>
<link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="includes/common/js/base.js" type="text/javascript"></script>
<script src="includes/common/js/utility.js" type="text/javascript"></script>
<script src="includes/skins/style.js" type="text/javascript"></script>
<?php echo $tNGs->displayValidationRules();?>
</head>
<body>
<?php
echo $tNGs->getErrorMsg();
?>
<form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<tr>
<td class="KT_th"><label for="id_dep_con">Department:</label>
</td>
<td>
<select name="id_dep_con" id="id_dep_con">
<?php
do {
?>
<option value="<?php echo $row_rsDepartment['id_dep']?>"<?php if (!(strcmp($row_rsDepartment['id_dep'], $row_rscontact_con['id_dep_con']))) {echo "SELECTED";} ?>><?php echo $row_rsDepartment['name_dep']?></option>
<?php
} while ($row_rsDepartment = mysql_fetch_assoc($rsDepartment));
$rows = mysql_num_rows($rsDepartment);
if($rows > 0) {
mysql_data_seek($rsDepartment, 0);
$row_rsDepartment = mysql_fetch_assoc($rsDepartment);
}
?>
</select>
<?php echo $tNGs->displayFieldError("contact_con", "id_dep_con"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="name_con">Name:</label>
</td>
<td>
<input type="text" name="name_con" id="name_con" value="<?php echo KT_escapeAttribute($row_rscontact_con['name_con']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("name_con");?> <?php echo $tNGs->displayFieldError("contact_con", "name_con"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="email_con">Email:</label>
</td>
<td>
<input type="text" name="email_con" id="email_con" value="<?php echo KT_escapeAttribute($row_rscontact_con['email_con']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("email_con");?> <?php echo $tNGs->displayFieldError("contact_con", "email_con"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="phone_con">Phone:</label>
</td>
<td>
<input type="text" name="phone_con" id="phone_con" value="<?php echo KT_escapeAttribute($row_rscontact_con['phone_con']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("phone_con");?> <?php echo $tNGs->displayFieldError("contact_con", "phone_con"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="address_con">Address:</label>
</td>
<td>
<input type="text" name="address_con" id="address_con" value="<?php echo KT_escapeAttribute($row_rscontact_con['address_con']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("address_con");?> <?php echo $tNGs->displayFieldError("contact_con", "address_con"); ?> </td>
</tr>
<tr>
<td colspan="2" class="KT_th"><label for="label">Preferred Contact Method:</label>
</td>
</tr>
<tr>
<td class="KT_th"></td>
<td>
<div>
<input <?php if (!(strcmp(KT_escapeAttribute($row_rscontact_con['preferred_con']),"1"))) {echo "CHECKED";} ?> type="radio" name="preferred_con" id="preferred_con_1" value="1" />
<label for="preferred_con_1">Phone</label>
</div>
<div>
<input <?php if (!(strcmp(KT_escapeAttribute($row_rscontact_con['preferred_con']),"2"))) {echo "CHECKED";} ?> type="radio" name="preferred_con" id="preferred_con_2" value="2" />
<label for="preferred_con_2">Email</label>
</div>
<div>
<input <?php if (!(strcmp(KT_escapeAttribute($row_rscontact_con['preferred_con']),"3"))) {echo "CHECKED";} ?> type="radio" name="preferred_con" id="preferred_con_3" value="3" />
<label for="preferred_con_3">Postal Mail</label>
</div>
<?php echo $tNGs->displayFieldError("contact_con", "preferred_con"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="message_con">Message:</label>
</td>
<td>
<textarea name="message_con" id="message_con" cols="50" rows="5"><?php echo KT_escapeAttribute($row_rscontact_con['message_con']); ?></textarea>
<?php echo $tNGs->displayFieldHint("message_con");?> <?php echo $tNGs->displayFieldError("contact_con", "message_con"); ?> </td>
</tr>
<tr class="KT_buttons">
<td colspan="2">
<input type="submit" name="KT_Insert1" id="KT_Insert1" value="Insert Record" />
</td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($rsDepartment);
mysql_free_result($rsMail);
?>