本文整理汇总了PHP中PHPMailer::isMail方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::isMail方法的具体用法?PHP PHPMailer::isMail怎么用?PHP PHPMailer::isMail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::isMail方法的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: postSaveadd
public function postSaveadd()
{
$cre = ['name' => Input::get('name'), 'email' => Input::get('email'), 'enquiry' => Input::get('enquiry'), 'message' => Input::get('message')];
$rules = ['name' => 'required', 'email' => 'required|email', 'enquiry' => 'required|not_in:0', 'message' => 'required'];
$validator = Validator::make($cre, $rules);
if ($validator->passes()) {
require app_path() . '/mail.php';
require app_path() . '/libraries/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail_text = new Mail();
$mail->isMail();
$mail->setFrom('info@corperlife.com', 'Corper Life');
$mail->addAddress('questions@corperlife.com');
$mail->addAddress('vishu.iitd@gmail.com');
$mail->isHTML(true);
$mail->Subject = "Advertisement Request | Corper Life";
$mail->Body = $mail_text->advert(Input::get("name"), Input::get("email"), Input::get("enquiry"), Input::get("phone"), Input::get("message"));
if (!$mail->send()) {
return Redirect::Back()->with('failure', 'Mailer Error: ' . $mail->ErrorInfo);
} else {
return Redirect::Back()->with('success', 'Your enquiry has been submitted. We will respond to it asap.');
}
} else {
return Redirect::Back()->withErrors($validator)->withInput();
}
}
示例4: init
static function init(&$doorGets)
{
$mail = null;
if (!is_object($doorGets) || !is_array($doorGets->configWeb)) {
return 'PHPMailerService: doorGets object not found';
}
$config = $doorGets->configWeb;
$mail = new PHPMailer(true);
$mail->CharSet = 'UTF-8';
if ($config['smtp_mandrill_active']) {
$mail->isSMTP();
$mail->Host = $config['smtp_mandrill_host'];
$mail->SMTPAuth = true;
$mail->Username = $config['smtp_mandrill_username'];
$mail->Password = $config['smtp_mandrill_password'];
$mail->SMTPSecure = 'tls';
if ($config['smtp_mandrill_ssl']) {
$mail->SMTPSecure = 'ssl';
}
$mail->Port = (int) $config['smtp_mandrill_port'];
} else {
$mail->isMail();
}
$serverHost = $_SERVER['HTTP_HOST'];
$mail->FromName = str_replace('www.', '', $serverHost);
$serverName = $_SERVER['SERVER_NAME'];
if ($serverName === '~^(?<vhost>.*)\\.doorgets\\.io$') {
$serverName = 'doorgets.io';
} else {
$serverName = str_replace('www.', '', $serverName);
}
$mail->From = 'no-reply@' . $serverName;
return $mail;
}
示例5: 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;
}
示例6: getMailer
public function getMailer()
{
$mail = new PHPMailer(true);
if ($this->config['isSMTP']) {
$mail->SMTPDebug = $this->config['SMTPDebug'];
// Enable verbose debug output
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = $this->config['Host'];
// Specify main and backup SMTP servers
$mail->SMTPAuth = $this->config['SMTPAuth'];
// Enable SMTP authentication
$mail->Username = $this->config['Username'];
// SMTP username
$mail->Password = $this->config['Password'];
// SMTP password
if (isset($this->config['SMTPSecure'])) {
$mail->SMTPSecure = $this->config['SMTPSecure'];
// Enable TLS encryption, `ssl` also accepted
}
$mail->Port = $this->config['Port'];
// TCP port to connect to
$mail->From = $this->config['From'];
$mail->FromName = $this->config['FromName'];
} else {
$mail->From = $this->config['From'];
$mail->FromName = $this->config['FromName'];
$mail->isMail();
}
return $mail;
}
示例7: initMailer
/**
* creates a new phpmailer object
*/
protected function initMailer()
{
$mail = new PHPMailer();
$mail->isMail();
if ($this->charset) {
$mail->CharSet = $this->charset;
}
return $mail;
}
示例8: 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();
}
示例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: 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;
}
}
示例11: send
private function send()
{
$mail = new PHPMailer();
if (!empty($this->config->mailer)) {
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = $this->config->mailer->Host;
// Specify main and backup SMTP servers
$mail->SMTPAuth = $this->config->mailer->SMTPAuth;
// Enable SMTP authentication
$mail->Username = $this->config->mailer->Username;
// SMTP username
$mail->Password = $this->config->mailer->Password;
// SMTP password
if (isset($this->config->mailer->SMTPSecure)) {
$mail->SMTPSecure = $this->config->mailer->SMTPSecure;
// Enable TLS encryption, `ssl` also accepted
}
$mail->Port = $this->config->mailer->Port;
// TCP port to connect to
$mail->From = $this->config->mailer->From;
$mail->FromName = $this->config->mailer->FromName;
} else {
$mail->From = $this->from;
$mail->FromName = $this->config->site->titulo;
$mail->isMail();
}
if (!empty($this->replyTo)) {
$mail->addReplyTo($this->replyTo);
}
$mail->addAddress($this->to);
// Add a recipient
$mail->addReplyTo($this->to);
$mail->CharSet = 'UTF-8';
$mail->isHTML(true);
// Set email format to HTML
$mail->Subject = $this->subject;
$mail->Body = $this->message;
if (!$mail->send()) {
if (true == $this->config->debug) {
die('Mailer Error: ' . $mail->ErrorInfo);
}
return false;
} else {
return true;
}
}
示例12: switch
/**
* Constructor.
*/
function __construct()
{
require_once PHPMAILER_CLASS;
require_once PHPMAILER_SMTP;
require_once PHPMAILER_POP3;
// Inicializa la instancia PHPMailer.
$mail = new \PHPMailer();
// Define el idioma para los mensajes de error.
$mail->SetLanguage("es", PHPMAILER_LANGS);
// Define la codificación de caracteres del mensaje.
$mail->CharSet = "UTF-8";
// Define el ajuste de texto a un número determinado de caracteres en el cuerpo del mensaje.
$mail->WordWrap = 50;
// Define el tipo de gestor de correo
switch (GOTEO_MAIL_TYPE) {
default:
case "mail":
$mail->isMail();
// set mailer to use PHP mail() function.
break;
case "sendmail":
$mail->IsSendmail();
// set mailer to use $Sendmail program.
break;
case "qmail":
$mail->IsQmail();
// set mailer to use qmail MTA.
break;
case "smtp":
$mail->IsSMTP();
// set mailer to use SMTP
$mail->SMTPAuth = GOTEO_MAIL_SMTP_AUTH;
// enable SMTP authentication
$mail->SMTPSecure = GOTEO_MAIL_SMTP_SECURE;
// sets the prefix to the servier
$mail->Host = GOTEO_MAIL_SMTP_HOST;
// specify main and backup server
$mail->Port = GOTEO_MAIL_SMTP_PORT;
// set the SMTP port
$mail->Username = GOTEO_MAIL_SMTP_USERNAME;
// SMTP username
$mail->Password = GOTEO_MAIL_SMTP_PASSWORD;
// SMTP password
break;
}
$this->mail = $mail;
}
示例13: 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;
}
}
示例14: mailWrapper
public static function mailWrapper($to, $subject = '(No subject)', $message = '', $aImagesToEmbed = [], $aFilesToAttach = [])
{
$mail = new \PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->isMail();
if (HelperConfig::$core['mail_method'] == 'sendmail') {
$mail->isSendmail();
} elseif (HelperConfig::$core['mail_method'] == 'smtp') {
$mail->isSMTP();
$mail->Host = HelperConfig::$secrets['mail_smtp_server'];
$mail->Port = HelperConfig::$secrets['mail_smtp_port'];
if (HelperConfig::$secrets['mail_smtp_auth'] == true) {
$mail->SMTPAuth = true;
$mail->Username = HelperConfig::$secrets['mail_smtp_auth_user'];
$mail->Password = HelperConfig::$secrets['mail_smtp_auth_pwd'];
if (HelperConfig::$secrets['mail_smtp_secure']) {
$mail->SMTPSecure = 'tls';
if (HelperConfig::$secrets['mail_smtp_secure_method'] == 'ssl') {
$mail->SMTPSecure = 'ssl';
}
}
}
}
$mail->From = HelperConfig::$core["email_sender"];
$mail->FromName = HelperConfig::$core["email_sendername"];
$mail->addAddress($to);
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if (is_array($aImagesToEmbed) && count($aImagesToEmbed)) {
foreach ($aImagesToEmbed as $sKey => $imgdata) {
$imginfo = getimagesizefromstring($imgdata['binimg']);
$mail->addStringEmbeddedImage($imgdata['binimg'], $sKey, $sKey, 'base64', $imginfo['mime']);
}
}
if (is_array($aFilesToAttach) && count($aFilesToAttach)) {
foreach ($aFilesToAttach as $sValue) {
if (file_exists($sValue)) {
$mail->addAttachment($sValue);
}
}
}
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
return $mail->send();
}
示例15: send
/**
* Send message
*
* @param string $subject Subject
* @param array $from From
* @param array $to To
* @param string $body Body
* @param string $attachment Attachment Path
*
* @return void
*/
public function send($subject, array $from, array $to, $body, $attachment = '')
{
$phpMailer = new \PHPMailer();
$phpMailer->isHTML();
$phpMailer->isMail();
$phpMailer->Priority = 1;
$phpMailer->UseSendmailOptions = false;
$phpMailer->setFrom($from['email'], $from['name']);
$phpMailer->addReplyTo($from['email'], $from['name']);
foreach ($to as $toItem) {
$phpMailer->AddAddress($toItem['email'], $toItem['name']);
}
$phpMailer->Subject = $subject;
$phpMailer->msgHTML($body);
if ($attachment) {
$phpMailer->addAttachment($attachment);
}
$phpMailer->send();
}