本文整理汇总了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;
}