本文整理汇总了PHP中PHPMailer::isQmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::isQmail方法的具体用法?PHP PHPMailer::isQmail怎么用?PHP PHPMailer::isQmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::isQmail方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: 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;
}
}
示例4: phpmailerAppException
$example_code .= "\n\$mail->Username = \"" . $_POST['authenticate_username'] . "\";";
$example_code .= "\n\$mail->Password = \"" . $_POST['authenticate_password'] . "\";";
}
break;
case 'mail':
$mail->isMail();
// telling the class to use PHP's mail()
$example_code .= "\n\$mail->isMail();";
break;
case 'sendmail':
$mail->isSendmail();
// telling the class to use Sendmail
$example_code .= "\n\$mail->isSendmail();";
break;
case 'qmail':
$mail->isQmail();
// telling the class to use Qmail
$example_code .= "\n\$mail->isQmail();";
break;
default:
throw new phpmailerAppException('Invalid test_type provided');
}
try {
if ($_POST['From_Name'] != '') {
$mail->addReplyTo($_POST['From_Email'], $_POST['From_Name']);
$mail->From = $_POST['From_Email'];
$mail->FromName = $_POST['From_Name'];
$example_code .= "\n\$mail->addReplyTo(\"" . $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");";
$example_code .= "\n\$mail->From = \"" . $_POST['From_Email'] . "\";";
$example_code .= "\n\$mail->FromName = \"" . $_POST['From_Name'] . "\";";
} else {
示例5: sendmail
function sendmail()
{
global $CHARSET, $system;
$this->errors = array();
// from has not been set send email via admin
if (!isset($this->from) || empty($this->from)) {
$this->from = $system->SETTINGS['adminmail'];
}
// if sending to admin, send to all linked admin emails
if ($system->SETTINGS['adminmail'] == $this->to) {
$emails = array_filter(explode(',', $system->SETTINGS['alert_emails']));
if (!empty($emails)) {
if (!is_array($this->to)) {
$to_start = $this->to;
$this->to = array();
$this->to[] = $to_start;
}
foreach ($emails as $email) {
if (strlen($email) > 0 && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
$this->to[] = $email;
}
}
}
}
// deal with sending the emails
switch ($system->SETTINGS['mail_protocol']) {
case '5':
$mail = new PHPMailer(true);
$mail->isQmail();
break;
case '4':
$mail = new PHPMailer(true);
$mail->isSendmail();
break;
case '3':
// do not send email
return 'No email sent. You have selected to disable all emails';
break;
case '2':
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = $system->SETTINGS['smtp_host'];
$mail->Port = (int) $system->SETTINGS['smtp_port'];
if ($system->SETTINGS['smtp_security'] != 'none') {
$mail->SMTPSecure = strtolower($system->SETTINGS['smtp_security']);
}
if ($system->SETTINGS['smtp_authentication'] == 'y') {
$mail->SMTPAuth = true;
$mail->Username = $system->SETTINGS['smtp_username'];
$mail->Password = $system->SETTINGS['smtp_password'];
} else {
$mail->SMTPAuth = false;
}
break;
case '1':
$mail = new PHPMailer(true);
$mail->isMail();
break;
default:
// just use php mail function
if (is_array($this->to)) {
for ($i = 0; $i < count($this->to); $i++) {
if (!empty($system->SETTINGS['mail_parameter'])) {
$sent = mail($this->to[$i], $this->subject, $this->message, $this->headers, $system->SETTINGS['mail_parameter']);
} else {
$sent = mail($this->to[$i], $this->subject, $this->message, $this->headers);
}
}
} else {
if (!empty($system->SETTINGS['mail_parameter'])) {
$sent = mail($this->to, $this->subject, $this->message, $this->headers, $system->SETTINGS['mail_parameter']);
} else {
$sent = mail($this->to, $this->subject, $this->message, $this->headers);
}
}
if ($sent) {
return false;
} else {
return true;
}
break;
}
if (is_array($this->to)) {
for ($i = 0; $i < count($this->to); $i++) {
try {
$mail->setFrom($this->from, $system->SETTINGS['adminmail']);
$mail->addAddress($this->to[$i]);
$mail->addReplyTo($this->from, $system->SETTINGS['adminmail']);
$mail->Subject = $this->subject;
$mail->msgHTML($this->message);
//$mail->addAttachment('images/phpmailer_mini.png');
$mail->CharSet = $CHARSET;
$mail->Send();
} catch (phpmailerException $e) {
trigger_error('---->PHPMailer error: ' . $e->errorMessage());
$this->add_error($e->errorMessage());
} catch (Exception $e) {
trigger_error('---->PHPMailer error2: ' . $e->getMessage());
//.........这里部分代码省略.........
示例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', __FILE__));
}
if ($_options['message'] == '' && $_options['title'] == '') {
throw new Exception(__('[Mail] Le message et le sujet ne peuvent être vide', __FILE__));
return false;
}
if ($_options['title'] == '') {
$_options['title'] = __('[Jeedom] - Notification', __FILE__);
}
$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');
if ($eqLogic->getConfiguration('smtp::security', '') != '' && $eqLogic->getConfiguration('smtp::security', '') != 'none') {
$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
}
if ($eqLogic->getConfiguration('smtp::dontcheckssl', 0) == 1) {
$mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
}
break;
case 'mail':
$mail->isMail();
break;
case 'sendmail':
$mail->isSendmail();
break;
case 'qmail':
$mail->isQmail();
break;
default:
throw new Exception(__('Mode d\'envoi non reconnu', __FILE__));
}
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->isHTML(true);
$mail->AddAddress($this->getConfiguration('recipient'));
$mail->Subject = $_options['title'];
$mail->Body = nl2br($_options['message']);
$mail->AltBody = nl2br($_options['message']);
if (isset($_options['files']) && is_array($_options['files'])) {
foreach ($_options['files'] as $file) {
$mail->AddAttachment($file);
}
}
return $mail->send();
}
示例7: function
<?php
/**
* @return PHPMailer
*/
return function () {
$mailer = new \PHPMailer();
if (isset(\ZigiPhp\App::getConfig('mail')['type'])) {
switch (\ZigiPhp\App::getConfig('mail')['type']) {
case 'sendmail':
$mailer->isSendmail();
break;
case 'qmail':
$mailer->isQmail();
break;
case 'smtp':
$mailer->isSMTP();
if (isset(\ZigiPhp\App::getConfig('mail')['options'])) {
foreach (\ZigiPhp\App::getConfig('mail')['options'] as $option => $value) {
$mailer->{$option} = $value;
}
}
break;
}
}
return $mailer;
};
示例8: 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, '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');
}