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


PHP PHPMailer::ClearReplyTos方法代码示例

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


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

示例1: send

 public function send()
 {
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->SMTPDebug = true;
     // enables SMTP debug information (for testing)
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $body = $this->body ? $this->body : NULL;
     $title = $this->title ? $this->title : NULL;
     $to = $this->email_to ? $this->email_to : NULL;
     $mail->SMTPSecure = 'tls';
     // sets the prefix to the servier
     $mail->Host = 'smtp.dynect.net';
     // sets GMAIL as the SMTP server
     $mail->Port = 25;
     // set the SMTP port for the GMAIL server
     $mail->Username = 'admin@yeahmails.com';
     // GMAIL username
     $mail->Password = 'lnJXhYlbIbWMw1NZ';
     // GMAIL password
     //$mail->SetFrom('service@yeahmobi.com');
     $mail->SetFrom('yeahmobi_team_noreply@yeahmails.com', 'YeahMobi Team');
     //PHP Mailer要求发送的From 与 mail account为同一主机名
     $mail->ClearReplyTos();
     $mail->ClearAddresses();
     $mail->AddReplyTo('yeahmobi_team_noreply@yeahmails.com', 'YeahMobi Team');
     $mail->Subject = "=?utf-8?B?" . base64_encode($title) . "?=";
     //$mail->AltBody    = $this->_contentReplace($v['title'], $v);                        // optional, comment out and test
     $mail->MsgHTML($body);
     $mail->AddAddress($to);
     $mail->Send();
 }
开发者ID:kaka987,项目名称:YoungYaf,代码行数:33,代码来源:Sendmail.php

示例2: sendQueue

 function sendQueue($pQueueMixed)
 {
     global $gBitSmarty, $gBitSystem, $gBitLanguage;
     static $body = array();
     if (is_array($pQueueMixed)) {
         $pick = $pQueueMixed;
     } elseif (is_numeric($pQueueMixed)) {
         $pick = $this->mDb->GetRow("SELECT * FROM `" . BIT_DB_PREFIX . "mail_queue` mq WHERE `mail_queue_id` = ? " . $this->mDb->SQLForUpdate(), array($pQueueMixed));
     }
     if (!empty($pick)) {
         $startTime = microtime(TRUE);
         $this->mDb->query("UPDATE `" . BIT_DB_PREFIX . "mail_queue` SET `begin_date`=? WHERE `mail_queue_id` = ? ", array(time(), $pick['mail_queue_id']));
         if (!empty($pick['user_id'])) {
             $userHash = $this->mDb->getRow("SELECT * FROM `" . BIT_DB_PREFIX . "users_users` WHERE `user_id`=?", array($pick['user_id']));
             $pick['full_name'] = BitUser::getDisplayName(FALSE, $userHash);
         } else {
             $pick['full_name'] = NULL;
         }
         if (!isset($body[$pick['content_id']])) {
             $gBitSmarty->assign('sending', TRUE);
             // We only support sending of newsletters currently
             $content = new BitNewsletterEdition(NULL, $pick['content_id']);
             if ($content->load()) {
                 $body[$pick['content_id']]['body'] = $content->render();
                 $body[$pick['content_id']]['subject'] = $content->getTitle();
                 $body[$pick['content_id']]['reply_to'] = $content->getField('reply_to', $gBitSystem->getConfig('site_sender_email', $_SERVER['SERVER_ADMIN']));
                 $body[$pick['content_id']]['object'] = $content;
             } else {
                 bit_error_log($this->mErrors);
             }
             //				$content[$pick['content_id']] = LibertyBase::getLibertyObject();
         }
         print "[ {$pick['mail_queue_id']} ] {$pick['content_id']} TO: {$pick['email']}\t";
         $unsub = $this->getUnsubscription($pick['email'], $pick['nl_content_id']);
         if (!empty($unsub)) {
             print " SKIPPED (unsubscribed) <br/>\n";
             $this->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "mail_queue` WHERE `mail_queue_id`=?", array($pick['mail_queue_id']));
         } elseif (!empty($body[$pick['content_id']])) {
             $pick['url_code'] = md5($pick['content_id'] . $pick['email'] . $pick['queue_date']);
             $unsub = '';
             if ($body[$pick['content_id']]['object']->mNewsletter->getField('unsub_msg')) {
                 $gBitSmarty->assign('url_code', $pick['url_code']);
             }
             $gBitSystem->preDisplay('');
             $gBitSmarty->assign('sending', TRUE);
             $gBitSmarty->assign('unsubMessage', $unsub);
             $gBitSmarty->assign('trackCode', $pick['url_code']);
             $gBitSmarty->assign('mid', 'bitpackage:newsletters/view_edition.tpl');
             $htmlBody = $gBitSmarty->fetch('bitpackage:newsletters/mail_edition.tpl');
             $htmlBody = bit_add_clickthrough($htmlBody, $pick['url_code']);
             $mailer = new PHPMailer();
             if ($gBitSystem->getConfig('bitmailer_errors_to')) {
                 $mailer->Sender = $gBitSystem->getConfig('bitmailer_errors_to');
                 $mailer->addCustomHeader("Errors-To: " . $gBitSystem->getConfig('bitmailer_errors_to'));
             }
             $mailer->From = $gBitSystem->getConfig('bitmailer_sender_email', $gBitSystem->getConfig('site_sender_email', $_SERVER['SERVER_ADMIN']));
             $mailer->FromName = $gBitSystem->getConfig('bitmailer_from', $gBitSystem->getConfig('site_title'));
             $mailer->Host = $gBitSystem->getConfig('bitmailer_servers', $gBitSystem->getConfig('kernel_server_name', '127.0.0.1'));
             $mailer->Mailer = $gBitSystem->getConfig('bitmailer_protocol', 'smtp');
             // Alternative to IsSMTP()
             $mailer->CharSet = 'UTF-8';
             if ($gBitSystem->getConfig('bitmailer_smtp_username')) {
                 $mailer->SMTPAuth = TRUE;
                 $mailer->Username = $gBitSystem->getConfig('bitmailer_smtp_username');
             }
             if ($gBitSystem->getConfig('bitmailer_smtp_password')) {
                 $mailer->Password = $gBitSystem->getConfig('bitmailer_smtp_password');
             }
             $mailer->WordWrap = $gBitSystem->getConfig('bitmailer_word_wrap', 75);
             if (!$mailer->SetLanguage($gBitLanguage->getLanguage(), UTIL_PKG_PATH . 'phpmailer/language/')) {
                 $mailer->SetLanguage('en');
             }
             $mailer->ClearReplyTos();
             $mailer->AddReplyTo($body[$pick['content_id']]['reply_to'], $gBitSystem->getConfig('bitmailer_from'));
             $mailer->Body = $htmlBody;
             $mailer->Subject = $body[$pick['content_id']]['subject'];
             $mailer->IsHTML(TRUE);
             $mailer->AltBody = '';
             $mailer->AddAddress($pick['email'], $pick["full_name"]);
             if ($mailer->Send()) {
                 print " SENT " . round(microtime(TRUE) - $startTime, 2) . " secs<br/>\n";
                 flush();
                 $updateQuery = "UPDATE `" . BIT_DB_PREFIX . "mail_queue` SET `sent_date`=?,`url_code`=?  WHERE `content_id`=? AND `email`=?";
                 $this->mDb->query($updateQuery, array(time(), $pick['url_code'], $pick['content_id'], $pick['email']));
             } else {
                 $updateQuery = "UPDATE `" . BIT_DB_PREFIX . "mail_queue` SET `mail_error`=?,`sent_date`=?  WHERE `content_id`=? AND `email`=?";
                 $this->mDb->query($updateQuery, array($mailer->ErrorInfo, time(), $pick['content_id'], $pick['email']));
                 $pick['error'] = $mailer->ErrorInfo;
                 $this->logError($pick);
             }
         }
     }
 }
