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


PHP Message::getHeader方法代码示例

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


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

示例1: setRecipients

 /**
  * @param \DotBlue\Mandrill\Message $message
  * @param \Nette\Mail\Message $originalMessage
  */
 private function setRecipients(\DotBlue\Mandrill\Message $message, \Nette\Mail\Message $originalMessage)
 {
     $to = $originalMessage->getHeader('To') ?: [];
     foreach ($to as $email => $name) {
         $message->addTo($email, $name);
     }
     $cc = $originalMessage->getHeader('Cc') ?: [];
     foreach ($cc as $email => $name) {
         $message->addCc($email, $name);
     }
     $bcc = $originalMessage->getHeader('Bcc') ?: [];
     foreach ($bcc as $email => $name) {
         $message->addBcc($email, $name);
     }
     $originalMessage->clearHeader('To');
     $originalMessage->clearHeader('Cc');
     $originalMessage->clearHeader('Bcc');
 }
开发者ID:dotblue,项目名称:mandrill,代码行数:22,代码来源:MessageConverter.php

示例2: send

 /**
  * Sends email.
  * @param  Message
  * @return void
  */
 public function send(Message $mail)
 {
     $data = $mail->generateMessage();
     $this->connect();
     $from = $mail->getHeader('From');
     if ($from) {
         $from = array_keys($from);
         $this->write("MAIL FROM:<{$from['0']}>", 250);
     }
     foreach (array_merge((array) $mail->getHeader('To'), (array) $mail->getHeader('Cc'), (array) $mail->getHeader('Bcc')) as $email => $name) {
         $this->write("RCPT TO:<{$email}>", array(250, 251));
     }
     $this->write('DATA', 354);
     $data = preg_replace('#^\\.#m', '..', $data);
     $this->write($data);
     $this->write('.', 250);
     $this->write('QUIT', 221);
     $this->disconnect();
 }
开发者ID:anagio,项目名称:woocommerce,代码行数:24,代码来源:SmtpMailer.php

示例3:

__construct(array$options=array()){if(isset($options['host'])){$this->host=$options['host'];$this->port=isset($options['port'])?(int)$options['port']:NULL;}else{$this->host=ini_get('SMTP');$this->port=(int)ini_get('smtp_port');}$this->username=isset($options['username'])?$options['username']:'';$this->password=isset($options['password'])?$options['password']:'';$this->secure=isset($options['secure'])?$options['secure']:'';$this->timeout=isset($options['timeout'])?(int)$options['timeout']:20;if(!$this->port){$this->port=$this->secure==='ssl'?465:25;}}function
send(Message$mail){$data=$mail->generateMessage();$this->connect();$from=$mail->getHeader('From');if($from){$from=array_keys($from);$this->write("MAIL FROM:<$from[0]>",250);}foreach(array_merge((array)$mail->getHeader('To'),(array)$mail->getHeader('Cc'),(array)$mail->getHeader('Bcc'))as$email=>$name){$this->write("RCPT TO:<$email>",array(250,251));}$this->write('DATA',354);$data=preg_replace('#^\.#m','..',$data);$this->write($data);$this->write('.',250);$this->write('QUIT',221);$this->disconnect();}private
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:2,代码来源:loader.php

示例4: send

 /**
  * Sends email.
  * @param Message $mail
  * @return void
  */
 public function send(Message $mail)
 {
     $postData = ['from' => $mail->getHeader('Return-Path') ?: key($mail->getHeader('From')), 'to' => $this->getCommaSeparatedEmails((array) $mail->getHeader('To')), 'cc' => $this->getCommaSeparatedEmails((array) $mail->getHeader('Cc')), 'bcc' => $this->getCommaSeparatedEmails((array) $mail->getHeader('Bcc')), 'subject' => $mail->getSubject(), 'text' => $mail->getBody(), 'html' => $mail->getHtmlBody()];
     $this->mailgun->sendMessage($this->domain, array_filter($postData));
 }
开发者ID:klimesf,项目名称:mailgun,代码行数:10,代码来源:MailgunMailer.php

示例5: send

 /**
  * Sends e-mail.
  *
  * Implementation of IMailer
  * @param  Message The mail to send (instance of Nette\Message)
  * @return void
  *
  * @throws InvalidStateException if something went wrong
  */
 function send(\Nette\Mail\Message $mail)
 {
     $from = $mail->getHeader('From');
     //intentionally !=
     $from = $from != NULL && !empty($from) ? array_keys($from) : NULL;
     if ($from !== NULL) {
         $this->client->setFrom($from[0]);
     }
     $to = $mail->getHeader('To');
     $cc = $mail->getHeader('Cc');
     $bcc = $mail->getHeader('Bcc');
     $mail->setHeader('Bcc', NULL);
     $recipients = array();
     //intentionally !=
     $to != NULL && !empty($to) ? $recipients = array_merge($recipients, array_keys($to)) : NULL;
     $cc != NULL && !empty($cc) ? $recipients = array_merge($recipients, array_keys($cc)) : NULL;
     $bcc != NULL && !empty($bcc) ? $recipients = array_merge($recipients, array_keys($bcc)) : NULL;
     $this->client->setRecipients($recipients);
     $this->client->setBody($mail->generateMessage());
     //throws InvalidStateException
     $this->client->send();
 }
开发者ID:NorthV,项目名称:nSMTPMailer,代码行数:31,代码来源:SmtpMailer.php


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