PDA

View Full Version : Linking recordset email addresses


ddidion3394878
01-28-2010, 06:32 AM
Hi

I would like to use the contact form dynamicaly. I need the contact form to be linked from a detail page that contains a members email address from a recordset, pass that email address to the contact form so that the mail is sent to that specific member.
Any ideas.This is the codethat is not working.

WAGLOBALS

<?php
$WAGLOBAL_Captcha_Width = "200" ;
$WAGLOBAL_Captcha_Height = "40" ;
$WAGLOBAL_Captcha_Characters = "5" ;
$WAGLOBAL_Captcha_Font = "Fonts/MOM_T___.TTF" ;
$WAGLOBAL_Captcha_BG = "ffffff" ;
$WAGLOBAL_Captcha_Noise = "000000" ;
$WAGLOBAL_Captcha_Text = "000000" ;
$WAGLOBAL_Captcha_BG_transparent = "0" ;
$WAGLOBAL_Email_Server = "mail.americangymtrader.com" ;
$WAGLOBAL_Contact_Email_Subject = "Potential Buyer from American Gym Trader" ;
$WAGLOBAL_Contact_Email_To = ((isset($_POST["ContactEmail"]))?$_POST["ContactEmail"]:"");

$WAGLOBAL_Contact_Email_CC = "";
$WAGLOBAL_Contact_Email_BCC = "";
?>

WAUE contact __________________________________________________ ________________________________

<?php
$MailAttachments = "";
$MailCC = "";
$MailTo = ((isset($_POST["ContactEmail"]))?$_POST["ContactEmail"]:"");

$MailBodyFormat = ""; $MailBody = "";
$MailImportance = "";
$MailFrom = "".((isset($_POST["Email_address"]))?$_POST["Email_address"]:"") ."";
$MailSubject = "".($WAGLOBAL_Contact_Email_Subject) ."";
$_SERVER["QUERY_STRING"] = "";

//Global Variables

$WA_MailObject = WAUE_Definition("".($WAGLOBAL_Email_Server) ."","25","","","","");

if ($RecipientEmail) {
$WA_MailObject = WAUE_AddRecipient($WA_MailObject,$RecipientEmail);
}
else {
//To Entries
}

//Attachment Entries

//BCC Entries
$WA_MailObject = WAUE_AddBCC($WA_MailObject,"".($WAGLOBAL_Contact_Email_BCC) ."");

//CC Entries
$WA_MailObject = WAUE_AddCC($WA_MailObject,"".($WAGLOBAL_Contact_Email_CC) ."");

//Body Format
$WA_MailObject = WAUE_BodyFormat($WA_MailObject,2);

//Set Importance
$WA_MailObject = WAUE_SetImportance($WA_MailObject,"3");

//Start Mail Body

$MailBody = $MailBody . "";

ob_start();
require_once(dirname(__FILE__) . ("/Templates/contactus.php"));
$contents = ob_get_clean();

$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . ($contents);
$MailBody = $MailBody . "";
//End Mail Body

$WA_MailObject = WAUE_SendMail($WA_MailObject,$MailAttachments,$Mai lBCC,$MailCC,$MailTo,$MailImportance,$MailFrom,$Ma ilSubject,$MailBody);

$WA_MailObject = null;
?>

Eric Mittman
01-28-2010, 12:20 PM
You can put the Contact form into the details page and make use of the value from the recordset directly. I would suggest that you put this into the details page and make sure that it is working in it's default format first. Once you can confirm that it is working you can make the email form field a hidden field and set the value to your email address from the recordset.

ddidion3394878
01-28-2010, 04:56 PM
Thanks for the reply. I inserted the contact form into the details page and the only way it works is if I type a fixed email address in the mail to line. Is my code correct ?

$WAGLOBAL_Contact_Email_To = ((isset($_POST["ContactEmail"]))?$_POST["ContactEmail"]:"");

ddidion3394878
01-29-2010, 04:43 AM
Thanks Eric

I got the contact form to work . I had the wrong code. Should have been
$RecipientEmail = "".$row_DetailRS1['ContactEmail'] ."";include("WA_Universal_Email/WAUE_contact_1.php");

What makes a great company is not the products they sell, it is the support that stands behind it.I wished I had found WebAssist 6 months ago.

Thanks again

Dave Didion
American Gym Trader

Eric Mittman
01-29-2010, 02:56 PM
Nice catch, php is very flexible and easy to work with when it comes to dynamic info. Thanks for the kind words, let us know if you have any other questions or if you encounter any issues.