开发者ID:bitweaver,项目名称:newsletters,代码行数:93,代码来源:BitNewsletterMailer.php

示例3: sendemail

function sendemail($toname, $toemail, $fromname, $fromemail, $subject, $message, $type = "plain", $cc = "", $bcc = "")
{
    global $settings, $locale;
    require_once INCLUDES . "class.phpmailer.php";
    $mail = new PHPMailer();
    if (file_exists(INCLUDES . "language/phpmailer.lang-" . $locale['phpmailer'] . ".php")) {
        $mail->SetLanguage($locale['phpmailer'], INCLUDES . "language/");
    } else {
        $mail->SetLanguage("en", INCLUDES . "language/");
    }
    if (!$settings['smtp_host']) {
        $mail->IsMAIL();
    } else {
        $mail->IsSMTP();
        $mail->Host = $settings['smtp_host'];
        $mail->Port = $settings['smtp_port'];
        $mail->SMTPAuth = $settings['smtp_auth'] ? true : false;
        $mail->Username = $settings['smtp_username'];
        $mail->Password = $settings['smtp_password'];
    }
    $mail->CharSet = $locale['charset'];
    $mail->From = $fromemail;
    $mail->FromName = $fromname;
    $mail->AddAddress($toemail, $toname);
    $mail->AddReplyTo($fromemail, $fromname);
    if ($cc) {
        $cc = explode(", ", $cc);
        foreach ($cc as $ccaddress) {
            $mail->AddCC($ccaddress);
        }
    }
    if ($bcc) {
        $bcc = explode(", ", $bcc);
        foreach ($bcc as $bccaddress) {
            $mail->AddBCC($bccaddress);
        }
    }
    if ($type == "plain") {
        $mail->IsHTML(false);
    } else {
        $mail->IsHTML(true);
    }
    $mail->Subject = $subject;
    $mail->Body = $message;
    if (!$mail->Send()) {
        $mail->ErrorInfo;
        $mail->ClearAllRecipients();
        $mail->ClearReplyTos();
        return false;
    } else {
        $mail->ClearAllRecipients();
        $mail->ClearReplyTos();
        return true;
    }
}
开发者ID:dioda,项目名称:phpfusion,代码行数:55,代码来源:sendmail_include.php

