本文整理匯總了PHP中email::set_message_fields方法的典型用法代碼示例。如果您正苦於以下問題:PHP email::set_message_fields方法的具體用法?PHP email::set_message_fields怎麽用?PHP email::set_message_fields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類email
的用法示例。
在下文中一共展示了email::set_message_fields方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send_password_link
public function send_password_link($user, $key)
{
$message = file_get_contents("../extra/reset_password.txt");
$replace = array("FULLNAME" => $user["fullname"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "KEY" => $key);
$email = new email("Reset password at " . $_SERVER["SERVER_NAME"], $this->settings->webmaster_email);
$email->set_message_fields($replace);
$email->message($message);
$email->send($user["email"], $user["fullname"]);
}
示例2: send_notification
public function send_notification($user)
{
if (isset($user["id"]) == false) {
$type = "created";
} else {
$type = "updated";
}
if (($message = file_get_contents("../extra/account_" . $type . ".txt")) === false) {
return;
}
$replace = array("USERNAME" => $user["username"], "PASSWORD" => $user["password"], "FULLNAME" => $user["fullname"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "PROTOCOL" => $_SERVER["HTTP_SCHEME"], "TITLE" => $this->settings->head_title);
$email = new email("Account " . $type . " at " . $_SERVER["SERVER_NAME"], $this->settings->webmaster_email);
$email->set_message_fields($replace);
$email->message($message);
return $email->send($user["email"], $user["fullname"]);
}
示例3: sign_up
public function sign_up($data)
{
$data = strtr($data, "_-:", "/+=");
if (($data = base64_decode($data)) === false) {
return false;
}
$aes = new AES256($this->settings->secret_website_code);
if (($data = $aes->decrypt($data)) === false) {
return false;
}
if (($data = json_decode($data, true)) === false) {
return false;
}
if ($data["timestamp"] + HOUR < time()) {
return false;
}
$signature = $data["signature"];
unset($data["signature"]);
if ($this->get_signature($data) != $signature) {
return false;
}
if ($this->valid_signup($data) == false) {
return false;
}
$user = array("id" => null, "organisation_id" => 1, "username" => $data["username"], "password" => hash_password($data["password"], $data["username"]), "one_time_key" => null, "status" => USER_STATUS_ACTIVE, "fullname" => $data["fullname"], "email" => $data["email"]);
if ($this->db->query("begin") == false) {
return false;
}
if ($this->db->insert("users", $user) == false) {
$this->db->query("rollback");
return false;
}
$user_id = $this->db->last_insert_id;
if ($this->db->query("insert into user_role values (%d, %d)", $user_id, USER_ROLE_ID) == false) {
$this->db->query("rollback");
return false;
}
$email = new email("New account registered at " . $_SERVER["SERVER_NAME"], $this->setttings->webmaster_email);
$email->set_message_fields(array("FULLNAME" => $data["fullname"], "EMAIL" => $data["email"], "USERNAME" => $data["username"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "IP_ADDR" => $_SERVER["REMOTE_ADDR"]));
$email->message(file_get_contents("../extra/account_registered.txt"));
$email->send($this->settings->webmaster_email);
return $this->db->query("commit") !== false;
}