本文整理汇总了PHP中Email::subject方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::subject方法的具体用法?PHP Email::subject怎么用?PHP Email::subject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Email
的用法示例。
在下文中一共展示了Email::subject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmail
public function sendEmail($emailbody, $time, $value, $options)
{
global $user, $session;
$timeformated = DateTime::createFromFormat("U", (int) $time);
$timeformated->setTimezone(new DateTimeZone($this->parentProcessModel->timezone));
$timeformated = $timeformated->format("Y-m-d H:i:s");
$tag = array("{id}", "{type}", "{time}", "{value}");
$replace = array($options['sourceid'], $options['sourcetype'], $timeformated, $value);
$emailbody = str_replace($tag, $replace, $emailbody);
if ($options['sourcetype'] == "INPUT") {
$inputdetails = $this->parentProcessModel->input->get_details($options['sourceid']);
$tag = array("{key}", "{name}", "{node}");
$replace = array($inputdetails['name'], $inputdetails['description'], $inputdetails['nodeid']);
$emailbody = str_replace($tag, $replace, $emailbody);
} else {
if ($options['sourcetype'] == "VIRTUALFEED") {
// Not suported for VIRTUAL FEEDS
}
}
$emailto = $user->get_email($session['userid']);
require_once "Lib/email.php";
$email = new Email();
//$email->from(from);
$email->to($emailto);
$email->subject('Emoncms event alert');
$email->body($emailbody);
$result = $email->send();
if (!$result['success']) {
$this->log->error("Email send returned error. message='" . $result['message'] . "'");
} else {
$this->log->info("Email sent to {$emailto}");
}
}
示例2: dechex
function _sendPasswordTo($email)
{
$user = User::findBy('email', $email);
if ($user) {
use_helper('Email');
$new_pass = '12' . dechex(rand(100000000, 4294967295)) . 'K';
$user->password = sha1($new_pass);
$user->save();
$email = new Email();
$email->from('no-reply@madebyfrog.com', 'Frog CMS');
$email->to($user->email);
$email->subject('Your new password from Frog CMS');
$email->message('username: ' . $user->username . "\npassword: " . $new_pass);
$email->send();
Flash::set('success', 'An email has been send with your new password!');
redirect(get_url('login'));
} else {
Flash::set('email', $email);
Flash::set('error', 'No user found!');
redirect(get_url('login/forgot'));
}
}
示例3: passwordreset
public function passwordreset($username, $emailto)
{
$username_out = preg_replace('/[^\\p{N}\\p{L}_\\s-]/u', '', $username);
if (!filter_var($emailto, FILTER_VALIDATE_EMAIL)) {
return array('success' => false, 'message' => _("Email address format error"));
}
$result = $this->mysqli->query("SELECT * FROM users WHERE `username`='{$username_out}' AND `email`='{$emailto}'");
if ($result->num_rows == 1) {
$row = $result->fetch_array();
$userid = $row['id'];
if ($userid > 0) {
// Generate new random password
$newpass = hash('sha256', md5(uniqid(rand(), true)));
$newpass = substr($newpass, 0, 10);
// Hash and salt
$hash = hash('sha256', $newpass);
$salt = md5(uniqid(rand(), true));
$password = hash('sha256', $salt . $hash);
// Save password and salt
$this->mysqli->query("UPDATE users SET password = '{$password}', salt = '{$salt}' WHERE id = '{$userid}'");
//------------------------------------------------------------------------------
global $enable_password_reset;
if ($enable_password_reset == true) {
require "Lib/email.php";
$email = new Email();
//$email->from(from);
$email->to($emailto);
$email->subject('Emoncms password reset');
$email->body("<p>A password reset was requested for your emoncms account.</p><p>Your can now login with password: {$newpass} </p>");
$result = $email->send();
if (!$result['success']) {
$this->log->error("Email send returned error. emailto=" + $emailto . " message='" . $result['message'] . "'");
} else {
$this->log->info("Email sent to {$emailto}");
}
}
//------------------------------------------------------------------------------
// Sent email with $newpass to $email
return array('success' => true, 'message' => "Password recovery email sent!");
}
}
return array('success' => false, 'message' => "An error occured");
}
示例4: sendMail
public function sendMail($sendTo, $title, $msg)
{
$Email = new Email();
$config['protocol'] = 'sendmail';
$Email->initialize($config);
$Email->from('skymoons@test.com');
$Email->to($sendTo);
//$Email->bcc('mengrui@test.com');
$Email->subject($title);
$Email->message($msg);
$Email->send();
}
示例5: fputcsv
$dataline[$feedid] = "";
}
}
}
if (!$firstline) {
$time = $helperclass->getTimeZoneFormated($time, $usertimezone);
}
fputcsv($fh, array($time) + $dataline, $csv_field_separator);
$firstline = false;
}
fclose($fh);
if ($firstline == false) {
$emailbody = "Attached is CSV for '" . $tag . "' tag.";
$emailbody .= "\nTime range: " . $startText . " to " . $endText;
require_once "Lib/email.php";
$email = new Email();
//$email->from(from);
$email->to($emailto);
$email->subject('Emoncms CSV Export ' . $tag . " (" . $startText . "-" . $endText . ")");
$email->body($emailbody);
$email->attach($filename);
$result = $email->send();
if (!$result['success']) {
echo "Email send returned error. message='" . $result['message'] . "'";
$log->error("Email send returned error. message='" . $result['message'] . "'");
} else {
$log->info("Email sent to {$emailto}");
}
}
}
}
示例6: _writeMail
private function _writeMail($title, $message, $user = array(), $paw = NULL)
{
if (!$this->_validateObject($user, false)) {
return false;
}
// GET LOGIN URL
$url = $this->config["account_pages"]["login"];
if (defined("CMS_BACKEND") && CMS_BACKEND == true && startsWith($url, ADMIN_DIR . "/")) {
$url = str_replace(ADMIN_DIR . "/", "", $url);
}
if (!startsWith($url, "http") && !startsWith($url, "www")) {
$url = get_url($url);
}
$url = endsWith($url, "/") ? substr($url, 0, -1) : $url;
// DEFAULT REPLACEMENTS
$replacements = array("{{USR_USERNAME}}" => $user->username, "{{USR_NAME}}" => $user->name, "{{USR_EMAIL}}" => $user->email, "{{WEB_TITLE}}" => Setting::get("admin_title"), "{{WEB_LINK}}" => "<a href='" . URL_PUBLIC . "'>" . Setting::get("admin_title") . "</a>", "{{WEB_URL}}" => URL_PUBLIC, "{{WEB_EMAIL}}" => Setting::get("admin_email"), "{{WEB_LOGIN}}" => "<a href='" . $url . "'>" . __("Login") . "</a>", "{{WEB_LOGIN_URL}}" => $url);
// PAW-ACTION REPLACEMENTS
if (is_array($paw)) {
if (!isset($paw["code"]) || !isset($paw["link"]) || !isset($paw["url"])) {
return false;
}
$replacements["{{PAW_CODE}}"] = $paw["code"];
$replacements["{{PAW_LINK}}"] = $paw["link"];
$replacements["{{PAW_URL}}"] = $paw["url"];
}
// eMAIL
$message = str_replace(array_keys($replacements), array_values($replacements), nl2br($message));
use_helper("Email");
$email = new Email();
$email->to($user->email);
$email->from($this->config["message_from"], Setting::get("admin_title"));
$email->replyto($this->config["message_replyto"], Setting::get("admin_title"));
$email->setMailtype($this->config["message_type"]);
$email->subject($title);
$email->message($message);
if (@$email->send()) {
return true;
}
return false;
}
示例7: set_subject
/**
* set subject of mail
*
* @param string subject of the email
*
* @access public
*
* @author patrick.kracht
*/
public function set_subject($subject)
{
self::$subject = utf8_decode($subject);
}
示例8: _sendPasswordTo
/**
* This method is used to send a newly generated password to a user.
*
* @param string $email The user's email adress.
*/
private function _sendPasswordTo($email)
{
$user = User::findBy('email', $email);
if ($user) {
use_helper('Email');
$new_pass = '12' . dechex(rand(100000000, 4294967295)) . 'K';
$user->password = AuthUser::generateHashedPassword($new_pass . $user->salt);
$user->save();
$email = new Email();
$email->from(Setting::get('admin_email'), Setting::get('admin_title'));
$email->to($user->email);
$email->subject(__('Your new password from ') . Setting::get('admin_title'));
$email->message(__('Username') . ': ' . $user->username . "\n" . __('Password') . ': ' . $new_pass);
$email->send();
Flash::set('success', __('An email has been sent with your new password!'));
redirect(get_url('login'));
} else {
Flash::set('email', $email);
Flash::set('error', __('No user found!'));
redirect(get_url('login/forgot'));
}
}