本文整理汇总了PHP中EmailTemplate::SetTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::SetTemplate方法的具体用法?PHP EmailTemplate::SetTemplate怎么用?PHP EmailTemplate::SetTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailTemplate
的用法示例。
在下文中一共展示了EmailTemplate::SetTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encode
$fname = $name;
$lname = "";
}
$password = encode($name, $encode_key);
$db->query("INSERT INTO users (group_id,first_name,last_name,email,password,active,created) VALUES(2,'{$fname}','{$lname}','{$email}','{$password}',0,NOW())");
$new_u_id = $db->lastInsertedId();
// put message into the database
$db->query("INSERT INTO messages (parent_id,listing_id,from_id,to_id,message,timestamp) VALUES(0,'{$listing_id}','{$new_u_id}','{$listing_info->id}','{$message}',NOW())");
$inquiry_id = $db->lastInsertedId();
// send activation email to new user
$code = encode($email, "businessfieds");
// encrypt email to make code
// set template fields
$emailTemplate->SetParameter("activation_url", '<a href="http://www.businessfieds.com/activation&x=' . $code . '">http://www.businessfieds.com/activation&x=' . $code . '</a>');
$emailTemplate->SetParamter("inquirer_name", $name);
$emailTemplate->SetTemplate($settings['new_user_contact_et']);
$sendNewUEmail = sendMail($email, $email->Subject(), $email->CreateBody());
// send email
// send message notifications to inquirer and seller
$emailTemplate->SetParameter("seller_name", $listing_info->first_name . " " . $listing_info->last_name);
$emailTemplate->SetParameter("listing_headline", $listing_info->headline);
$emailTemplate->SetParameter("inquiry_message", $message);
$emailTemplate->SetParameter("inquiry_url", '<a href="http://www.businessfieds.com/inquiries/' . $inquiry_id . '">http://www.businessfieds.com/inquiry/' . $inquiry_id . '</a>');
$emailTemplate->SetTemplate($settings['new_inquiry_buyer_et']);
$sendBuyerEmail = sendMail($email, $email->Subject(), $email->CreateBody());
// send buyer email
$emailTemplate->SetTemplate($settings['new_inquiry_seller_et']);
$sendSellerEmail = sendMail($listing_info->email, $email->Subject(), $email->CreateBody());
// send seller email
} else {
$db->query("INSERT INTO messages (parent_id,listing_id,from_id,to_id,message,timestamp) VALUES(0,'{$listing_id}','{$user_exists}','{$listing_info->id}','{$message}',NOW())");
示例2: DB
require "../includes/config.inc.php";
if (empty($db)) {
require_once "../classes/class.Database.php";
$db = new DB($db_name, $db_host, $db_user, $db_password);
}
require "../includes/functions.php";
require "../includes/session.php";
require_once "../classes/class.Template.php";
$emailTemplate = new EmailTemplate();
// Create an instance for new user from contact form
$thread_id = mysql_real_escape_string($_REQUEST['id']);
$listing_id = mysql_real_escape_string($_REQUEST['listing_id']);
$reply_content = mysql_real_escape_string($_REQUEST['replyContent']);
$to_id = mysql_real_escape_string($_REQUEST['to_id']);
$seller_id = $db->queryUniqueValue("SELECT to_id FROM messages WHERE id = '{$thread_id}'");
$listing_headline = $db->queryUniqueValue("SELECT headline FROM listings WHERE id = '{$listing_id}'");
$to = $db->queryUniqueObject("SELECT first_name, last_name, email FROM users WHERE id= '{$to_id}'");
if ($thread_id) {
$result = $db->query("INSERT INTO messages (parent_id, from_id, to_id, listing_id, message, timestamp) VALUES ('{$thread_id}','{$u_id}','{$to_id}','{$listing_id}','{$reply_content}', NOW())");
// send emails!
$emailTemplate->SetParameter("user_name", $to->first_name . ' ' . $to->last_name);
$emailTemplate->SetParameter("listing_headline", $listing_headline);
if ($to_id == $seller_id) {
$emailTemplate->SetParameter("inquiry_url", '<a href="http://businessfieds.com/myListing/' . $listing_id . '&inquiry_id=' . $thread_id . '#inquiry">http://www.businessfieds.com/myListing/' . $listing_id . '&inquiry_id=' . $thread_id . '#inquiry</a>');
} else {
$emailTemplate->SetParameter("inquiry_url", '<a href="http://businessfieds.com/myAccount&inquiry_id=' . $thread_id . '#inquiry">http://www.businessfieds.com/myAccount&inquiry_id=' . $thread_id . '#inquiry</a>');
}
$emailTemplate->SetTemplate($settings['inquiry_message_et']);
$sendBuyerEmail = sendMail($to->email, $emailTemplate->Subject(), $emailTemplate->CreateBody());
// send other party an email
}