当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPMailer::IsMail方法代码示例

本文整理汇总了PHP中PHPMailer::IsMail方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::IsMail方法的具体用法?PHP PHPMailer::IsMail怎么用?PHP PHPMailer::IsMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPMailer的用法示例。


在下文中一共展示了PHPMailer::IsMail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMailObject

 private static function getMailObject()
 {
     require_once 'includes/libs/phpmailer/class.phpmailer.php';
     $mail = new PHPMailer(true);
     $mail->PluginDir = 'includes/libs/phpmailer/';
     $config = Config::get();
     if ($config->mail_use == 2) {
         $mail->IsSMTP();
         $mail->SMTPSecure = $config->smtp_ssl;
         $mail->Host = $config->smtp_host;
         $mail->Port = $config->smtp_port;
         if ($config->smtp_user != '') {
             $mail->SMTPAuth = true;
             $mail->Username = $config->smtp_user;
             $mail->Password = $config->smtp_pass;
         }
     } elseif ($config->mail_use == 0) {
         $mail->IsMail();
     } else {
         throw new Exception("sendmail is deprecated, use SMTP instead!");
     }
     $mailFromAddress = $config->smtp_sendmail;
     $mailFromName = $config->game_name;
     $mail->CharSet = 'UTF-8';
     $mail->SetFrom($mailFromAddress, $mailFromName);
     return $mail;
 }
开发者ID:tatarysh,项目名称:2Moons,代码行数:27,代码来源:Mail.class.php

示例2: sendEmail