示例4: send

 /**
  * Short description of method send
  *
  * @access public
  * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
  * @return int
  */
 public function send()
 {
     $returnValue = (int) 0;
     foreach ($this->messages as $message) {
         if ($message instanceof tao_helpers_transfert_Message) {
             $this->mailer->SetFrom($message->getFrom());
             $this->mailer->AddReplyTo($message->getFrom());
             $this->mailer->Subject = $message->getTitle();
             $this->mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody()));
             $this->mailer->MsgHTML($message->getBody());
             $this->mailer->AddAddress($message->getTo());
             try {
                 if ($this->mailer->Send()) {
                     $message->setStatus(tao_helpers_transfert_Message::STATUS_SENT);
                     $returnValue++;
                 }
                 if ($this->mailer->IsError()) {
                     if (DEBUG_MODE) {
                         echo $this->mailer->ErrorInfo . "<br>";
                     }
                     $message->setStatus(tao_helpers_transfert_Message::STATUS_ERROR);
                 }
             } catch (phpmailerException $pe) {
                 if (DEBUG_MODE) {
                     print $pe;
                 }
             }
         }
         $this->mailer->ClearReplyTos();
         $this->mailer->ClearAllRecipients();
     }
     $this->mailer->SmtpClose();
     return (int) $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:41,代码来源:MailAdapter.php

示例5: Send

 public function Send(IEmailMessage $emailMessage)
 {
     $this->phpMailer->ClearAllRecipients();
     $this->phpMailer->ClearReplyTos();
     $this->phpMailer->CharSet = $emailMessage->Charset();
     $this->phpMailer->Subject = $emailMessage->Subject();
     $this->phpMailer->Body = $emailMessage->Body();
     $from = $emailMessage->From();
     $defaultFrom = Configuration::Instance()->GetSectionKey(ConfigSection::EMAIL, ConfigKeys::DEFAULT_FROM_ADDRESS);
     $defaultName = Configuration::Instance()->GetSectionKey(ConfigSection::EMAIL, ConfigKeys::DEFAULT_FROM_NAME);
     $address = empty($defaultFrom) ? $from->Address() : $defaultFrom;
     $name = empty($defaultName) ? $from->Name() : $defaultName;
     $this->phpMailer->SetFrom($address, $name);
     $replyTo = $emailMessage->ReplyTo();
     $this->phpMailer->AddReplyTo($replyTo->Address(), $replyTo->Name());
     $to = $this->ensureArray($emailMessage->To());
     $toAddresses = new StringBuilder();
     foreach ($to as $address) {
         $toAddresses->Append($address->Address());
         $this->phpMailer->AddAddress($address->Address(), $address->Name());
     }
     $cc = $this->ensureArray($emailMessage->CC());
     foreach ($cc as $address) {
         $this->phpMailer->AddCC($address->Address(), $address->Name());
     }
     $bcc = $this->ensureArray($emailMessage->BCC());
     foreach ($bcc as $address) {
         $this->phpMailer->AddBCC($address->Address(), $address->Name());
     }
     if ($emailMessage->HasStringAttachment()) {
         Log::Debug('Adding email attachment %s', $emailMessage->AttachmentFileName());
         $this->phpMailer->AddStringAttachment($emailMessage->AttachmentContents(), $emailMessage->AttachmentFileName());
     }
     Log::Debug('Sending %s email to: %s from: %s', get_class($emailMessage), $toAddresses->ToString(), $from->Address());
     $success = false;
     try {
         $success = $this->phpMailer->Send();
     } catch (Exception $ex) {
         Log::Error('Failed sending email. Exception: %s', $ex);
     }
     Log::Debug('Email send success: %d. %s', $success, $this->phpMailer->ErrorInfo);
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:42,代码来源:EmailService.php

示例6: From

 /**
  * Allows the explicit definition of the email's sender address & name.
  * Defaults to the applications Configuration 'SupportEmail' & 'SupportName'
  * settings respectively.
  *
  * @param string $SenderEmail
  * @param string $SenderName
  * @return Email
  */
 public function From($SenderEmail = '', $SenderName = '', $bOverrideSender = FALSE)
 {
     if ($SenderEmail == '') {
         $SenderEmail = Gdn::Config('Garden.Email.SupportAddress', '');
     }
     if ($SenderName == '') {
         $SenderName = Gdn::Config('Garden.Email.SupportName', '');
     }
     if ($bOverrideSender != FALSE) {
         $this->PhpMailer->ClearReplyTos();
         $this->PhpMailer->Sender = $SenderEmail;
     }
     $this->PhpMailer->SetFrom($SenderEmail, $SenderName);
     return $this;
 }
开发者ID:robi-bobi,项目名称:Garden,代码行数:24,代码来源:class.email.php

示例7: array


//.........这里部分代码省略.........
                             if (false !== stripos($charset, 'charset=')) {
                                 $charset = trim(str_replace(array('charset=', '"'), '', $charset));
                             } elseif (false !== stripos($charset, 'boundary=')) {
                                 $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset));
                                 $charset = '';
                             }
                         } else {
                             $content_type = trim($content);
                         }
                         break;
                     case 'cc':
                         $cc = array_merge((array) $cc, explode(',', $content));
                         break;
                     case 'bcc':
                         $bcc = array_merge((array) $bcc, explode(',', $content));
                         break;
                     case 'message-id':
                         $message_id = trim($content);
                     default:
                         // Add it to our grand headers array
                         $headers[trim($name)] = trim($content);
                         break;
                 }
             }
         }
     }
     // Empty out the values that may be set
     $phpmailer->ClearAddresses();
     $phpmailer->ClearAllRecipients();
     $phpmailer->ClearAttachments();
     $phpmailer->ClearBCCs();
     $phpmailer->ClearCCs();
     $phpmailer->ClearCustomHeaders();
     $phpmailer->ClearReplyTos();
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = 'WordPress';
     }
     /* If we don't have an email from the input headers default to wordpress@$sitename
      * Some hosts will block outgoing mail from this address if it doesn't exist but
      * there's no easy alternative. Defaulting to admin_email might appear to be another
      * option but some hosts may refuse to relay mail from an unknown domain. See
      * http://trac.wordpress.org/ticket/5007.
      */
     if (!isset($from_email)) {
         // Get the site domain and get rid of www.
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $from_email = 'wordpress@' . $sitename;
     }
     // Plugin authors can override the potentially troublesome default
     $phpmailer->From = apply_filters('wp_mail_from', $from_email);
     $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name);
     // Set destination addresses
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     foreach ((array) $to as $recipient) {
         $phpmailer->AddAddress(trim($recipient));
     }
     // Set mail's subject and body
     $phpmailer->Subject = $subject;
     $phpmailer->Body = $message;
