This topic is locked

How to add the recipients email to the form

4/27/2010 6:49:08 PM
PHPRunner General questions
I
iwendlei author

How do I add the recipients email to the form? Looks at the line in Blue and see that I can manually add and email address. However I need to add the recipients email from the database and this code is from phpMailer.
include("include\PHPMailer\class.phpmailer.php");

include("include\PHPMailer\class.smtp.php");

$mail = new PHPMailer();

$mail->IsSMTP();

$mail->SMTPAuth = true;

$mail->Host = "smtp.myhosting.com";

$mail->Port = 25;

$mail->Username = "wendy@secret.com";

$mail->Password = "secret";

$mail->From = "wendy@secret.com";

$mail->FromName = "wendytest";

$mail->Subject = "wendytest";

$message="";
$message .= "<html>";

$message .= "<div><img src=\"images/phpmailer.gif\"></div>";

$message .= "
&nbsp;This is a test of PHPMailer.
";

$message .= "This particular example uses <strong>HTML</strong>, with a &lt;div&gt; tag and inline";

$message .= "Also note the use of the PHPMailer logo above with no specific code to handle including it.";

$message .= "</html>";
$mail->MsgHTML($message);

$mail->IsHTML(true);


$mail->AddAddress("recipient@email.com");


$mail->AddAddress($values["EMAIL_E"]);

$mail->AddAddress($values["EMAIL_N"]);
if(!$mail->Send()) {

echo "Mailer Error: " . $mail->ErrorInfo;

} else {

header("Location: demo3_add.php?a=return");

exit();

}
return true;

J
Jane 5/3/2010

Hi,
you can select this value from database usign custom code. Here is a sample:

$rstmp = CustomQuery("select recipient_email from TableName where ...");

$datatmp = db_fetch_array($rstmp);

$mail->AddAddress($datatmp["recipient_email"]);



where recipient_email is your actual field name, TableName is your actual table name.