本文整理汇总了PHP中Mailer::set_default_sender方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::set_default_sender方法的具体用法?PHP Mailer::set_default_sender怎么用?PHP Mailer::set_default_sender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::set_default_sender方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_account_enabled
/**
* send_account_enabled
* This sends the account enabled email for the specified user
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public static function send_account_enabled($username, $fullname, $email)
{
$mailer = new Mailer();
$mailer->set_default_sender();
$mailer->subject = sprintf(T_("Account enabled at %s"), AmpConfig::get('site_title'));
$mailer->message = sprintf(T_("Your account %s has been enabled\n\n\n Please logon using %s"), $username, AmpConfig::get('web_path') . "/login.php");
$mailer->recipient = $email;
$mailer->recipient_name = $fullname;
$mailer->send();
}
示例2: send_confirmation
/**
* send_confirmation
* This sends the confirmation e-mail for the specified user
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public static function send_confirmation($username, $fullname, $email, $website, $password, $validation)
{
$mailer = new Mailer();
// We are the system
$mailer->set_default_sender();
$mailer->subject = sprintf(T_("New User Registration at %s"), AmpConfig::get('site_title'));
$mailer->message = sprintf(T_("Thank you for registering\n\n\nPlease keep this e-mail for your records. Your account information is as follows:\n----------------------\nUsername: %s\n----------------------\n\nYour account is currently inactive. You cannot use it until you've visited the following link:\n\n%s\n\nThank you for registering\n"), $username, AmpConfig::get('web_path') . "/register.php?action=validate&username={$username}&auth={$validation}");
$mailer->recipient = $email;
$mailer->recipient_name = $fullname;
$mailer->send();
// Check to see if the admin should be notified
if (AmpConfig::get('admin_notify_reg')) {
$mailer->message = sprintf(T_("A new user has registered\nThe following values were entered.\n\nUsername: %s\nFullname: %s\nE-mail: %s\nWebsite: %s\n\n"), $username, $fullname, $email, $website);
$mailer->send_to_group('admins');
}
return true;
}
示例3: send_newpassword
function send_newpassword($email, $current_ip)
{
/* get the Client and set the new password */
$client = User::get_from_email($email);
if ($client && $client->email == $email) {
$newpassword = generate_password(6);
$client->update_password($newpassword);
$mailer = new Mailer();
$mailer->set_default_sender();
$mailer->subject = T_("Lost Password");
$mailer->recipient_name = $client->fullname;
$mailer->recipient = $client->email;
$message = sprintf(T_("A user from %s has requested a password reset for '%s'."), $current_ip, $client->username);
$message .= "\n";
$message .= sprintf(T_("The password has been set to: %s"), $newpassword);
$mailer->message = $message;
return $mailer->send();
}
return false;
}
示例4: Mailer
exit;
}
// Multi-byte Character Mail
if (function_exists('mb_language')) {
$ini_default_charset = version_compare(PHP_VERSION, '5.6', '<') ? 'mbstring.internal_encoding' : 'default_charset';
if (ini_get($ini_default_charset)) {
ini_set($ini_default_charset, "UTF-8");
}
mb_language("uni");
}
$mailer = new Mailer();
// Set the vars on the object
$mailer->subject = $_REQUEST['subject'];
$mailer->message = $_REQUEST['message'];
if ($_REQUEST['from'] == 'system') {
$mailer->set_default_sender();
} else {
$mailer->sender = $GLOBALS['user']->email;
$mailer->sender_name = $GLOBALS['user']->fullname;
}
if ($mailer->send_to_group($_REQUEST['to'])) {
$title = T_('E-mail Sent');
$body = T_('Your E-mail was successfully sent.');
} else {
$title = T_('E-mail Not Sent');
$body = T_('Your E-mail was not sent.');
}
$url = AmpConfig::get('web_path') . '/admin/mail.php';
show_confirmation($title, $body, $url);
break;
default:
示例5: create
/**
* create
* This takes a key'd array of data as input and inserts a new shoutbox entry, it returns the auto_inc id
*/
public static function create(array $data)
{
if (!Core::is_library_item($data['object_type'])) {
return false;
}
$sticky = isset($data['sticky']) ? 1 : 0;
$user = intval($data['user'] ?: $GLOBALS['user']->id);
$date = intval($data['date'] ?: time());
$comment = strip_tags($data['comment']);
$sql = "INSERT INTO `user_shout` (`user`,`date`,`text`,`sticky`,`object_id`,`object_type`, `data`) " . "VALUES (? , ?, ?, ?, ?, ?, ?)";
Dba::write($sql, array($user, $date, $comment, $sticky, $data['object_id'], $data['object_type'], $data['data']));
$insert_id = Dba::insert_id();
// Never send email in case of user impersonation
if (!isset($data['user']) && $insert_id) {
$libitem = new $data['object_type']($data['object_id']);
$item_owner_id = $libitem->get_user_owner();
if ($item_owner_id) {
if (Preference::get_by_user($item_owner_id, 'notify_email')) {
$item_owner = new User($item_owner_id);
if (!empty($item_owner->email)) {
$libitem->format();
$mailer = new Mailer();
$mailer->set_default_sender();
$mailer->recipient = $item_owner->email;
$mailer->recipient_name = $item_owner->fullname;
$mailer->subject = T_('New shout on your content');
$mailer->message = sprintf(T_("You just received a new shout from %s on your content `%s`.\n\n\n ----------------------\n %s\n ----------------------\n\n %s\n "), $GLOBALS['user']->fullname, $libitem->get_fullname(), $comment, AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=" . $data['object_type'] . "&id=" . $data['object_id'] . "#shout" . $insert_id);
$mailer->send();
}
}
}
}
return $insert_id;
}
示例6: create
public static function create(array $data)
{
$subject = trim(strip_tags($data['subject']));
$message = trim(strip_tags($data['message']));
if (empty($subject)) {
AmpError::add('subject', T_('Error: Subject Required'));
}
$to_user = User::get_from_username($data['to_user']);
if (!$to_user->id) {
AmpError::add('to_user', T_('Error: Unknown user'));
}
if (!AmpError::occurred()) {
$from_user = $data['from_user'] ?: $GLOBALS['user']->id;
$creation_date = $data['creation_date'] ?: time();
$is_read = $data['is_read'] ?: 0;
$sql = "INSERT INTO `user_pvmsg` (`subject`, `message`, `from_user`, `to_user`, `creation_date`, `is_read`) " . "VALUES (?, ?, ?, ?, ?, ?)";
if (Dba::write($sql, array($subject, $message, $from_user, $to_user->id, $creation_date, $is_read))) {
$insert_id = Dba::insert_id();
// Never send email in case of user impersonation
if (!isset($data['from_user']) && $insert_id) {
if (Preference::get_by_user($to_user->id, 'notify_email')) {
if (!empty($to_user->email)) {
$mailer = new Mailer();
$mailer->set_default_sender();
$mailer->recipient = $to_user->email;
$mailer->recipient_name = $to_user->fullname;
$mailer->subject = "[" . T_('Private Message') . "] " . $subject;
$mailer->message = sprintf(T_("You just received a new private message from %s.\n\n\n ----------------------\n %s\n ----------------------\n\n %s\n "), $GLOBALS['user']->fullname, $message, AmpConfig::get('web_path') . "/pvmsg.php?action=show&pvmsg_id=" . $insert_id);
$mailer->send();
}
}
}
return $insert_id;
}
}
return false;
}