开发者ID:bi0xid,项目名称:bach,代码行数:67,代码来源:wp-functions.php

示例8: send_mail


//.........这里部分代码省略.........
    if ($delais_option_reservation > 0 && $option_reservation != -1) {
        $reservation = $reservation . '*** ' . $vocab['reservation_a_confirmer_au_plus_tard_le'] . ' ' . time_date_string_jma($option_reservation, $dformat) . " ***\n";
    }
    $reservation = $reservation . "-----\n";
    $message = $message . $reservation;
    $message = $message . $vocab['msg_no_email'] . Settings::get('webmaster_email');
    $message = html_entity_decode($message);
    $sql = 'SELECT u.email FROM ' . TABLE_PREFIX . '_utilisateurs u, ' . TABLE_PREFIX . "_j_mailuser_room j WHERE (j.id_room='" . protect_data_sql($room_id) . "' AND u.login=j.login and u.etat='actif') ORDER BY u.nom, u.prenom";
    $res = grr_sql_query($sql);
    $nombre = grr_sql_count($res);
    if ($nombre > 0) {
        $tab_destinataire = array();
        for ($i = 0; $row = grr_sql_row($res, $i); ++$i) {
            if ($row[0] != '') {
                $tab_destinataire[] = $row[0];
            }
        }
        foreach ($tab_destinataire as $value) {
            if (Settings::get('grr_mail_Bcc') == 'y') {
                $mail->AddBCC($value);
            } else {
                $mail->AddAddress($value);
            }
        }
        $mail->Subject = $sujet;
        $mail->Body = $message;
        $mail->AddReplyTo($repondre);
        if (!$mail->Send()) {
            $message_erreur .= $mail->ErrorInfo;
        }
    }
    $mail->ClearAddresses();
    $mail->ClearBCCs();
    $mail->ClearReplyTos();
    if ($action == 7) {
        $mail_admin = find_user_room($room_id);
        if (count($mail_admin) > 0) {
            foreach ($mail_admin as $value) {
                if (Settings::get('grr_mail_Bcc') == 'y') {
                    $mail->AddBCC($value);
                } else {
                    $mail->AddAddress($value);
                }
            }
            $mail->Subject = $sujet;
            $mail->Body = $message;
            $mail->AddReplyTo($repondre);
            if (!$mail->Send()) {
                $message_erreur .= $mail->ErrorInfo;
            }
        }
        $mail->ClearAddresses();
        $mail->ClearBCCs();
        $mail->ClearReplyTos();
    }
    if ($action == 7) {
        $sujet7 = $vocab['subject_mail1'] . $room_name . ' - ' . $date_avis;
        $sujet7 .= $vocab['subject_mail_retard'];
        $message7 = removeMailUnicode(Settings::get('company')) . ' - ' . $vocab['title_mail'];
        $message7 .= traite_grr_url('', 'y') . "\n\n";
        $message7 .= $vocab['ressource empruntee non restituée'] . "\n";
        $message7 .= $room_name . ' (' . $area_name . ')';
        $message7 .= "\n" . $reservation;
        $message7 = html_entity_decode($message7);
        $destinataire7 = $beneficiaire_email;
        $repondre7 = Settings::get('webmaster_email');
开发者ID:nicolas-san,项目名称:GRR,代码行数:67,代码来源:functions.inc.php

示例9: array


//.........这里部分代码省略.........
                     case 'content-type':
                         if (strpos($content, ';') !== false) {
                             list($type, $charset_content) = explode(';', $content);
                             $content_type = trim($type);
                             if (false !== stripos($charset_content, 'charset=')) {
                                 $charset = trim(str_replace(array('charset=', '"'), '', $charset_content));
                             } elseif (false !== stripos($charset_content, 'boundary=')) {
                                 $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset_content));
                                 $charset = '';
                             }
                             // Avoid setting an empty $content_type.
                         } elseif ('' !== trim($content)) {
                             $content_type = trim($content);
                         }
                         break;
                     case 'cc':
                         $cc = array_merge((array) $cc, explode(',', $content));
                         break;
                     case 'bcc':
                         $bcc = array_merge((array) $bcc, explode(',', $content));
                         break;
                     default:
                         // Add it to our grand headers array
                         $headers[trim($name)] = trim($content);
                         break;
                 }
             }
         }
     }
     // Empty out the values that may be set
     $phpmailer->ClearAllRecipients();
     $phpmailer->ClearAttachments();
     $phpmailer->ClearCustomHeaders();
     $phpmailer->ClearReplyTos();
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = 'WordPress';
     }
     /* If we don't have an email from the input headers default to wordpress@$sitename
      * Some hosts will block outgoing mail from this address if it doesn't exist but
      * there's no easy alternative. Defaulting to admin_email might appear to be another
      * option but some hosts may refuse to relay mail from an unknown domain. See
      * https://core.trac.wordpress.org/ticket/5007.
      */
     if (!isset($from_email)) {
         // Get the site domain and get rid of www.
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $from_email = 'wordpress@' . $sitename;
     }
     /**
      * Filter the email address to send from.
      *
      * @since 2.2.0
      *
      * @param string $from_email Email address to send from.
      */
     $phpmailer->From = apply_filters('wp_mail_from', $from_email);
     /**
      * Filter the name to associate with the "from" email address.
      *
      * @since 2.3.0
      *
开发者ID:cybKIRA,项目名称:roverlink-updated,代码行数:67,代码来源:pluggable.php

示例10: extract


//.........这里部分代码省略.........
                         $from_name = substr($content, 0, strpos($content, '<') - 1);
                         $from_name = str_replace('"', '', $from_name);
                         $from_name = trim($from_name);
                         $from_email = substr($content, strpos($content, '<') + 1);
                         $from_email = str_replace('>', '', $from_email);
                         $from_email = trim($from_email);
                     } else {
                         $from_name = trim($content);
                     }
                 } elseif ('content-type' == strtolower($name)) {
                     if (strpos($content, ';') !== false) {
                         list($type, $charset) = explode(';', $content);
                         $content_type = trim($type);
                         $charset = trim(str_replace(array('charset=', '"'), '', $charset));
                     } else {
                         $content_type = trim($content);
                     }
                 } elseif ('cc' == strtolower($name)) {
                     $cc = explode(",", $content);
                 } elseif ('bcc' == strtolower($name)) {
                     $bcc = explode(",", $content);
                 } else {
                     // Add it to our grand headers array
                     $headers[trim($name)] = trim($content);
                 }
             }
         }
     }
     // Empty out the values that may be set
     $phpmailer->ClearAddresses();
     $phpmailer->ClearAllRecipients();
     $phpmailer->ClearAttachments();
     $phpmailer->ClearBCCs();
     $phpmailer->ClearCCs();
     $phpmailer->ClearCustomHeaders();
     $phpmailer->ClearReplyTos();
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = 'WordPress';
     }
     // If we don't have an email from the input headers
     if (!isset($from_email)) {
         // Get the site domain and get rid of www.
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $from_email = 'wordpress@' . $sitename;
     }
     // Set the from name and email
     $phpmailer->From = apply_filters('wp_mail_from', $from_email);
     $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name);
     // Set destination address
     $phpmailer->AddAddress($to);
     // Set mail's subject and body
     $phpmailer->Subject = $subject;
     $phpmailer->Body = $message;
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ($cc as $recipient) {
             $phpmailer->AddCc(trim($recipient));
         }
     }
     if (!empty($bcc)) {
         foreach ($bcc as $recipient) {
             $phpmailer->AddBcc(trim($recipient));
         }
     }
     // Set to use PHP's mail()
     $phpmailer->IsMail();
     // Set Content-Type and charset
     // If we don't have a content-type from the input headers
     if (!isset($content_type)) {
         $content_type = 'text/plain';
     }
     $content_type = apply_filters('wp_mail_content_type', $content_type);
     // Set whether it's plaintext or not, depending on $content_type
     if ($content_type == 'text/html') {
         $phpmailer->IsHTML(true);
     } else {
         $phpmailer->IsHTML(false);
     }
     // If we don't have a charset from the input headers
     if (!isset($charset)) {
         $charset = get_bloginfo('charset');
     }
     // Set the content-type and charset
     $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset);
     // Set custom headers
     if (!empty($headers)) {
         foreach ($headers as $name => $content) {
             $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
         }
     }
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     // Send!
     $result = @$phpmailer->Send();
     return $result;
 }
开发者ID:nurpax,项目名称:saastafi,代码行数:101,代码来源:pluggable.php

示例11: send_mail


//.........这里部分代码省略.........
    if ($delais_option_reservation > 0 && $option_reservation != -1) {
        $reservation = $reservation . "*** " . $vocab["reservation_a_confirmer_au_plus_tard_le"] . " " . time_date_string_jma($option_reservation, $dformat) . " ***\n";
    }
    $reservation = $reservation . "-----\n";
    $message = $message . $reservation;
    $message = $message . $vocab["msg_no_email"] . Settings::get("webmaster_email");
    $message = html_entity_decode($message);
    $sql = "SELECT u.email FROM " . TABLE_PREFIX . "_utilisateurs u, " . TABLE_PREFIX . "_j_mailuser_room j WHERE (j.id_room='" . protect_data_sql($room_id) . "' AND u.login=j.login and u.etat='actif') ORDER BY u.nom, u.prenom";
    $res = grr_sql_query($sql);
    $nombre = grr_sql_count($res);
    if ($nombre > 0) {
        $tab_destinataire = array();
        for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
            if ($row[0] != "") {
                $tab_destinataire[] = $row[0];
            }
        }
        foreach ($tab_destinataire as $value) {
            if (Settings::get("grr_mail_Bcc") == "y") {
                $mail->AddBCC($value);
            } else {
                $mail->AddAddress($value);
            }
        }
        $mail->Subject = $sujet;
        $mail->Body = $message;
        $mail->AddReplyTo($repondre);
        if (!$mail->Send()) {
            $message_erreur .= $mail->ErrorInfo;
        }
    }
    $mail->ClearAddresses();
    $mail->ClearBCCs();
    $mail->ClearReplyTos();
    if ($action == 7) {
        $mail_admin = find_user_room($room_id);
        if (count($mail_admin) > 0) {
            foreach ($mail_admin as $value) {
                if (Settings::get("grr_mail_Bcc") == "y") {
                    $mail->AddBCC($value);
                } else {
                    $mail->AddAddress($value);
                }
            }
            $mail->Subject = $sujet;
            $mail->Body = $message;
            $mail->AddReplyTo($repondre);
            if (!$mail->Send()) {
                $message_erreur .= $mail->ErrorInfo;
            }
        }
        $mail->ClearAddresses();
        $mail->ClearBCCs();
        $mail->ClearReplyTos();
    }
    if ($action == 7) {
        $sujet7 = $vocab["subject_mail1"] . $room_name . " - " . $date_avis;
        $sujet7 .= $vocab["subject_mail_retard"];
        $message7 = removeMailUnicode(Settings::get("company")) . " - " . $vocab["title_mail"];
        $message7 .= traite_grr_url("", "y") . "\n\n";
        $message7 .= $vocab["ressource empruntee non restituée"] . "\n";
        $message7 .= $room_name . " (" . $area_name . ")";
        $message7 .= "\n" . $reservation;
        $message7 = html_entity_decode($message7);
        $destinataire7 = $beneficiaire_email;
        $repondre7 = Settings::get("webmaster_email");
开发者ID:JeromeDevome,项目名称:GRR,代码行数:67,代码来源:functions.inc.php

示例12: transport_email_build_mailer

/**
 * Returns a PHPMailer with everything set except the recipients
 *
 * $pMessage['subject'] - The subject
 * $pMessage['message'] - The HTML body of the message
 * $pMessage['alt_message'] - The Non HTML body of the message
 */
