本文整理汇总了PHP中PHPMailer::isSendmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::isSendmail方法的具体用法?PHP PHPMailer::isSendmail怎么用?PHP PHPMailer::isSendmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::isSendmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->_mailer = new \PHPMailer();
switch ($this->method) {
case 'smtp':
$this->_mailer->isSMTP();
$this->_mailer->Host = $this->smtp['host'];
if (!empty($this->smtp['username'])) {
$this->_mailer->SMTPAuth = true;
$this->_mailer->Username = $this->smtp['username'];
$this->_mailer->Password = $this->smtp['password'];
} else {
$this->_mailer->SMTPAuth = false;
}
if (isset($this->smtp['port'])) {
$this->_mailer->Port = $this->smtp['port'];
}
if (isset($this->smtp['secure'])) {
$this->_mailer->SMTPSecure = $this->smtp['secure'];
}
if (isset($this->smtp['debug'])) {
$this->_mailer->SMTPDebug = (int) $this->smtp['debug'];
}
break;
case 'sendmail':
$this->_mailer->isSendmail();
break;
default:
$this->_mailer->isMail();
}
$this->_mailer->CharSet = \Yii::app()->charset;
parent::init();
}
示例2: createMailer
/**
* Create the PHPMailer instance
*
* @return PHPMailer
*/
private function createMailer()
{
$this->mailer = new PHPMailer(true);
if ($this->attributes['smtp']) {
$this->smtp();
} elseif (array_get($this->attributes, 'sendmail')) {
$this->mailer->isSendmail();
} else {
$this->mailer->isMail();
}
return $this->mailer;
}
示例3: sendEmail
function sendEmail($expediteur, $destinataires, $messageHTML, $objet = "", $attachmentEmail = "")
{
global $thisSite;
global $pathRacine;
if ($expediteur == "") {
return 0;
}
if ($destinataires == "") {
return 0;
}
if (!is_array($destinataires)) {
$destinataires = array($destinataires);
}
require_once $pathRacine . $thisSite->DOS_BASE_LIB . 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
if ($thisSite->MAIL_SENDMODE == "smtp") {
$mail->isSMTP();
//$mail->SMTPDebug = 2;
//$mail->Debugoutput = 'html';
$mail->Host = $thisSite->MAIL_HOST;
//Set the hostname of the mail server
$mail->Port = $thisSite->MAIL_PORT;
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->SMTPAuth = $thisSite->SMTPAuth;
//Whether to use SMTP authentication
$mail->Username = $thisSite->MAIL_Username;
//Username to use for SMTP authentication
$mail->Password = $thisSite->MAIL_Password;
//Password to use for SMTP authentication
} else {
if ($thisSite->MAIL_SENDMODE == "mail") {
$mail->isMail();
} else {
if ($thisSite->MAIL_SENDMODE == "sendmail") {
$mail->isSendmail();
}
}
}
$mail->From = $thisSite->MAIL_SENDER;
$mail->addReplyTo($expediteur, $expediteur);
$mail->From = $expediteur;
$mail->FromName = '';
foreach ($destinataires as $destinataire) {
$mail->addAddress($destinataire);
}
$mail->isHTML(true);
$mail->Subject = utf8_decode($objet);
$mail->Body = utf8_decode($messageHTML);
if (is_array($attachmentEmail)) {
foreach ($attachmentEmail as $fichier) {
$rr = $mail->addAttachment($fichier);
}
}
if (!$mail->send()) {
$res = $mail->ErrorInfo;
} else {
$res = true;
}
return $res;
}
示例4: onLoad
public function onLoad($param)
{
parent::onLoad($param);
$checkNewsletter = nNewsletterRecord::finder()->findByStatus(1);
if ($checkNewsletter) {
$layout = nLayoutRecord::finder()->findBy_nNewsletterID($checkNewsletter->ID);
$mail = new PHPMailer();
$mail->isSendmail();
$mail->setFrom('from@vp.d2.pl', 'First Last');
$mail->addReplyTo('from@vp.d2.pl');
$lista = nSenderRecord::finder()->findAll('nLayoutID = ? AND Status = 0 LIMIT 25', $layout->ID);
foreach ($lista as $person) {
$mail->addAddress($person->Email);
$mail->Subject = $checkNewsletter->Name;
$mail->msgHTML($layout->HtmlText);
if ($mail->send()) {
$person->Status = 1;
$person->save();
} else {
$person->Status = 5;
$person->save();
echo "Mailer Error: " . $mail->ErrorInfo;
}
}
if (empty($lista)) {
$checkNewsletter->Status = 0;
$checkNewsletter->save();
}
}
die;
}
示例5: sendEmail
function sendEmail($userEmail, $userFName, $userLName, $date, $price)
{
$mail = new PHPMailer();
$mail->isSendmail();
$mail->setFrom('efraimmkrug@gmail.com', 'Help Desk');
$mail->addReplyTo('efraimmkrug@gmail.com', 'Efraim Krug');
$mail->addAddress($userEmail, 'User Krug');
$message = "<html><body style=\"font:14px Arial,Helvetica,sans-serif; color:#000; background:#fff\">";
$message .= "\n<p>Dear " . $userFName . " " . $userLName . "</p>";
$message .= "\n<p>Please do not reply to this message, as it was sent from an unattended mail box.</p>";
$message .= "\n<p>This is an automated invoice for the Caneur!</p>";
$message .= "\n<p>For service rendered on " . $date . "</p>";
$message .= "\n<p>For the amount of " . number_format($price, 2) . "</p>";
$message .= "\n<p>Thank you so much for your patronage!</p>";
$message .= "\n<p>Best to you and your family!</p>";
$message .= "\n<p>Your local Caneur!</p>";
$message .= "</body></html>";
$mail->Subject = 'Caneur invoice - ' . $date;
$mail->msgHTML($message);
#$mail->addAttachment($FileName);
#if (!$mail->send()) {
# echo "Mailer Error: " . $mail->ErrorInfo;
#} else {
# echo "Message sent!";
#}
return;
}
示例6: execute
public function execute($_options = null)
{
$eqLogic = $this->getEqLogic();
if ($_options === null) {
throw new Exception('[Mail] Les options de la fonction ne peuvent etre null');
}
if ($_options['message'] == '' && $_options['title'] == '') {
throw new Exception('[Mail] Le message et le sujet ne peuvent être vide');
return false;
}
if ($_options['title'] == '') {
$_options['title'] = '[Jeedom] - Notification';
}
$mail = new PHPMailer(true);
//PHPMailer instance with exceptions enabled
$mail->CharSet = 'utf-8';
$mail->SMTPDebug = 0;
switch ($eqLogic->getConfiguration('sendMode', 'mail')) {
case 'smtp':
$mail->isSMTP();
$mail->Host = $eqLogic->getConfiguration('smtp::server');
$mail->Port = (int) $eqLogic->getConfiguration('smtp::port');
$mail->SMTPSecure = $eqLogic->getConfiguration('smtp::security');
if ($eqLogic->getConfiguration('smtp::username') != '') {
$mail->SMTPAuth = true;
$mail->Username = $eqLogic->getConfiguration('smtp::username');
// SMTP account username
$mail->Password = $eqLogic->getConfiguration('smtp::password');
// SMTP account password
}
break;
case 'mail':
$mail->isMail();
break;
case 'sendmail':
$mail->isSendmail();
case 'qmail':
$mail->isQmail();
break;
default:
throw new Exception('Mode d\'envoi non reconnu');
}
if ($eqLogic->getConfiguration('fromName') != '') {
$mail->addReplyTo($eqLogic->getConfiguration('fromMail'), $eqLogic->getConfiguration('fromName'));
$mail->FromName = $eqLogic->getConfiguration('fromName');
} else {
$mail->addReplyTo($eqLogic->getConfiguration('fromMail'));
$mail->FromName = $eqLogic->getConfiguration('fromMail');
}
$mail->From = $eqLogic->getConfiguration('fromMail');
$mail->addAddress($this->getConfiguration('recipient'));
$mail->Subject = $_options['title'];
$mail->msgHTML(htmlentities($_options['message']), dirname(__FILE__), true);
return $mail->send();
}
示例7: sendEmail
function sendEmail($data)
{
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->isSendmail();
$mail->setFrom('noreply@shop.ru', $data['name']);
$mail->addAddress('gretta28@yandex.ru', "Ирине Тишкевич");
$mail->Subject = "Отправка письма с shop.ru";
$mail->msgHTML('Заказан звонок от: ' . $data['name'] . '. Дата: ' . $data['day'] . '.' . $data['month'] . '. Телефон: ' . $data['phone'] . '. Комментарий: ' . $data['message']);
return $mail->send();
}
示例8: sendVerificationMail
/**
* @param User $user
*
* @throws \phpmailerException
*/
protected function sendVerificationMail($user)
{
$mail = new \PHPMailer();
$mail->isSendmail();
$mail->setFrom('noreply@blog.com', 'Sample Blog News');
$mail->addAddress($user->email, $user->email);
$mail->Subject = 'Confirm your Sample Blog News account';
$body = "You need to confirm your email address " . $user->email . " in order to activate your Sample Blog News\n account. <br/> Activating your account will give you more benefits and better control.<br />\n Please click the link below to confirm your account <br />\n http://" . $this->getRequest()->getUri()->getHost() . "/account/confirm/" . $user->token;
$mail->msgHTML($body);
$mail->send();
}
示例9: testMiscellaneous
/**
* Miscellaneous calls to improve test coverage and some small tests.
*/
public function testMiscellaneous()
{
$this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
$this->Mail->addCustomHeader('SomeHeader: Some Value');
$this->Mail->clearCustomHeaders();
$this->Mail->clearAttachments();
$this->Mail->isHTML(false);
$this->Mail->isSMTP();
$this->Mail->isMail();
$this->Mail->isSendmail();
$this->Mail->isQmail();
$this->Mail->setLanguage('fr');
$this->Mail->Sender = '';
$this->Mail->createHeader();
$this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
$this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
$this->assertTrue($this->Mail->set('AllowEmpty', null), 'Null property set failed');
$this->assertTrue($this->Mail->set('AllowEmpty', false), 'Valid property set of null property failed');
//Test pathinfo
$a = '/mnt/files/飛兒樂 團光茫.mp3';
$q = PHPMailer::mb_pathinfo($a);
$this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
$this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
$this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
$this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
$this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
$this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_BASENAME), '飛兒樂 團光茫.mp3', 'Basename path element not matched');
$this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
$a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
$q = PHPMailer::mb_pathinfo($a);
$this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
$this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
$this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
$this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
$this->assertEquals(PHPMailer::filenameToType('abc.jpg?xyz=1'), 'image/jpeg', 'Query string not ignored in filename');
$this->assertEquals(PHPMailer::filenameToType('abc.xyzpdq'), 'application/octet-stream', 'Default MIME type not applied to unknown extension');
//Line break normalization
$eol = $this->Mail->LE;
$b1 = "1\r2\r3\r";
$b2 = "1\n2\n3\n";
$b3 = "1\r\n2\r3\n";
$this->Mail->LE = "\n";
$t1 = "1{$this->Mail->LE}2{$this->Mail->LE}3{$this->Mail->LE}";
$this->assertEquals($this->Mail->fixEOL($b1), $t1, 'Failed to normalize line breaks (1)');
$this->assertEquals($this->Mail->fixEOL($b2), $t1, 'Failed to normalize line breaks (2)');
$this->assertEquals($this->Mail->fixEOL($b3), $t1, 'Failed to normalize line breaks (3)');
$this->Mail->LE = "\r\n";
$t1 = "1{$this->Mail->LE}2{$this->Mail->LE}3{$this->Mail->LE}";
$this->assertEquals($this->Mail->fixEOL($b1), $t1, 'Failed to normalize line breaks (4)');
$this->assertEquals($this->Mail->fixEOL($b2), $t1, 'Failed to normalize line breaks (5)');
$this->assertEquals($this->Mail->fixEOL($b3), $t1, 'Failed to normalize line breaks (6)');
$this->Mail->LE = $eol;
}
示例10: actionCronbalance
public function actionCronbalance()
{
echo "Running Script...<br>";
// Yii::app()->db->createCommand($sql)->queryAll();
// Get all of the current asset accounts
$sql = "SELECT Account.code AS accountcode, Account.name AS accountname, Account.email AS email, Account.balance_threshold AS threshold, Account.days AS days, e1.amount AS balance\n\t\t\t\tFROM Account\n\t\t\t\tJOIN (\n\t\t\t\tselect accountId, TRIM( TRAILING 0 FROM ROUND( SUM( amount ) , 5 ) ) AS 'amount'\n\t\t\t\tFROM TransRow\n\t\t\t\tjoin Account on Account.id=accountId\n\t\t\t\tWHERE accountId = Account.id\n\t\t\t\tgroup by accountId) e1 ON e1.accountId = Account.id\n\t\t\t\tWHERE (Account.code BETWEEN '101000' AND '102999')\n\t\t\t\tORDER BY Account.code";
// OR (Account.companyId = ".Yii::app()->user->getState('selectedCompanyId')."))
$accounts = Yii::app()->db->createCommand($sql)->queryAll();
Yii::import('application.controllers.mailer.*');
require_once "PHPMailerAutoload.php";
foreach ($accounts as $account) {
if (!empty($account['email'])) {
// echo "Account Code: ".$account['accountcode']."<br>";
// echo "Account Name: ".$account['accountname']."<br>";
$threshold = empty($account['threshold']) ? 0 : intval($account['threshold']);
$days = empty($account['days']) ? 90 : intval($account['days']);
$balance = empty($account['balance']) ? 0 : intval($account['balance']);
// echo "Threshold is: ".$threshold."<br>";
// echo "Balance is: ".$balance."<br>";
// Continue with checking balance
if ($balance < $threshold) {
// echo "Notifying email...<br>";
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->isSendmail();
$mail->isHTML(true);
$message = '<!DOCTYPE HTML>' . '<head>' . '<meta http-equiv="content-type" content="text/html; charset=utf-8">' . '<title>FCF Accounting Email notification</title>' . '</head>';
// // Notify all emails attatched to account
$email_arr = explode(",", $account['email']);
foreach ($email_arr as $email) {
$email = trim($email);
// echo 'Users email: '.$email.'<br>';
$mail->addAddress($email);
}
$mail->setFrom('no-reply@thaiconnections.org', 'FCF Accounting');
$message .= '<body>' . '<p>Hello,</p><br>' . '<p>This a automated notification from accounting at thaiconnections stating that the balance for Account: <strong>' . $account['accountname'] . ' </strong>has gone lower than the given threshold.<p>' . '<p>The current balance is:<strong> ' . $balance . ' Baht</strong><p><br>' . '<p>Kindest Regards,<br>' . 'FCF Accounting</p>' . '</body>';
$mail->Subject = 'Balance Threshold Breached';
$mail->Body = preg_replace('/\\[\\]/', '', $message);
$mail->AltBody = 'Hi, this a automated notification from accounting at thaiconnections stating that the balance for Account: ' . $account['accountname'] . ' has gone lower than the given threshold. The current balance is: ' . $balance . ' Kindest Regards, Thaiconnections Accounting';
if (!$mail->send()) {
// $this->log('Could not send mail. Please check servers email configurations', 'adminLog');
// echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
// echo 'Mail sent successfully';
}
}
}
}
echo "Script has finished....<br>";
/* echo "<pre>";
//var_dump($accounts);
echo "</pre>";*/
}
示例11: send
public static function send($to, $subject, $params = array(), $vars = array())
{
global $LANG;
if (empty($params['template'])) {
if (empty($params['message'])) {
return false;
} else {
$text = $params['message'];
}
} else {
if (!file_exists((isset($params['path']) ? $params['path'] : '') . TMAIL_LOCATION . '/' . $params['template'] . '.html')) {
return false;
}
$text = file_get_contents((isset($params['path']) ? $params['path'] : '') . TMAIL_LOCATION . '/' . $params['template'] . '.html');
extract($vars);
eval("\$text = \"{$text}\";");
}
include (isset($params['path']) ? $params['path'] : '') . LBDIR . '/PHPMailer/class.phpmailer.php';
$mail = new \PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->AddReplyTo(isset($params['reply_to']) ? $params['reply_to'] : \query\main::get_option('email_answer_to'), isset($params['reply_name']) ? $params['reply_name'] : '');
$mail->From = isset($params['from_name']) ? $params['from_name'] : \query\main::get_option('email_answer_to');
$mail->FromName = isset($params['from_email']) ? $params['from_email'] : \query\main::get_option('email_from_name');
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->MsgHTML($text);
$mail->IsHTML(true);
switch (\query\main::get_option('mail_method')) {
case 'SMTP':
$mail->IsSMTP();
// tell the class to use SMTP
$mail->SMTPAuth = \query\main::get_option('smtp_auth');
$mail->Port = \query\main::get_option('smtp_port');
$mail->Host = \query\main::get_option('smtp_host');
$mail->Username = \query\main::get_option('smtp_user');
$mail->Password = \query\main::get_option('smtp_password');
break;
case 'sendmail':
$mail->isSendmail();
$mail->Sendmail = \query\main::get_option('sendmail_path');
break;
default:
$mail->isMail();
break;
}
if ($mail->Send()) {
return true;
} else {
return false;
}
}
示例12: protocol
/**
* ### Sets the protcol to be used by PHPMailer
*
* @param string $protocol
*/
private function protocol($protocol)
{
switch ($protocol) {
case 'smtp':
if (Config::get('mail', 'username')) {
$this->mailer->SMTPAuth = true;
} else {
$this->mailer->SMTPAuth = false;
}
$this->mailer->isSMTP();
break;
case 'php':
$this->mailer->isSendmail();
break;
default:
if (Config::get('mail', 'username')) {
$this->mailer->SMTPAuth = true;
} else {
$this->mailer->SMTPAuth = false;
}
$this->mailer->isSMTP();
}
}
示例13: send_message_to_email
function send_message_to_email($dataMail)
{
$mail = new PHPMailer();
$mail->isSendmail();
$mailer->CharSet = 'UTF-8';
// Указываем отправителя письма
$mail->setFrom('d.pushkarskaya.pr@gmail.com', 'Пушкарской Дарьи');
// Указываем получателя письма
$mail->addAddress('d.pushkarskaya.pr@gmail.com', "Пушкарской Дарье");
// Указываем тему письма
$mail->Subject = "Отправка письма с вебинара";
// Устанавливаем текст сообщения
$mail->msgHTML("Тестовое письмо c моего сайта-портфолио: " . $dataMail['message'] . ' ' . $dataMail['name'] . ': ' . $dataMail['email']);
return $mail->send();
}
示例14: excute
public function excute()
{
$mail = new PHPMailer();
$mail->isSendmail();
$mail->setFrom("dev@51shebao.com", '邮件测试');
$mail->addAddress("zhaojian@51shebao.com");
$mail->Subject = "发个测试邮件";
$mail->msgHTML("Test");
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
exit;
}
示例15: chose_sender_strategy
protected function chose_sender_strategy()
{
switch ($this->method) {
case Mailer::MAIL:
$this->php_mailer->isMail();
break;
case Mailer::QMAIL:
$this->php_mailer->isQmail();
break;
case Mailer::SEND_MAIL:
$this->php_mailer->isSendmail();
break;
default:
$this->php_mailer->isSMTP();
$this->method = Mailer::SMTP;
}
}