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


PHP Message::setReturnPath方法代码示例

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


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

示例1: setReturnPath

 /**
  * @param string $email
  */
 public function setReturnPath($email)
 {
     try {
         $this->message->setReturnPath($email);
     } catch (\Exception $e) {
         throw new MailerException($e->getMessage());
     }
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:11,代码来源:Mailer.php

示例2: create

 /**
  * @return Mail\Message
  */
 public function create()
 {
     $message = new Mail\Message();
     if ($this->from) {
         $message->setFrom($this->from);
     }
     if ($this->returnPath) {
         $message->setReturnPath($this->returnPath);
     }
     return $message;
 }
开发者ID:h4kuna,项目名称:mail-manager,代码行数:14,代码来源:MessageFactory.php

示例3: sendMail

 /**
  * Handle message delivery.
  *
  * @return bool
  */
 public static function sendMail()
 {
     // Allow support for legacy argument style or new style.
     $args = func_get_args();
     if (func_num_args() == 1) {
         $options = $args[0];
     } else {
         $options = array_merge(array('to' => $args[0], 'subject' => $args[1], 'message' => $args[2], 'reply_to' => $args[3], 'delivery_date' => $args[4]), $args[5]);
     }
     $di = \Phalcon\Di::getDefault();
     $config = $di->get('config');
     $mail_config = $config->application->mail->toArray();
     // Do not deliver mail on development environments.
     if (DF_APPLICATION_ENV == "development" && !defined('DF_FORCE_EMAIL')) {
         $email_to = $mail_config['from_addr'];
         if (!empty($email_to)) {
             $options['to'] = $email_to;
         } else {
             return false;
         }
     }
     if (isset($mail_config['use_smtp']) && $mail_config['use_smtp']) {
         $smtp_config = $config->apis->smtp->toArray();
         $smtp_config['host'] = $smtp_config['server'];
         unset($smtp_config['server']);
         $transport = new SmtpMailer($smtp_config);
     } else {
         $transport = new SendmailMailer();
     }
     if (!is_array($options['to'])) {
         $options['to'] = array($options['to']);
     } else {
         $options['to'] = array_unique($options['to']);
     }
     foreach ((array) $options['to'] as $mail_to_addr) {
         if (empty($mail_to_addr)) {
             continue;
         }
         $mail_to_addr = str_replace('mailto:', '', $mail_to_addr);
         $mail = new Message();
         $mail->setSubject($options['subject']);
         $from_addr = isset($options['from']) ? $options['from'] : $mail_config['from_addr'];
         $from_name = isset($options['from_name']) ? $options['from_name'] : $mail_config['from_name'];
         $mail->setFrom($from_addr, $from_name);
         if (isset($mail_config['bounce_addr'])) {
             $mail->setReturnPath($mail_config['bounce_addr']);
         }
         /*
         // Include a specific "Direct replies to" header if specified.
         if ($options['reply_to'] && $validator->isValid($options['reply_to']))
             $mail->setReplyTo($options['reply_to']);
         else if (isset($mail_config['reply_to']) && $mail_config['reply_to'])
             $mail->setReplyTo($mail_config['reply_to']);
         */
         // Change the type of the e-mail's body if specified in the options.
         if (isset($options['text_only']) && $options['text_only']) {
             $mail->setBody(strip_tags($options['message']));
         } else {
             $mail->setHtmlBody($options['message'], false);
         }
         // Add attachment if specified in options.
         if (isset($options['attachments'])) {
             foreach ((array) $options['attachments'] as $attachment) {
                 $mail->addAttachment($attachment);
             }
         }
         /*
         // Modify the mail type if specified.
         if (isset($options['type']))
             $mail->setType($options['type']);
         */
         // Catch invalid e-mails.
         try {
             $mail->addTo($mail_to_addr);
         } catch (\Nette\Utils\AssertionException $e) {
             continue;
         }
         $transport->send($mail);
     }
     return true;
 }
开发者ID:Lavoaster,项目名称:PVLive,代码行数:86,代码来源:Messenger.php


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