function transport_email_build_mailer($pMessage)
{
    global $gBitSystem, $gBitLanguage;
    require_once UTIL_PKG_PATH . 'phpmailer/class.phpmailer.php';
    $mailer = new PHPMailer();
    $mailer->From = !empty($pMessage['from']) ? $pMessage['from'] : $gBitSystem->getConfig('bitmailer_sender_email', $gBitSystem->getConfig('site_sender_email', $_SERVER['SERVER_ADMIN']));
    $mailer->FromName = !empty($pMessage['from_name']) ? $pMessage['from_name'] : $gBitSystem->getConfig('bitmailer_from', $gBitSystem->getConfig('site_title'));
    if (!empty($pMessage['sender'])) {
        $mailer->Sender = $pMessage['sender'];
    }
    $mailer->Host = $gBitSystem->getConfig('bitmailer_servers', $gBitSystem->getConfig('kernel_server_name', '127.0.0.1'));
    $mailer->Mailer = $gBitSystem->getConfig('bitmailer_protocol', 'smtp');
    // Alternative to IsSMTP()
    $mailer->CharSet = 'UTF-8';
    if ($gBitSystem->getConfig('bitmailer_ssl') == 'y') {
        $mailer->SMTPSecurity = "ssl";
        // secure transfer enabled
        $mailer->Port = $gBitSystem->getConfig('bitmailer_port', '25');
    }
    if ($gBitSystem->getConfig('bitmailer_smtp_username')) {
        $mailer->SMTPAuth = TRUE;
        $mailer->Username = $gBitSystem->getConfig('bitmailer_smtp_username');
    }
    if ($gBitSystem->getConfig('bitmailer_smtp_password')) {
        $mailer->Password = $gBitSystem->getConfig('bitmailer_smtp_password');
    }
    $mailer->WordWrap = $gBitSystem->getConfig('bitmailer_word_wrap', 75);
    if (!$mailer->SetLanguage($gBitLanguage->getLanguage(), UTIL_PKG_PATH . 'phpmailer/language/')) {
        $mailer->SetLanguage('en');
    }
    if (!empty($pMessage['x_headers']) && is_array($pMessage['x_headers'])) {
        foreach ($pMessage['x_headers'] as $name => $value) {
            /* Not sure what this is intended to do
            			   but nothing seems to use it yet but boards
            			   that I am hacking on now. 29-11-08
            			   XOXO - Nick
            			if( !$mailer->set( $name, $value ) ) {
            				$mailer->$name = $value;
            				bit_error_log( $mailer->ErrorInfo );
            			}
            			*/
            $mailer->AddCustomHeader($name . ":" . $value);
        }
    }
    $mailer->ClearReplyTos();
    $mailer->AddReplyTo(!empty($pMessage['replyto']) ? $pMessage['replyto'] : $gBitSystem->getConfig('bitmailer_replyto_email', $gBitSystem->getConfig('bitmailer_sender_email')));
    if (empty($pMessage['subject'])) {
        $mailer->Subject = $gBitSystem->getConfig('site_title', '') . (empty($pMessage['package']) ? '' : " : " . $pMessage['package']) . (empty($pMessage['type']) ? '' : " : " . $pMessage['type']);
    } else {
        $mailer->Subject = $pMessage['subject'];
    }
    if (!empty($pMessage['message'])) {
        $mailer->Body = $pMessage['message'];
        $mailer->IsHTML(TRUE);
        if (!empty($pMessage['alt_message'])) {
            $mailer->AltBody = $pMessage['alt_message'];
        } else {
            $mailer->AltBody = '';
        }
    } elseif (!empty($pMessage['alt_message'])) {
        // although plain text, use Body so that clients reading html by default see the msg. header is correctly set as text/plain
        $mailer->Body = $pMessage['alt_message'];
        $mailer->IsHTML(FALSE);
    }
    return $mailer;
}
开发者ID:bitweaver,项目名称:switchboard,代码行数:73,代码来源:transport.php

