當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Message::generateMessage方法代碼示例

本文整理匯總了PHP中Nette\Mail\Message::generateMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Message::generateMessage方法的具體用法?PHP Message::generateMessage怎麽用?PHP Message::generateMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Mail\Message的用法示例。


在下文中一共展示了Message::generateMessage方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: send

 /**
  * @param Mail\Message $mail
  */
 public function send(Mail\Message $mail)
 {
     $this->autoremove();
     list($sec) = explode(' ', substr(microtime(), 2));
     $this->lastFile = $this->path . date('Y-m-d_H-i-s-') . $sec . '.eml';
     file_put_contents($this->lastFile, $mail->generateMessage());
 }
開發者ID:h4kuna,項目名稱:mail-manager,代碼行數:10,代碼來源:FileMailer.php

示例2: log

 /**
  * Log mail messages to eml file
  * @param  string $type
  * @param  string $text
  * @return void
  */
 public function log($type, Nette\Mail\Message $mail)
 {
     $timestamp = date('Y-m-d H:i:s');
     $type .= '.' . time();
     $file = $this->getLogFile($type, $timestamp);
     if (file_exists($file) && filesize($file)) {
         $file = str_replace(static::LOG_EXTENSION, '.' . uniqid() . static::LOG_EXTENSION, $file);
     }
     file_put_contents($file, $mail->generateMessage());
 }
開發者ID:JakubKontra,項目名稱:mailing,代碼行數:16,代碼來源:MailLogger.php

示例3: send

 /**
  * Store mail to file.
  * @param  Message $message
  * @return int
  */
 public function send(Message $message)
 {
     $content = $message->generateMessage();
     preg_match('~Message-ID: <(?<message_id>\\w+)[^>]+>~', $content, $matches);
     $path = $this->tempDir . '/' . $this->prefix . $matches['message_id'] . '.' . self::FILE_EXTENSION;
     if (($bytes = file_put_contents($path, $content)) === FALSE) {
         throw new InvalidStateException("Unable to write email to '{$path}'.");
     }
     return $bytes;
 }
開發者ID:newPOPE,項目名稱:FileMailer,代碼行數:15,代碼來源:FileMailer.php

示例4: send

 /**
  * Store mails to files.
  * @param Message $message
  */
 public function send(Message $message)
 {
     $this->checkRequirements();
     $content = $message->generateMessage();
     preg_match('/Message-ID: <(?<message_id>\\w+)[^>]+>/', $content, $matches);
     $path = $this->tempDir . '/' . $this->prefix . $matches['message_id'];
     if ($this->extension) {
         $path .= '.' . $this->extension;
     }
     $bytes = file_put_contents($path, $content);
     if ($bytes) {
         return $bytes;
     } else {
         throw new InvalidStateException("Unable to write email to '{$path}'");
     }
 }
開發者ID:Ryby,項目名稱:Mail,代碼行數:20,代碼來源:FileMailer.php

示例5: 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

示例6: send

 /**
  * saves email to log file
  * @param Message $mail
  * @return string file name
  */
 public function send(Message $mail)
 {
     $name = $this->dir . '/' . 'email_' . microtime(TRUE) . '.eml';
     file_put_contents($name, $mail->generateMessage());
     return $name;
 }
開發者ID:b4nan,項目名稱:utils,代碼行數:11,代碼來源:FileMailer.php

示例7:

__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

示例8: 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::generateMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。