本文整理匯總了PHP中mailer類的典型用法代碼示例。如果您正苦於以下問題:PHP mailer類的具體用法?PHP mailer怎麽用?PHP mailer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了mailer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send_email
/** Send en bestemt artikkel på e-post */
protected function send_email($row)
{
$this->email->text('Hei,
Siden du ikke lengre er med i avisfirmaet "' . $row['ff_name'] . '" har din artikkel blitt slettet fordi den ikke tilhørte noen utgivelse. I tilfelle du kanskje ønsker å beholde teksten fra artikkelen, sender vi den på e-post.
Avisfirma: ' . $row['ff_name'] . ' <' . ess::$s['path'] . '/ff/?ff_id=' . $row['ff_id'] . '>
Tittel: ' . $row['ffna_title'] . '
Opprettet: ' . ess::$b->date->get($row['ffna_created_time'])->format(date::FORMAT_SEC) . ($row['ffna_updated_time'] ? '
Sist oppdatert: ' . ess::$b->date->get($row['ffna_updated_time'])->format(date::FORMAT_SEC) : '') . ($row['ffna_published'] ? '
Publisert: ' . ess::$b->date->get($row['ffna_published_time'])->format(date::FORMAT_SEC) : '') . '
Pris: ' . game::format_cash($row['ffna_price']) . '
Innhold:
-- START --
' . $row['ffna_text'] . '
-- SLUTT --
--
Kofradia.no
Denne e-posten er sendt til ' . $row['u_email'] . ' som ' . ($row['up_access_level'] == 0 ? 'tidligere tilhørte' : 'tilhører') . ' ' . $row['up_name'] . '
' . ess::$s['path']);
$this->email->format();
mailer::add_emails($this->email, $row['u_email'], "Din tidligere artikkel: {$row['ffna_title']} - Kofradia", true);
putlog("CREWCHAN", "AVISARTIKKEL SLETTET: E-post planlagt for utsendelse. %c4Mailer scriptet må kjøres!");
}
示例2: getInstance
public static function getInstance()
{
if (!self::$m_pInstance) {
self::$m_pInstance = new mailer();
}
return self::$m_pInstance;
}
示例3: send
/**
* 發送郵件
*/
public function send($limit = 5)
{
$this->clear();
//根據優先級排序獲取
$mails = $this->where(array('lock_expiry' => array('lt', time())))->order('priority DESC,id,err_num')->limit($limit)->select();
if (!$mails) {
return false;
}
//增加一次發送錯誤並且把鎖定時間延長避免多個發送請求衝突
$qids = array();
foreach ($mails as $_mail) {
$qids[] = $_mail['id'];
}
$this->where(array('id' => array('in', $qids)))->save(array('err_num' => array('exp', 'err_num+1'), 'lock_expiry' => array('exp', 'lock_expiry+' . $this->_send_lock)));
//發送
$mailer = mailer::get_instance();
foreach ($mails as $_mail) {
if ($mailer->send($_mail['mail_to'], $_mail['mail_subject'], $_mail['mail_body'])) {
//刪除隊列
$this->delete($_mail['id']);
} else {
//失敗暫不處理
}
}
}
示例4: ajax_mail_test
public function ajax_mail_test() {
$email = $this->_get('email', 'trim');
!$email && $this->ajaxReturn(0);
//發送
$mailer = mailer::get_instance();
if ($mailer->send($email, L('send_test_email_subject'), L('send_test_email_body'))) {
$this->ajaxReturn(1);
} else {
$this->ajaxReturn(0);
}
}
示例5: ajax_mail_test
public function ajax_mail_test()
{
$email = $this->_get('email', 'trim');
!$email && $this->ajaxReturn(0);
//發送
$mailer = mailer::get_instance();
if ($mailer->send($email, '這是一封測試郵件', '這是一封飛天俠秒殺程序自動發送的測試郵件')) {
$this->ajaxReturn(1);
} else {
$this->ajaxReturn(0);
}
}
示例6: send
function send()
{
$Message = new mContact();
$Message->__post();
if ($Message->validate()) {
$Customer = new mCustomer();
$Customer->email = $Message->email;
if ($Customer->load()) {
$Message->customer = $Customer->id();
}
//Save and send
$Message->save();
$Email = new mailer();
$Email->sendContactForm($Message);
$Email->sendAdminContactConfirm($Message);
$this->display('sent');
} else {
data('send-error', 'The form is not complete');
$this->display('form');
}
}
示例7: html
function html($to, $toName, $from, $fromName, $subject, $body)
{
$mail = new mailer();
if (defined('mail_from')) {
$mail->From = mail_from;
$mail->AddReplyTo($from, $fromName);
} else {
$mail->From = $from;
}
$mail->FromName = $fromName;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
switch (gettype($to)) {
case 'string':
$mail->AddAddress($to, $toName);
break;
case 'array':
foreach ($to as $toKey => $thisTo) {
$mail->AddAddress($thisTo, $toName[$toKey]);
}
break;
default:
trigger_error('invalid type for address field');
}
if (!$mail->Send()) {
trigger_error("Message could not be sent. Mailer Error: " . $mail->ErrorInfo);
}
}
示例8: recalcRecipients
function recalcRecipients($post)
{
$objResponse = new xajaxResponse();
if (trim($post)) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/mailer.php';
if (get_magic_quotes_runtime() || get_magic_quotes_gpc()) {
$post = stripslashes($post);
}
$post = iconv('CP1251', 'UTF-8', $post);
$_post = json_decode($post, true);
foreach ($_post as $k => $v) {
if ($v['name'] == 'attachedfiles_session') {
continue;
}
$result[$v['name']] = iconv('UTF-8', 'CP1251', $v['value']);
}
$url = http_build_query($result);
parse_str($url, $output);
$mailer = new mailer();
$filter = $mailer->loadPOST($output);
$cnt = $mailer->getCountRecipients(array('frl', 'emp'), $filter);
if ($filter['filter_emp'] > 0 && $filter['filter_frl'] > 0) {
$sum = array_sum($cnt);
} elseif ($filter['filter_emp'] > 0) {
$sum = $cnt[0];
} elseif ($filter['filter_frl'] > 0) {
$sum = $cnt[1];
} else {
$sum = array_sum($cnt);
}
$sum = $mailer->calcSumRecipientsCount($filter, $cnt);
$text = number_format($sum, 0, ',', ' ') . ' ' . ending($sum, 'человек', 'человека', 'человек');
$objResponse->assign('all_recipients_count', 'innerHTML', $text);
$objResponse->assign('emp_recipients_count', 'innerHTML', number_format($cnt[0], 0, ',', ' '));
$objResponse->assign('frl_recipients_count', 'innerHTML', number_format($cnt[1], 0, ',', ' '));
}
return $objResponse;
}
示例9: exec
public function exec($data)
{
$response_array = array();
$name = ucwords($data['name']);
$email = $data['email'];
$phone = $data['phone'] != "" ? $data['phone'] : "-";
$message = $data['message'];
// NOTIFY RECEIVER BY EMAIL
// Generate Email BODY
$html = file_get_contents(BASE_PATH . 'email_template/contact');
$html = htmlspecialchars($html);
$html = str_replace('[NAME]', $name, $html);
$html = str_replace('[EMAIL]', $email, $html);
$html = str_replace('[PHONE]', $phone, $html);
$html = str_replace('[MESSAGE]', $message, $html);
$html = html_entity_decode($html);
$body = $html;
// Send Email
$mailer = new mailer();
$mailer->IsSMTP();
// set mailer to use SMTP
$mailer->Port = EMAIL_PORT;
$mailer->Host = EMAIL_HOST;
// specify main and backup server
$mailer->SMTPAuth = true;
// turn on SMTP authentication
$mailer->Username = NOREPLY_EMAIL;
// SMTP username
$mailer->Password = NOREPLY_PASS;
// SMTP password
$mailer->From = NOREPLY_EMAIL;
$mailer->FromName = SUPPORT_NAME;
$mailer->AddReplyTo($email, $name);
$mailer->AddAddress(CONTACT_EMAIL);
$mailer->IsHTML(true);
$mailer->Subject = "NEW message from {$email} via 1STG Contact Form.";
$mailer->Body = $body;
if (!$mailer->Send()) {
$response_array['r'] = "false";
$response_array['msg'] = "Technical Error: " . $mailer->ErrorInfo;
} else {
$response_array['r'] = "true";
$response_array['msg'] = "Your message has been successfully submit.";
}
return $response_array;
}
示例10: execute
/**
* Form to email a member
*
* @author Jason Warner <jason@mercuryboard.com>
* @since RC1
**/
function execute()
{
$this->set_title($this->lang->email_email);
$this->tree($this->lang->email_email);
if (!$this->perms->auth('email_use')) {
return $this->message($this->lang->email_email, $this->lang->email_no_perm);
}
if (!isset($this->post['submit'])) {
$this->get['to'] = isset($this->get['to']) ? intval($this->get['to']) : '';
if ($this->get['to']) {
$target = $this->db->fetch("SELECT user_name FROM {$this->pre}users WHERE user_id={$this->get['to']}");
if (!isset($target['user_name']) || $this->get['to'] == USER_GUEST_UID) {
return $this->message($this->lang->email_email, $this->lang->email_no_member);
}
$this->get['to'] = $target['user_name'];
}
return eval($this->template('EMAIL_MAIN'));
} else {
if (empty($this->post['to']) || empty($this->post['message']) || empty($this->post['subject'])) {
return $this->message($this->lang->email_email, $this->lang->email_no_fields);
}
$target = $this->db->fetch("SELECT user_id, user_email, user_email_form FROM {$this->pre}users WHERE user_name='{$this->post['to']}'");
if (!$target['user_email_form']) {
return $this->message($this->lang->email_email, $this->lang->email_blocked);
}
if (!isset($target['user_id']) || $target['user_id'] == USER_GUEST_UID) {
return $this->message($this->lang->email_email, $this->lang->email_no_member);
}
include './lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$mailer->setSubject("{$this->sets['forum_name']} - {$this->post['subject']}");
$mailer->setMessage("This mail has been sent by {$this->user['user_name']} via {$this->sets['forum_name']}\n\n" . stripslashes($this->post['message']));
$mailer->setRecipient($target['user_email']);
$mailer->setServer($this->sets['mailserver']);
$mailer->doSend();
return $this->message($this->lang->email_email, $this->lang->email_sent);
}
}
示例11: send_mail
function send_mail()
{
if (!isset($this->post['groups'])) {
$this->post['groups'] = array();
}
include '../lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$mailer->setSubject($this->post['subject']);
$message = stripslashes($this->post['message']) . "\n";
$message .= '___________________' . "\n";
$message .= $this->sets['forum_name'] . "\n";
$message .= $this->sets['loc_of_board'] . "\n";
$mailer->setMessage($message);
$mailer->setServer($this->sets['mailserver']);
$i = 0;
$members = $this->db->query("SELECT user_email FROM {$this->pre}users" . $this->group_query($this->post['groups']));
while ($sub = $this->db->nqfetch($members)) {
$mailer->setBcc($sub['user_email']);
$i++;
}
$mailer->doSend();
return $this->message('Mass Mail', 'Your message has been sent to ' . $i . ' members.');
}
示例12: sendAlert
/**
*
* @access public
* @param id
*
*/
public function sendAlert($id)
{
$mail = new mailer();
$user = new users();
// send alert email !
$row = $user->getUser($id);
$emailTo = $row['user'];
$to[] = $emailTo;
$subject = "Alert: Hours spent have exceeded planned hours";
$mail->setSubject($subject);
$text = "Hello " . $emailTo . ",\n\t\t\t\t\t\t\t\t\n\t\t\tThis is a friendly reminder that you have surpassed\n\t\t\t\t\t\t\t\t\n\t\t\tthe estimated hours for this project. While we \n\t\t\t\t\t\t\t\t\t\n\t\t\tunderstand it is impossible to meet every deadline\n\t\t\t\t\t\t\t\t\t\n\t\t\twe encourage you to be as diligent as possible with\n\t\t\t\t\t\t\t\t\t\n\t\t\tyour workload.";
$mail->setText($text);
$mail->sendMail($to);
}
示例13: xos_db_query
$sql_data_array['entry_zone_id'] = '0';
$sql_data_array['entry_state'] = $state;
}
}
if ($_POST['action'] == 'update') {
$check_query = xos_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int) $_GET['edit'] . "' and customers_id = '" . (int) $_SESSION['customer_id'] . "' limit 1");
if (xos_db_num_rows($check_query) == 1) {
xos_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "address_book_id = '" . (int) $_GET['edit'] . "' and customers_id ='" . (int) $_SESSION['customer_id'] . "'");
if (ACCOUNT_COMPANY == 'true' && xos_not_null($company_tax_id)) {
$sql_data_array2['customers_group_ra'] = '1';
xos_db_perform(TABLE_CUSTOMERS, $sql_data_array2, 'update', "customers_id ='" . (int) $_SESSION['customer_id'] . "'");
if (SEND_EMAILS == 'true') {
// if you would *not* like to have an email when a tax id number has been entered in
// the appropriate field, comment out this section. The alert in admin is raised anyway
$alert_email_text = sprintf(EMAIL_TEXT_TAX_ID_ADDED, $firstname, $lastname, $company);
$email_to_store_owner = new mailer(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT_TAX_ID_ADDED, '', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
if (!$email_to_store_owner->send()) {
$messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_store_owner->ErrorInfo));
}
}
}
// reregister session variables
if (isset($_POST['primary']) && $_POST['primary'] == 'on' || $_GET['edit'] == $_SESSION['customer_default_address_id']) {
if (ACCOUNT_GENDER == 'true') {
$_SESSION['customer_gender'] = $gender;
}
$_SESSION['customer_first_name'] = $firstname;
$_SESSION['customer_lastname'] = $lastname;
$_SESSION['customer_country_id'] = $country;
$_SESSION['customer_zone_id'] = $zone_id > 0 ? (int) $zone_id : '0';
$_SESSION['customer_default_address_id'] = (int) $_GET['edit'];
示例14: mailer
<?php
require_once "classes/config.php";
require_once "classes/payed.php";
require_once "classes/pay_place.php";
require_once "classes/commune.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wallet/walletAlpha.php';
require_once "classes/log.php";
//#0027582 аждую минуту обрабатывать запросы на размешение в карусели
pay_place::cronRequest();
// аждые пол часа обновл¤ем статус рассылок
if (date('i') == 30) {
require_once "classes/mailer.php";
$mailer = new mailer();
$mailer->updateStatusSending();
}
// ночные нестыковки во времени при переходе в следующий день #0021788
if (!in_array((int) date('Hi'), array(2358, 2359))) {
payed::UpdateProUsers();
}
//@todo: непон¤тно дл¤ чего?
//если юзер провисел 10 сек с момента публикации
//то помечаем его как просмотренный хот¤ его мог никто и неувидеть!
$pp = new pay_place();
$pp->getDoneShow(0);
$user_content = new user_content();
$user_content->releaseDelayedStreams();
$user_content->getQueueCounts();
$user_content->getStreamsQueueCounts();
示例15: before_parse
function before_parse()
{
if (empty($this->params['short'])) {
// вызвано не возле короткой формы логина, а в теле страницы
// процедура изменения пароля
if (!empty($_GET['k']) && isset($_POST['newpass']) && isset($_POST['accpass'])) {
$sql = 'sql:user?u_passre=\'' . $_GET['k'] . '\' $shrink=yes auto_query=no';
$res = $GLOBALS[CM]->run($sql);
if ($res) {
if (empty($_POST['newpass']) || $_POST['newpass'] != $_POST['accpass']) {
$this->pg = str_replace('<!--err:changepass-->', 'Пароли не совпадают', $this->pg);
return false;
// пусто или не совпадает
} else {
$GLOBALS[CM]->run($sql, 'update', array('u_passre' => '', 'u_pwd' => $_POST['newpass']));
$this->pg = $this->tpl['changed'];
return true;
// пароль изменен
}
}
}
} else {
// вызвано возле формы логина кнопкой "напомнить"
if (empty($_POST['passremail'])) {
$this->pg = str_replace('<!--err:passremail-->', '', $this->pg);
// если его не зачищать, то ява-скрипт отобразит блок, чтобы показать результат
} else {
// проверить наличие данного емыла в базе
$sql = 'sql:user?u_email=\'' . $_POST['passremail'] . '\' $shrink=yes auto_query=no';
$res = $GLOBALS[CM]->run($sql);
if (!$res) {
$this->pg = str_replace('<!--err:passremail-->', 'Пользователь с таким e-mail не найден.', $this->pg);
return false;
// емыл не найден
} elseif (!empty($res['u_lock']) && $res['u_lock'] != '') {
$this->pg = str_replace('<!--err:passremail-->', 'Пользователь заблокирован', $this->pg);
return false;
// акк заблокирован
}
// создать секретный код для беспарольного входа и отправить его на емыл юзера
if (empty($res['u_passre'])) {
$res['u_passre'] = substr(uniqid(mt_rand()), 0, 24);
$GLOBALS[CM]->run($sql, 'update', array('u_passre' => $res['u_passre']));
}
$ml = new mailer(array('tpl' => $this->params['email_tpl']));
$ml->send($res, $res['u_email']);
$this->pg = str_replace('<!--err:passremail-->', 'Письмо отправлено', $this->pg);
return true;
// пароль отправлен
}
}
$tmp = new iControl(array('pg' => $this->pg));
$tmp->get_maked();
$this->pg = $tmp->pg;
unset($tmp);
//parent::onValid();
}