示例13: transferHeaders

 /**
  * Transfers the email headers to PHPMailer.
  *
  * @access protected
  * @param PHPMailer $mailer
  * @throws MailerException
  * @throws phpmailerException
  */
 protected function transferHeaders(PHPMailer &$mailer)
 {
     // will throw an exception if an error occurs; will let it bubble up
     $headers = $this->headers->packageHeaders();
     foreach ($headers as $key => $value) {
         switch ($key) {
             case EmailHeaders::From:
                 if (!empty($value[1])) {
                     // perform character set and HTML character translations on the From name
                     $value[1] = $this->formatter->translateCharacters($value[1], $this->config->getLocale(), $this->config->getCharset());
                 }
                 // set PHPMailer's From so that PHPMailer can correctly construct the From header at send time
                 try {
                     $mailer->SetFrom($value[0], $value[1]);
                 } catch (Exception $e) {
                     throw new MailerException("Failed to add the " . EmailHeaders::From . " header: " . $e->getMessage(), MailerException::FailedToTransferHeaders);
                 }
                 break;
             case EmailHeaders::ReplyTo:
                 // only allow PHPMailer to automatically set the Reply-To if this header isn't provided
                 // so clear PHPMailer's Reply-To array if this header is provided
                 $mailer->ClearReplyTos();
                 if (!empty($value[1])) {
                     // perform character set and HTML character translations on the Reply-To name
                     $value[1] = $this->formatter->translateCharacters($value[1], $this->config->getLocale(), $this->config->getCharset());
                 }
                 // set PHPMailer's ReplyTo so that PHPMailer can correctly construct the Reply-To header at send
                 // time
                 try {
                     // PHPMailer's AddReplyTo could return true or false or allow an exception to bubble up. We
                     // want the same behavior to be applied for both false and on error, so throw a
                     // phpMailerException on failure.
                     if (!$mailer->AddReplyTo($value[0], $value[1])) {
                         // doesn't matter what the message is since we're going to eat phpmailerExceptions
                         throw new phpmailerException();
                     }
                 } catch (Exception $e) {
                     throw new MailerException("Failed to add the " . EmailHeaders::ReplyTo . " header: " . $e->getMessage(), MailerException::FailedToTransferHeaders);
                 }
                 break;
             case EmailHeaders::Sender:
                 // set PHPMailer's Sender so that PHPMailer can correctly construct the Sender header at send time
                 $mailer->Sender = $value;
                 break;
             case EmailHeaders::MessageId:
                 // set PHPMailer's MessageId so that PHPMailer can correctly construct the Message-ID header at
                 // send time
                 $mailer->MessageID = $value;
                 break;
             case EmailHeaders::Priority:
                 // set PHPMailer's Priority so that PHPMailer can correctly construct the Priority header at send
                 // time
                 $mailer->Priority = $value;
                 break;
             case EmailHeaders::DispositionNotificationTo:
                 // set PHPMailer's ConfirmReadingTo so that PHPMailer can correctly construct the
                 // Disposition-Notification-To header at send time
                 $mailer->ConfirmReadingTo = $value;
                 break;
             case EmailHeaders::Subject:
                 // perform character set and HTML character translations on the subject
                 $value = $this->formatter->translateCharacters($value, $this->config->getLocale(), $this->config->getCharset());
                 // set PHPMailer's Subject so that PHPMailer can correctly construct the Subject header at send time
                 $mailer->Subject = $value;
                 break;
             default:
                 // it's not known, so it must be a custom header; add it to PHPMailer's custom headers array
                 //TODO: any need for charset translations for from_html on the value?
                 $mailer->AddCustomHeader($key, $value);
                 break;
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:81,代码来源:SmtpMailer.php

示例14: sendMail

 public function sendMail()
 {
     /** 载入邮件组件 */
     require_once $this->_dir . '/lib/class.phpmailer.php';
     $mailer = new PHPMailer();
     $mailer->CharSet = 'UTF-8';
     $mailer->Encoding = 'base64';
     //选择发信模式
     switch ($this->_cfg->mode) {
         case 'mail':
             break;
         case 'sendmail':
             $mailer->IsSendmail();
             break;
         case 'smtp':
             $mailer->IsSMTP();
             if (in_array('validate', $this->_cfg->validate)) {
                 $mailer->SMTPAuth = true;
             }
             if (in_array('ssl', $this->_cfg->validate)) {
                 $mailer->SMTPSecure = "ssl";
             }
             $mailer->Host = $this->_cfg->host;
             $mailer->Port = $this->_cfg->port;
             $mailer->Username = $this->_cfg->user;
             $mailer->Password = $this->_cfg->pass;
             break;
     }
     $mailer->SetFrom($this->_email->from, $this->_email->fromName);
     $mailer->AddReplyTo($this->_email->to, $this->_email->toName);
     $mailer->Subject = $this->_email->subject;
     $mailer->AltBody = $this->_email->altBody;
     $mailer->MsgHTML($this->_email->msgHtml);
     $mailer->AddAddress($this->_email->to, $this->_email->toName);
     if ($result = $mailer->Send()) {
         $this->mailLog();
     } else {
         $this->mailLog(false, $mailer->ErrorInfo . "\r\n");
         $result = $mailer->ErrorInfo;
     }
     $mailer->ClearAddresses();
     $mailer->ClearReplyTos();
     return $result;
 }
开发者ID:wujunze,项目名称:wujunze.com,代码行数:44,代码来源:Action.php

示例15: osc_sendMail

function osc_sendMail($params)
{
    // DO NOT send mail if it's a demo
    if (defined('DEMO')) {
        return false;
    }
    $mail = new PHPMailer(true);
    $mail->ClearAddresses();
    $mail->ClearAllRecipients();
    $mail->ClearAttachments();
    $mail->ClearBCCs();
    $mail->ClearCCs();
    $mail->ClearCustomHeaders();
    $mail->ClearReplyTos();
    $mail = osc_apply_filter('init_send_mail', $mail, $params);
    if (osc_mailserver_pop()) {
        require_once osc_lib_path() . 'phpmailer/class.pop3.php';
        $pop = new POP3();
        $pop3_host = osc_mailserver_host();
        if (array_key_exists('host', $params)) {
            $pop3_host = $params['host'];
        }
        $pop3_port = osc_mailserver_port();
        if (array_key_exists('port', $params)) {
            $pop3_port = $params['port'];
        }
        $pop3_username = osc_mailserver_username();
        if (array_key_exists('username', $params)) {
            $pop3_username = $params['username'];
        }
        $pop3_password = osc_mailserver_password();
        if (array_key_exists('password', $params)) {
            $pop3_password = $params['password'];
        }
        $pop->Authorise($pop3_host, $pop3_port, 30, $pop3_username, $pop3_password, 0);
    }
    if (osc_mailserver_auth()) {
        $mail->IsSMTP();
        $mail->SMTPAuth = true;
    } else {
        if (osc_mailserver_pop()) {
            $mail->IsSMTP();
        }
    }
    $smtpSecure = osc_mailserver_ssl();
    if (array_key_exists('password', $params)) {
        $smtpSecure = $params['ssl'];
    }
    if ($smtpSecure != '') {
        $mail->SMTPSecure = $smtpSecure;
    }
    $stmpUsername = osc_mailserver_username();
    if (array_key_exists('username', $params)) {
        $stmpUsername = $params['username'];
    }
    if ($stmpUsername != '') {
        $mail->Username = $stmpUsername;
    }
    $smtpPassword = osc_mailserver_password();
    if (array_key_exists('password', $params)) {
        $smtpPassword = $params['password'];
    }
    if ($smtpPassword != '') {
        $mail->Password = $smtpPassword;
    }
    $smtpHost = osc_mailserver_host();
    if (array_key_exists('host', $params)) {
        $smtpHost = $params['host'];
    }
    if ($smtpHost != '') {
        $mail->Host = $smtpHost;
    }
    $smtpPort = osc_mailserver_port();
    if (array_key_exists('port', $params)) {
        $smtpPort = $params['port'];
    }
    if ($smtpPort != '') {
        $mail->Port = $smtpPort;
    }
    $from = osc_mailserver_mail_from();
    if (empty($from)) {
        $from = 'osclass@' . osc_get_domain();
        if (array_key_exists('from', $params)) {
            $from = $params['from'];
        }
    }
    $from_name = osc_mailserver_name_from();
    if (empty($from_name)) {
        $from_name = osc_page_title();
        if (array_key_exists('from_name', $params)) {
            $from_name = $params['from_name'];
        }
    }
    $mail->From = osc_apply_filter('mail_from', $from, $params);
    $mail->FromName = osc_apply_filter('mail_from_name', $from_name, $params);
    $to = $params['to'];
    $to_name = '';
    if (array_key_exists('to_name', $params)) {
        $to_name = $params['to_name'];
    }
//.........这里部分代码省略.........
开发者ID:naneri,项目名称:Osclass,代码行数:101,代码来源:utils.php


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