function sendEmail($senderName, $senderEmail, $name, $email, $subject, $message)
{
    include_once ROOT . "/library/contrib/phpmailer/class.phpmailer.php";
    $mail = new PHPMailer();
    $mail->SetLanguage('en', ROOT . "/library/contrib/phpmailer/language/");
    $mail->IsHTML(true);
    $mail->CharSet = 'utf-8';
    $mail->From = $senderEmail;
    $mail->FromName = $senderName;
    $mail->Subject = $subject;
    $mail->Body = $message;
    $mail->AltBody = 'To view this email message, open the email with html enabled mailer.';
    $mail->AddAddress($email, $name);
    if (!Setting::getServiceSettingGlobal('useCustomSMTP', 0)) {
        $mail->IsMail();
    } else {
        $mail->IsSMTP();
        $mail->Host = Setting::getServiceSettingGlobal('smtpHost', '127.0.0.1');
        $mail->Port = Setting::getServiceSettingGlobal('smtpPort', 25);
    }
    ob_start();
    $ret = $mail->Send();
    ob_clean();
    if (!$ret) {
        return array(false, $mail->ErrorInfo);
    }
    return true;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:28,代码来源:mail.php

示例3: send

 public function send()
 {
     $mail = new PHPMailer();
     foreach ($this->to as $to) {
         $mail->AddAddress($to);
     }
     $mail->IsMail();
     $mail->Subject = $this->subject;
     $mail->From = MAIL_REPLY_TO;
     $mail->FromName = $this->fromName ?: MAIL_FROM_NAME;
     $mail->Sender = MAIL_REPLY_TO;
     if ($this->replyTo) {
         $mail->AddReplyTo($this->replyTo);
     }
     $mail->Body = $this->body;
     if (substr(trim($this->body), 0, 1) == '<') {
         $mail->IsHTML(true);
         if (isset($this->plain_body)) {
             $mail->AltBody = html_entity_decode($this->plain_body);
         }
     } else {
         $mail->Body = html_entity_decode($this->body);
         $mail->IsHTML(false);
     }
     if (IS_PRODUCTION) {
         return $mail->Send();
     } else {
         \jmvc::log(print_r($mail, true), 'mail');
     }
 }
开发者ID:jonthornton,项目名称:JMVC,代码行数:30,代码来源:mail.php

示例4: Send

 /**
  * @todo add port settings
  */
 public function Send($EventName = '')
 {
     if (Gdn::Config('Garden.Email.UseSmtp')) {
         $this->PhpMailer->IsSMTP();
         $SmtpHost = Gdn::Config('Garden.Email.SmtpHost', '');
         $SmtpPort = Gdn::Config('Garden.Email.SmtpPort', 25);
         if (strpos($SmtpHost, ':') !== FALSE) {
             list($SmtpHost, $SmtpPort) = explode(':', $SmtpHost);
         }
         $this->PhpMailer->Host = $SmtpHost;
         $this->PhpMailer->Port = $SmtpPort;
         $this->PhpMailer->Username = $Username = Gdn::Config('Garden.Email.SmtpUser', '');
         $this->PhpMailer->Password = $Password = Gdn::Config('Garden.Email.SmtpPassword', '');
         if (!empty($Username)) {
             $this->PhpMailer->SMTPAuth = TRUE;
         }
     } else {
         $this->PhpMailer->IsMail();
     }
     if ($EventName != '') {
         $this->EventArguments['EventName'] = $EventName;
         $this->FireEvent('SendMail');
     }
     if (!$this->PhpMailer->Send()) {
         throw new Exception($this->PhpMailer->ErrorInfo);
     }
     return true;
 }
开发者ID:sheldon,项目名称:Garden,代码行数:31,代码来源:class.email.php

示例5: PDF_DO

 public function PDF_DO()
 {
     include labels();
     $pdf = new Gift_PDF();
     $title = '';
     $uid = $_POST['uid'];
     $toMail = $_POST['to-mail'];
     $fromMail = $_POST['sender-mail'];
     $fromName = $_POST['sender-name'];
     $pdf->SetTitle($title);
     $pdf->PrintChapter($labelET['Company name'], 1, "Kupongi kood: {$uid}");
     $pdf->ContentHolder();
     $pdf->Ln(10);
     $name = $_POST['name'] . ' kingitus' . ' ID ' . $uid;
     $file = $name;
     $file .= '.pdf';
     $pdf->Output('files/PDF/' . $file);
     //Redirect
     //header('Location: ' . 'FILES/' . $file);
     require "libaries/PHPMailer/class.phpmailer.php";
     $mail = new PHPMailer();
     $mail->IsMail();
     $path = "files/PDF/" . $file;
     $mail->SetFrom($fromMail, "Kingituse tegi sulle: {$fromName}");
     $mail->AddAddress($toMail);
     $mail->Subject = "Kingitus Falseprogrammingu poolt";
     $mail->Body = "Vaata PDF faili. Kingitusi tegi sulle {$fromName} Emaililt: {$fromMail}";
     $mail->AddAttachment($path);
     if (!$mail->Send()) {
         echo "Error saatmisega: " . $mail->ErrorInfo;
     } else {
         echo "Kiri saadetud";
     }
 }
开发者ID:falseprogramming,项目名称:gift,代码行数:34,代码来源:Gift_PDF_Exec.php

示例6: dest_mail

function dest_mail()
{
    global $WORKING, $STATIC;
    $WORKING['STEPTODO'] = filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
    $WORKING['STEPDONE'] = 0;
    trigger_error(sprintf(__('%d. try to sending backup with mail...', 'backwpup'), $WORKING['DEST_MAIL']['STEP_TRY']), E_USER_NOTICE);
    //Create PHP Mailer
    require_once realpath($STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC']) . '/class-phpmailer.php';
    $phpmailer = new PHPMailer();
    //Setting den methode
    if ($STATIC['CFG']['mailmethod'] == "SMTP") {
        require_once realpath($STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC']) . '/class-smtp.php';
        $phpmailer->Host = $STATIC['CFG']['mailhost'];
        $phpmailer->Port = $STATIC['CFG']['mailhostport'];
        $phpmailer->SMTPSecure = $STATIC['CFG']['mailsecure'];
        $phpmailer->Username = $STATIC['CFG']['mailuser'];
        $phpmailer->Password = base64_decode($STATIC['CFG']['mailpass']);
        if (!empty($STATIC['CFG']['mailuser']) and !empty($STATIC['CFG']['mailpass'])) {
            $phpmailer->SMTPAuth = true;
        }
        $phpmailer->IsSMTP();
        trigger_error(__('Send mail with SMTP', 'backwpup'), E_USER_NOTICE);
    } elseif ($STATIC['CFG']['mailmethod'] == "Sendmail") {
        $phpmailer->Sendmail = $STATIC['CFG']['mailsendmail'];
        $phpmailer->IsSendmail();
        trigger_error(__('Send mail with Sendmail', 'backwpup'), E_USER_NOTICE);
    } else {
        $phpmailer->IsMail();
        trigger_error(__('Send mail with PHP mail', 'backwpup'), E_USER_NOTICE);
    }
    trigger_error(__('Creating mail', 'backwpup'), E_USER_NOTICE);
    $phpmailer->From = $STATIC['CFG']['mailsndemail'];
    $phpmailer->FromName = $STATIC['CFG']['mailsndname'];
    $phpmailer->AddAddress($STATIC['JOB']['mailaddress']);
    $phpmailer->Subject = sprintf(__('BackWPup archive from %1$s: %2$s', 'backwpup'), date('Y/m/d @ H:i', $STATIC['JOB']['starttime'] + $STATIC['WP']['TIMEDIFF']), $STATIC['JOB']['name']);
    $phpmailer->IsHTML(false);
    $phpmailer->Body = sprintf(__('Backup archive: %s', 'backwpup'), $STATIC['backupfile']);
    //check file Size
    if (!empty($STATIC['JOB']['mailefilesize'])) {
        if (filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']) > abs($STATIC['JOB']['mailefilesize'] * 1024 * 1024)) {
            trigger_error(__('Backup archive too big for sending by mail!', 'backwpup'), E_USER_ERROR);
            $WORKING['STEPDONE'] = 1;
            $WORKING['STEPSDONE'][] = 'DEST_MAIL';
            //set done
            return;
        }
    }
    trigger_error(__('Adding backup archive to mail', 'backwpup'), E_USER_NOTICE);
    need_free_memory(filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']) * 5);
    $phpmailer->AddAttachment($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
    trigger_error(__('Send mail....', 'backwpup'), E_USER_NOTICE);
    if (false == $phpmailer->Send()) {
        trigger_error(sprintf(__('Error "%s" on sending mail!', 'backwpup'), $phpmailer->ErrorInfo), E_USER_ERROR);
    } else {
        $WORKING['STEPTODO'] = filesize($STATIC['JOB']['backupdir'] . $STATIC['backupfile']);
        trigger_error(__('Mail send!!!', 'backwpup'), E_USER_NOTICE);
    }
    $WORKING['STEPSDONE'][] = 'DEST_MAIL';
    //set done
}
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:60,代码来源:dest_mail.php

示例7:

 /**
  * Miscellaneous calls to improve test coverage and some small tests
  */
 function test_Miscellaneous()
 {
     $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');
     //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');
 }
开发者ID:rohitvineet,项目名称:PHP-Online-Shop,代码行数:35,代码来源:phpmailerTest.php

示例8: send

 /**
  * send an email
  *
  * @param string $toaddress
  * @param string $toname
  * @param string $subject
  * @param string $mailtext
  * @param string $fromaddress
  * @param string $fromname
  * @param bool $html
  */
 public static function send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '')
 {
     $SMTPMODE = OC_Config::getValue('mail_smtpmode', 'sendmail');
     $SMTPHOST = OC_Config::getValue('mail_smtphost', '127.0.0.1');
     $SMTPAUTH = OC_Config::getValue('mail_smtpauth', false);
     $SMTPUSERNAME = OC_Config::getValue('mail_smtpname', '');
     $SMTPPASSWORD = OC_Config::getValue('mail_smtppassword', '');
     $mailo = new PHPMailer(true);
     if ($SMTPMODE == 'sendmail') {
         $mailo->IsSendmail();
     } elseif ($SMTPMODE == 'smtp') {
         $mailo->IsSMTP();
     } elseif ($SMTPMODE == 'qmail') {
         $mailo->IsQmail();
     } else {
         $mailo->IsMail();
     }
     $mailo->Host = $SMTPHOST;
     $mailo->SMTPAuth = $SMTPAUTH;
     $mailo->Username = $SMTPUSERNAME;
     $mailo->Password = $SMTPPASSWORD;
     $mailo->From = $fromaddress;
     $mailo->FromName = $fromname;
     $mailo->Sender = $fromaddress;
     $a = explode(' ', $toaddress);
     try {
         foreach ($a as $ad) {
             $mailo->AddAddress($ad, $toname);
         }
         if ($ccaddress != '') {
             $mailo->AddCC($ccaddress, $ccname);
         }
         if ($bcc != '') {
             $mailo->AddBCC($bcc);
         }
         $mailo->AddReplyTo($fromaddress, $fromname);
         $mailo->WordWrap = 50;
         if ($html == 1) {
             $mailo->IsHTML(true);
         } else {
             $mailo->IsHTML(false);
         }
         $mailo->Subject = $subject;
         if ($altbody == '') {
             $mailo->Body = $mailtext . OC_MAIL::getfooter();
             $mailo->AltBody = '';
         } else {
             $mailo->Body = $mailtext;
             $mailo->AltBody = $altbody;
         }
         $mailo->CharSet = 'UTF-8';
         $mailo->Send();
         unset($mailo);
         OC_Log::write('mail', 'Mail from ' . $fromname . ' (' . $fromaddress . ')' . ' to: ' . $toname . '(' . $toaddress . ')' . ' subject: ' . $subject, OC_Log::DEBUG);
     } catch (Exception $exception) {
         OC_Log::write('mail', $exception->getMessage(), OC_Log::ERROR);
         throw $exception;
     }
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:70,代码来源:mail.php

示例9: PHPMailer

 function mailer_init()
 {
     require_once ABSPATH . WPINC . '/class-phpmailer.php';
     require_once ABSPATH . WPINC . '/class-smtp.php';
     $smtp_options = $this->get_smtp_options();
     //        $smtp_options['enabled'] = $this->options['smtp_enabled'];
     //        $smtp_options['host'] = $this->options['smtp_host'];
     //        $smtp_options['port'] = $this->options['smtp_port'];
     //        $smtp_options['user'] = $this->options['smtp_user'];
     //        $smtp_options['pass'] = $this->options['smtp_pass'];
     //        $smtp_options['secure'] = $this->options['smtp_secure'];
     //$smtp_options = apply_filters('newsletter_smtp', $smtp_options);
     if ($smtp_options['enabled'] == 1) {
         $this->mailer = new PHPMailer();
         $this->mailer->IsSMTP();
         $this->mailer->Host = $smtp_options['host'];
         if (!empty($smtp_options['port'])) {
             $this->mailer->Port = (int) $smtp_options['port'];
         }
         if (!empty($smtp_options['user'])) {
             $this->mailer->SMTPAuth = true;
             $this->mailer->Username = $smtp_options['user'];
             $this->mailer->Password = $smtp_options['pass'];
         }
         $this->mailer->SMTPKeepAlive = true;
         $this->mailer->SMTPSecure = $smtp_options['secure'];
         $this->mailer->SMTPAutoTLS = false;
         if ($smtp_options['ssl_insecure'] == 1) {
             $this->mailer->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
         }
     } else {
         if ($this->options['phpmailer'] == 1) {
             $this->mailer = new PHPMailer();
             $this->mailer->IsMail();
         } else {
             $this->mailer = null;
             return;
         }
     }
     if (!empty($this->options['content_transfer_encoding'])) {
         $this->mailer->Encoding = $this->options['content_transfer_encoding'];
     } else {
         $this->mailer->Encoding = 'base64';
     }
     $this->mailer->CharSet = 'UTF-8';
     $this->mailer->From = $this->options['sender_email'];
     $return_path = $this->options['return_path'];
     if (!empty($return_path)) {
         $this->mailer->Sender = $return_path;
     }
     if (!empty($this->options['reply_to'])) {
         $this->mailer->AddReplyTo($this->options['reply_to']);
     }
     $this->mailer->FromName = $this->options['sender_name'];
 }
开发者ID:radikalportal,项目名称:radikalportal,代码行数:55,代码来源:plugin.php

示例10: end_mail

function end_mail($to, $subject, $body, $replyto = '', $replyto_name = '')
{
    if (file_exists(END_SYSTEM_DIR . 'config/smtp.config.php')) {
        require END_SYSTEM_DIR . 'config/smtp.config.php';
    } else {
        $config = array('use_smtp' => false);
    }
    include_once END_SYSTEM_DIR . 'plugin/phpmailer/class.phpmailer.php';
    try {
        $mail = new PHPMailer(true);
        //New instance, with exceptions enabled
        $body = preg_replace('/\\\\/', '', $body);
        //Strip backslashes
        if ($config['use_smtp']) {
            $mail->IsSMTP();
            $mail->SMTPDebug = false;
            $mail->CharSet = 'utf-8';
            $mail->SMTPAuth = true;
            if ($config['smtp_port']) {
                $mail->Port = $config['smtp_port'];
            }
            if ($config['smtp_secure']) {
                $mail->SMTPSecure = $config['smtp_secure'];
            }
            if ($config['smtp_host']) {
                $mail->Host = $config['smtp_host'];
            }
            if ($config['smtp_username']) {
                $mail->Username = $config['smtp_username'];
            }
            if ($config['smtp_password']) {
                $mail->Password = $config['smtp_password'];
            }
        } else {
            $mail->IsMail();
        }
        $mail->From = $config['smtp_fullemail'];
        $mail->FromName = $config['smtp_fullname'];
        !$replyto && ($replyto = $config['smtp_fullemail']);
        !$replyto_name && ($replyto_name = $cofnig['smtp_fullname']);
        $mail->AddReplyTo($replyto, $replyto_name);
        $mail->AddAddress($to);
        $mail->Subject = $subject;
        $mail->WordWrap = 80;
        // set word wrap
        $mail->MsgHTML($body);
        $mail->IsHTML(true);
        // send as HTML
        $mail->Send();
        return true;
    } catch (phpmailerException $e) {
        echo $e->errorMessage();
        return false;
    }
}
开发者ID:WSKINGS,项目名称:chat_tickets,代码行数:55,代码来源:core.php

示例11: send

 /**
  * 发送邮件
  *
  * @param string $to
  * @param string $to_name
  * @param string $subject
  * @param string $body
  * @param string $mailtype
  * @return boolean
  */
 public static function send($to, $to_name, $subject, $body, $chaosong = array(), $mailtype = 'txt')
 {
     self::init();
     $send_type = mod_config::get_one_config('fl_sendemailtype') == '1' ? 'smtp' : 'mail';
     $mail = new PHPMailer();
     $mail->SMTPDebug = false;
     // 发送方式
     if ($send_type == 'smtp') {
         self::smtp_init();
         $mail->IsSMTP();
         $mail->Host = self::$smtp_server;
         $mail->Port = self::$smtp_port;
         $mail->SmtpSsl = self::$smtp_ssl;
         // SSL 连接
         if (self::$smtp_auth) {
             $mail->SMTPAuth = true;
             $mail->Username = self::$smtp_user;
             $mail->Password = self::$smtp_pwd;
         } else {
             $mail->SMTPAuth = false;
         }
     } elseif ($send_type == 'mail') {
         $mail->IsMail();
     }
     // 发件人邮箱
     $mail->From = self::$from_email;
     // 发件人名称
     if (self::$from_name != '') {
         $mail->FromName = self::$from_name;
     }
     // 收件人邮箱和姓名
     $mail->AddAddress($to, $to_name);
     if ($chaosong) {
         foreach ($chaosong as $v) {
             $mail->AddCC($v['to'], $v['name']);
         }
     }
     // 邮件编码
     $mail->CharSet = self::$charset;
     // 邮件编码方式
     $mail->Encoding = "base64";
     // 邮件格式类型
     if ($mailtype == 'txt') {
         $mail->IsHTML(false);
     } elseif ($mailtype == 'html') {
         $mail->IsHTML(true);
         $mail->AltBody = "text/html";
     }
     $mail->Subject = $subject;
     // 邮件主题
     $mail->Body = $body;
     // 邮件内容D
     return !$mail->Send() ? false : true;
 }
开发者ID:Zniel,项目名称:fl_crtlpanel_self_dev,代码行数:64,代码来源:mod_mail.php

示例12: email

function email($from, $fromname, $to, $subject, $msg)
{
    $mail = new PHPMailer();
    $mail->IsMail();
    $mail->CharSet = "utf-8";
    $mail->AddReplyTo($from, $fromname);
    $mail->AddAddress($to);
    $mail->SetFrom($from, $fromname);
    $mail->Subject = $subject;
    $mail->MsgHTML($msg);
    $mail->Send();
}
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:12,代码来源:request.php

示例13: send

 public function send($emailAddresses)
 {
     $phpMailer = new PHPMailer();
     $phpMailer->IsMail();
     $phpMailer->AddReplyTo($this->email, $this->name);
     foreach ($emailAddresses as $emailAddress) {
         $phpMailer->AddAddress($emailAddress);
     }
     $phpMailer->SetFrom($this->email, $this->name);
     $phpMailer->Subject = 'Contact form message: ' . $this->subject . ' from ' . $this->name . '.';
     $msg = 'Name:	    ' . $this->name . '<br />' . 'Email:	    ' . $this->email . '<br />' . 'IP Address:	' . $_SERVER['REMOTE_ADDR'] . '<br /><br />' . 'Message:<br /><br />' . nl2br($this->message);
     $phpMailer->MsgHTML($msg);
     $phpMailer->Send();
 }
开发者ID:jorik041,项目名称:easy-ajax-contact-form,代码行数:14,代码来源:service.php

示例14: enviar

 public static function enviar($motivo, $tipo, $email, $nome, $id = 0, $complemento = "", $anexo = "")
 {
     $mail = new PHPMailer();
     $mail->From = SENDMAIL_FROM;
     $mail->FromName = SENDMAIL_FROM_NAME;
     $mail->Host = SENDMAIL_HOST;
     $mail->IsMail();
     $mail->IsHTML(true);
     $mail->AddAddress($email, $nome);
     $tipoCapitulado = ucfirst($tipo);
     $saudacao = $tipo == "individual" ? "Olá " : "";
     $primeiro_nome = array_shift(explode(" ", $nome));
     $texto = "<!DOCTYPE html><html lang='pt-br'><head><meta charset='utf-8'></head><body>{$saudacao}<b>{$primeiro_nome}</b>,<br><br>";
     switch ($motivo) {
         case 'cadastro':
             $titulo = "Cadastro realizado com sucesso";
             $texto .= "Obrigado pelo interesse em participar do <b>" . NOME_EVENTO . "</b>!<br><br>\n                    <b>Confirma&ccedil;&atilde;o da Pr&eacute;-Inscri&ccedil;&atilde;o:</b><br>\n                    Confirmamos o cadastro de seus dados, voc&ecirc; est&aacute; inscrito com o c&oacute;digo de <b>n&uacute;mero {$id}</b>.<br><br>\n                    <b>Pagamento:</b><br>\n                    Estamos aguardando a confirma&ccedil;&atilde;o do PagSeguro, para finalizarmos seu processo de inscri&ccedil;&atilde;o.<br><br>\n                    Assim que conclu&iacute;do, voc&ecirc; receber&aacute; uma mensagem de confirma&ccedil;&atilde;o da inscri&ccedil;&atilde;o no <b>" . NOME_EVENTO . "</b>.<br><br>\n                    Caso tenha ocorrido algum problema, utilize o link abaixo para efetuar o pagamento e confirmar a inscri&ccedil;&atilde;o.<br>\n                    <a href='" . HOME_PAGE . "inscricao/view/pagamento{$tipoCapitulado}.php?id=" . $id . "'>" . HOME_PAGE . "inscricao/view/pagamento{$tipoCapitulado}.php?id=" . $id . "</a><br><br>\n                    {$complemento}";
             break;
         case 'pagamento':
             $titulo = "Confirmação de pagamento e inscrição";
             if ($tipo == "individual") {
                 $texto .= "Escrevemos para informar que recebemos o pagamento de sua inscri&ccedil;&atilde;o.<br><br>";
             } elseif ($tipo == "empresa") {
                 $texto .= "Escrevemos para informar que recebemos o pagamento da inscri&ccedil;&atilde;o de seus funcion&aacute;rios.<br><br>{$complemento}";
             }
             break;
         case 'envio_certificado':
             $titulo = "Certificado de Participação";
             if (file_exists($anexo)) {
                 $mail->AddAttachment($anexo);
             }
             $texto .= "Queremos agradecer sua participa&ccedil;&atilde;o e colabora&ccedil;&atilde;o no <b>" . NOME_EVENTO . "</b>.<br><br>\n                    Tamb&eacute;m estamos enviando, em anexo, seu certificado de participa&ccedil;&atilde;o. Nos vemos nos pr&oacute;ximos eventos!<br><br>";
             break;
         default:
             $titulo = "Aviso";
             if (!empty($complemento)) {
                 $texto .= "{$complemento}<br><br>";
             } else {
                 $texto .= "Verificamos em nosso sistema que seu pagamento ainda n&atilde;o foi efetuado.<br><br>\n                        \n                        Estamos chegando ao n&uacute;mero m&aacute;ximo da lota&ccedil;&atilde;o do evento. Precisamos que voc&ecirc; confirme sua participa&ccedil;&atilde;o para que a mesma n&atilde;o seja cancelada na pr&oacute;xima sexta-feira. Assim, podermos dar oportunidade a outras pessoas que desejam participar.<br><br>\n                        \n                        Assim que conclu&iacute;do, voc&ecirc; receber&aacute; uma mensagem de confirma&ccedil;&atilde;o.<br><br>\n                        Caso tenha ocorrido algum problema, utilize o link abaixo para efetuar o pagamento e confirmar sua inscri&ccedil;&atilde;o.<br><br>\n                        <a href='" . HOME_PAGE . "inscricao/view/pagamento{$tipoCapitulado}.php?id=" . $id . "'>" . HOME_PAGE . "inscricao/view/pagamento{$tipoCapitulado}.php?id=" . $id . "</a><br><br>";
             }
     }
     if ($motivo != "envio_certificado") {
         $texto .= "<br>Acesse nosso <a href='" . HOME_PAGE . "'>web site</a> ou siga o <a href='" . TWITTER_ENDERECO . "'>" . TWITTER_NOME . "</a> no Twitter para acompanhar as not&iacute;cias sobre o " . NOME_EVENTO . ".<br><br>";
     }
     $texto .= "<b>Organiza&ccedil;&atilde;o do " . NOME_EVENTO . "</b></body></html>";
     $mail->Subject = $titulo;
     $mail->Body = $texto;
     return $mail->Send();
 }
开发者ID:kailIII,项目名称:tasafoconf2012-inscricao,代码行数:49,代码来源:EnviarEmail.class.php

示例15: sendMailToAdmin

function sendMailToAdmin($subject, $email, $body)
{
    global $modx;
    $mail = new PHPMailer();
    $mail->IsMail();
    $mail->IsHTML(false);
    $mail->From = $modx->config['emailsender'];
    $mail->FromName = $_SERVER['SERVER_NAME'];
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AddAddress($email);
    if (!$mail->send()) {
        //echo $mail->ErrorInfo;
    }
}
开发者ID:myindexlike,项目名称:MODX.snippets,代码行数:15,代码来源:result.php


注:本文中的PHPMailer::IsMail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。