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


PHP PHPMailer::clearReplyTos方法代码示例

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


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

示例1: testDuplicateIDNRemoved

 /**
  * Tests removal of duplicate recipients and reply-tos.
  */
 public function testDuplicateIDNRemoved()
 {
     if (!$this->Mail->idnSupported()) {
         $this->markTestSkipped('intl and/or mbstring extensions are not available');
     }
     $this->Mail->clearAllRecipients();
     $this->Mail->clearReplyTos();
     $this->Mail->CharSet = 'utf-8';
     $this->assertTrue($this->Mail->addAddress('test@françois.ch'));
     $this->assertFalse($this->Mail->addAddress('test@françois.ch'));
     $this->assertTrue($this->Mail->addAddress('test@FRANÇOIS.CH'));
     $this->assertFalse($this->Mail->addAddress('test@FRANÇOIS.CH'));
     $this->assertTrue($this->Mail->addAddress('test@xn--franois-xxa.ch'));
     $this->assertFalse($this->Mail->addAddress('test@xn--franois-xxa.ch'));
     $this->assertFalse($this->Mail->addAddress('test@XN--FRANOIS-XXA.CH'));
     $this->assertTrue($this->Mail->addReplyTo('test+replyto@françois.ch'));
     $this->assertFalse($this->Mail->addReplyTo('test+replyto@françois.ch'));
     $this->assertTrue($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH'));
     $this->assertFalse($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH'));
     $this->assertTrue($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch'));
     $this->assertFalse($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch'));
     $this->assertFalse($this->Mail->addReplyTo('test+replyto@XN--FRANOIS-XXA.CH'));
     $this->buildBody();
     $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
     // There should be only one "To" address and one "Reply-To" address.
     $this->assertEquals(1, count($this->Mail->getToAddresses()), 'Bad count of "to" recipients');
     $this->assertEquals(1, count($this->Mail->getReplyToAddresses()), 'Bad count of "reply-to" addresses');
 }
开发者ID:jbs321,项目名称:portfolio,代码行数:31,代码来源:phpmailerTest.php

示例2: send

 /**
  * Функция отправки сообщения:
  *
  * @param string $from - адрес отправителя
  * @param string|array $to - адрес(-а) получателя
  * @param string $theme - тема письма
  * @param string $body - тело письма
  * @param bool $isText - является ли тело письма текстом
  * @param array $replyTo добавляет заголовок Reply-To, формат [email => имя]
  *
  * @return bool отправилось ли письмо
  **/
 public function send($from, $to, $theme, $body, $isText = false, $replyTo = [])
 {
     $this->_mailer->clearAllRecipients();
     $this->setFrom($from);
     if (is_array($to)) {
         foreach ($to as $email) {
             $this->addAddress($email);
         }
     } else {
         $this->addAddress($to);
     }
     $this->setSubject($theme);
     if ($isText) {
         $this->_mailer->Body = $body;
         $this->_mailer->isHTML(false);
     } else {
         $this->_mailer->msgHTML($body, \Yii::app()->basePath);
     }
     if (!empty($replyTo)) {
         $this->_mailer->clearReplyTos();
         foreach ($replyTo as $email => $name) {
             $this->_mailer->addReplyTo($email, $name);
         }
     }
     try {
         return $this->_mailer->send();
     } catch (\Exception $e) {
         \Yii::log($e->__toString(), \CLogger::LEVEL_ERROR, 'mail');
         return false;
     }
 }
开发者ID:yupe,项目名称:yupe,代码行数:43,代码来源:Mail.php

示例3: testAddressing

 /**
  * Test addressing.
  */
 public function testAddressing()
 {
     $this->assertFalse($this->Mail->addAddress(''), 'Empty address accepted');
     $this->assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted');
     $this->assertFalse($this->Mail->addAddress('a@example..com'), 'Invalid address accepted');
     $this->assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed');
     $this->assertFalse($this->Mail->addAddress('a@example.com'), 'Duplicate addressing failed');
     $this->assertTrue($this->Mail->addCC('b@example.com'), 'CC addressing failed');
     $this->assertFalse($this->Mail->addCC('b@example.com'), 'CC duplicate addressing failed');
     $this->assertFalse($this->Mail->addCC('a@example.com'), 'CC duplicate addressing failed (2)');
     $this->assertTrue($this->Mail->addBCC('c@example.com'), 'BCC addressing failed');
     $this->assertFalse($this->Mail->addBCC('c@example.com'), 'BCC duplicate addressing failed');
     $this->assertFalse($this->Mail->addBCC('a@example.com'), 'BCC duplicate addressing failed (2)');
     $this->assertTrue($this->Mail->addReplyTo('a@example.com'), 'Replyto Addressing failed');
     $this->assertFalse($this->Mail->addReplyTo('a@example..com'), 'Invalid Replyto address accepted');
     $this->assertTrue($this->Mail->setFrom('a@example.com', 'some name'), 'setFrom failed');
     $this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address');
     $this->Mail->Sender = '';
     $this->Mail->setFrom('a@example.com', 'some name', true);
     $this->assertEquals($this->Mail->Sender, 'a@example.com', 'setFrom failed to set sender');
     $this->Mail->Sender = '';
     $this->Mail->setFrom('a@example.com', 'some name', false);
     $this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender');
     $this->Mail->clearCCs();
     $this->Mail->clearBCCs();
     $this->Mail->clearReplyTos();
 }
开发者ID:ahmedash95,项目名称:Lily,代码行数:30,代码来源:phpmailerTest.php

示例4: clearReplyTos

 /**
  * Clears all recipients assigned in the ReplyTo array.  Returns void.
  *
  * @return null
  */
 public function clearReplyTos()
 {
     $this->_aReplies = array();
     parent::clearReplyTos();
 }
开发者ID:JulianaSchuster,项目名称:oxid-frontend,代码行数:10,代码来源:oxemail.php

示例5: bp_email

 /**
  * Send email(s).
  *
  * @since 2.5.0
  *
  * @param BP_Email $email Email to send.
  * @return bool|WP_Error Returns true if email send, else a descriptive WP_Error.
  */
 public function bp_email(BP_Email $email)
 {
     static $phpmailer = null;
     if ($phpmailer === null) {
         if (!class_exists('PHPMailer')) {
             require_once ABSPATH . WPINC . '/class-phpmailer.php';
             require_once ABSPATH . WPINC . '/class-smtp.php';
         }
         $phpmailer = new PHPMailer(true);
     }
     /*
      * Resets.
      */
     $phpmailer->clearAllRecipients();
     $phpmailer->clearAttachments();
     $phpmailer->clearCustomHeaders();
     $phpmailer->clearReplyTos();
     $phpmailer->Sender = '';
     /*
      * Set up.
      */
     $phpmailer->IsMail();
     $phpmailer->CharSet = bp_get_option('blog_charset');
     $phpmailer->Hostname = self::get_hostname();
     /*
      * Content.
      */
     $phpmailer->Subject = $email->get_subject('replace-tokens');
     $content_plaintext = PHPMailer::normalizeBreaks($email->get_content_plaintext('replace-tokens'));
     if ($email->get('content_type') === 'html') {
         $phpmailer->msgHTML($email->get_template('add-content'), '', 'wp_strip_all_tags');
         $phpmailer->AltBody = $content_plaintext;
     } else {
         $phpmailer->IsHTML(false);
         $phpmailer->Body = $content_plaintext;
     }
     $recipient = $email->get_from();
     try {
         $phpmailer->SetFrom($recipient->get_address(), $recipient->get_name(), false);
     } catch (phpmailerException $e) {
     }
     $recipient = $email->get_reply_to();
     try {
         $phpmailer->addReplyTo($recipient->get_address(), $recipient->get_name());
     } catch (phpmailerException $e) {
     }
     $recipients = $email->get_to();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddAddress($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $recipients = $email->get_cc();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddCc($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $recipients = $email->get_bcc();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddBcc($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $headers = $email->get_headers();
     foreach ($headers as $name => $content) {
         $phpmailer->AddCustomHeader($name, $content);
     }
     /**
      * Fires after PHPMailer is initialised.
      *
      * @since 2.5.0
      *
      * @param PHPMailer $phpmailer The PHPMailer instance.
      */
     do_action('bp_phpmailer_init', $phpmailer);
     /** This filter is documented in wp-includes/pluggable.php */
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     try {
         return $phpmailer->Send();
     } catch (phpmailerException $e) {
         return new WP_Error($e->getCode(), $e->getMessage(), $email);
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:95,代码来源:class-bp-phpmailer.php

示例6: setFrom

 /**
  * Remetente
  * @param string $nome
  * @param string $email
  */
 public function setFrom($nome, $email)
 {
     $this->SMTP->SetFrom($this->SMTP->Username, $nome);
     $this->SMTP->clearReplyTos();
     $this->SMTP->AddReplyTo($email, $nome);
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:11,代码来源:SMail.class.php

示例7: send_prepared

 /**
  * Send a prepared and rendered email locally.
  *
  * @param array $email
  * @return bool
  */
 protected function send_prepared(array $email)
 {
     if (!is_email($email['to_address'])) {
         Prompt_Logging::add_error(Prompt_Enum_Error_Codes::OUTBOUND, __('Attempted to send to an invalid email address.', 'Postmatic'), compact('email'));
         return false;
     }
     $this->local_mailer->clearAllRecipients();
     $this->local_mailer->clearCustomHeaders();
     $this->local_mailer->clearReplyTos();
     $this->local_mailer->From = $email['from_address'];
     $this->local_mailer->FromName = $email['from_name'];
     $this->local_mailer->addAddress($email['to_address'], $email['to_name']);
     if (!empty($email['reply_address'])) {
         $this->local_mailer->addReplyTo($email['reply_address'], $email['reply_name']);
     }
     $unsubscribe_types = array(Prompt_Enum_Message_Types::COMMENT, Prompt_Enum_Message_Types::POST);
     if (!empty($email['reply_address']) and in_array($email['message_type'], $unsubscribe_types)) {
         $this->local_mailer->addCustomHeader('List-Unsubscribe', '<mailto:' . $email['reply_address'] . '?body=unsubscribe>');
     }
     $this->local_mailer->Subject = $email['subject'];
     $this->local_mailer->Body = $email['html_content'];
     $this->local_mailer->AltBody = $email['text_content'];
     $this->local_mailer->ContentType = Prompt_Enum_Content_Types::HTML;
     $this->local_mailer->isMail();
     $this->local_mailer->CharSet = 'UTF-8';
     try {
         $this->local_mailer->send();
     } catch (phpmailerException $e) {
         Prompt_Logging::add_error('prompt_wp_mail', __('Failed sending an email locally. Did you know Postmatic can deliver email for you?', 'Prompt_Core'), array('email' => $email, 'error_info' => $this->local_mailer->ErrorInfo));
         return false;
     }
     return true;
 }
开发者ID:postmatic,项目名称:beta-dist,代码行数:39,代码来源:wp-mailer.php


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