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


PHP Message::setTo方法代码示例

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


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

示例1: send

 public function send($fromAddress, $fromName, $replyToAddress, $replyToName, $toAddress, $toName, $subject, array $mimeParts)
 {
     $mail = new Message();
     if ($fromAddress && $fromName) {
         $mail->setFrom($fromAddress, $fromName);
     } else {
         if ($fromAddress) {
             $mail->setFrom($fromAddress);
         }
     }
     if ($replyToAddress && $replyToName) {
         $mail->setReplyTo($replyToAddress, $replyToName);
     } else {
         if ($replyToAddress) {
             $mail->setReplyTo($replyToAddress);
         }
     }
     if ($toAddress && $toName) {
         $mail->setTo($toAddress, $toName);
     } else {
         if ($toAddress) {
             $mail->setTo($toAddress);
         }
     }
     $mail->setSubject($subject);
     $mail->setEncoding('utf-8');
     $mime = new MimeMessage();
     $mime->setParts($mimeParts);
     $mail->setBody($mime);
     $this->mailTransport->send($mail);
     $this->getEventManager()->trigger('send', $mail);
 }
开发者ID:Mendim,项目名称:ep3-bs,代码行数:32,代码来源:MailService.php

示例2: sendMail

 /**
  * @param string $subject
  * @param string $message
  * @param null|string|array $to
  * @param null|string|array $cc
  * @param null|string|array $bcc
  * @return array
  */
 public function sendMail($subject, $message, $to = null, $cc = null, $bcc = null)
 {
     $return = array('success' => true, 'msg' => null);
     $partBody = new MimePart($this->getPartHeader() . $message . $this->getPartFooter());
     $partBody->type = Mime::TYPE_HTML;
     $partBody->charset = 'utf-8';
     $this->body->setParts(array($partBody));
     $subject = '[' . APPLICATION_NAME . '] ' . $subject;
     $mail = new Message();
     $mail->addFrom(self::FROM);
     $mail->setSubject($subject);
     $mail->setBody($this->body);
     $mail->setTo($to);
     if ($cc) {
         $mail->setCc($cc);
     }
     if ($bcc) {
         $mail->setBcc($bcc);
     }
     try {
         $this->transport->send($mail);
     } catch (\Exception $e) {
         $return['success'] = false;
         $return['msg'] = _('mail.message.not_sent');
         //throw new \Exception($e->getMessage(), $e->getCode());
     }
     return $return;
 }
开发者ID:baptcomet,项目名称:weprono,代码行数:36,代码来源:Mailer.php

示例3: sendEmail

 public function sendEmail($from, $to, $cc, $subject, $body, $attachmentFilename)
 {
     $message = new Message();
     $message->setFrom($from);
     $message->setTo($to);
     $message->setCc($cc);
     $message->setSubject($subject);
     $mimeMessage = new \Zend\Mime\Message();
     $part = new \Zend\Mime\Part($body);
     $part->setType(Mime::TYPE_TEXT);
     $part->setCharset('UTF-8');
     $mimeMessage->addPart($part);
     $part = new \Zend\Mime\Part('<p>' . $body . '<p>');
     $part->setType(Mime::TYPE_HTML);
     $part->setCharset('UTF-8');
     $mimeMessage->addPart($part);
     $part = new \Zend\Mime\Part($body);
     $part->setType(Mime::TYPE_OCTETSTREAM);
     $part->setEncoding(Mime::ENCODING_BASE64);
     $part->setFileName($attachmentFilename);
     $part->setDisposition(Mime::DISPOSITION_ATTACHMENT);
     $mimeMessage->addPart($part);
     $message->setBody($mimeMessage);
     $this->transport->send($message);
     $this->debugSection('ZendMailer', $subject . ' ' . $from . ' -> ' . $to);
 }
开发者ID:johnatannvmd,项目名称:codeception-mailchecker-module,代码行数:26,代码来源:ZendMailerHelper.php

示例4: setRecipient

 /**
  * Set email recipient
  *
  * @param array $variables
  * @return Mailer
  */
 public function setRecipient($email, $name)
 {
     if ($this->message) {
         $this->message->setTo($email, $name);
     }
     return $this;
 }
开发者ID:ralfeggert,项目名称:travello-lib,代码行数:13,代码来源:AbstractMailer.php

示例5: send

 /**
  * @param \Zend\Mail\Message $message
  * @param string $toEmail
  *
  * @return string
  */
 public function send($message, $toEmail)
 {
     if (YII_ENV == 'test' || mb_strpos($toEmail, '@example.org') !== false) {
         return Email::STATUS_SKIPPED_OTHER;
     }
     $message->setTo($toEmail);
     $transport = $this->getTransport();
     $transport->send($message);
     return Email::STATUS_SENT;
 }
开发者ID:CatoTH,项目名称:Stadtratsantraege,代码行数:16,代码来源:Mailgun.php

示例6: sendInvoiceWithParams

 public function sendInvoiceWithParams(Invoice $invoice, Parameters $data)
 {
     $message = new Message();
     $message->setTo($data->to);
     $message->setFrom($data->from);
     $message->setSubject($data->header);
     $message->setBody($data->content);
     $parts[] = $this->getAttachment($data->file, $data->fileName);
     $this->send($data->transport, $message, $parts);
 }
开发者ID:kristjanAnd,项目名称:SimpleIV,代码行数:10,代码来源:MailService.php

示例7: sendMail

 public function sendMail($from, $name, $message)
 {
     $mail = new Message();
     $mail->setBody($message);
     $mail->setFrom($from, $name);
     $mail->setTo(self::EMAIL_ADMIN, 'Their name');
     $mail->setSubject('Test Subject');
     //Todo config le smtp
     //        $transport = new Transport\Sendmail();
     //        $transport->send($mail);
 }
开发者ID:hpiso,项目名称:blog-zend,代码行数:11,代码来源:Mail.php

示例8: getMessage

 /**
  * @param  string  $tpl
  * @param  array   $data
  * @return Message
  */
 public function getMessage($tpl, array $data)
 {
     $mail = new Message();
     $mail->setEncoding('UTF-8');
     if (isset($data['encoding'])) {
         $mail->setEncoding($data['encoding']);
     }
     if (isset($data['from_address'])) {
         if (isset($data['from_name'])) {
             $mail->setFrom($data['from_address'], $data['from_name']);
         } else {
             $mail->setFrom($data['from_address']);
         }
     }
     if (isset($data['to'])) {
         if (isset($data['to_name'])) {
             $mail->setTo($data['to'], $data['to_name']);
         } else {
             $mail->setTo($data['to']);
         }
     }
     if (isset($data['cc'])) {
         $mail->setCc($data['cc']);
     }
     if (isset($data['bcc'])) {
         $mail->setBcc($data['bcc']);
     }
     if (isset($data['subject'])) {
         $mail->setSubject($data['subject']);
     }
     if (isset($data['sender'])) {
         $mail->setSender($data['sender']);
     }
     if (isset($data['replyTo'])) {
         $mail->setReplyTo($data['replyTo']);
     }
     $content = $this->renderMail($tpl, $data);
     $mail->setBody($content);
     $mail->getHeaders()->addHeaderLine('Content-Type', 'text/html; charset=UTF-8')->addHeaderLine('Content-Transfer-Encoding', '8bit');
     return $mail;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:46,代码来源:Email.php

示例9: sendMessage

 protected function sendMessage($to, $from, $subject, Mime\Message $body, $headers = false)
 {
     $message = new Mail\Message();
     $message->setTo($to);
     $message->setFrom($from);
     $message->setSubject($subject);
     $message->setBody($body);
     if ($headers) {
         $message->getHeaders()->addHeaders($headers);
     }
     return $this->client->sendRawEmail(array('Source' => $from, 'Destinations' => array($to), 'RawMessage' => array('Data' => $this->getMessageText($message))));
 }
开发者ID:owindsor,项目名称:silverstripe-ses,代码行数:12,代码来源:SESMailer.php

示例10: createMessage

 /**
  * @param ZendMailInterface $mail
  *
  * @return Mail\Message
  */
 protected function createMessage(ZendMailInterface $mail)
 {
     $message = new Mail\Message();
     $message->getHeaders()->addHeaders($mail->getHeaders());
     $message->setTo($mail->getTo());
     $message->setCc($mail->getCc());
     $message->setBcc($mail->getBcc());
     $message->setFrom($mail->getFrom());
     $message->setReplyTo($mail->getReplyTo());
     $message->setSubject($mail->getSubject());
     $message->setBody($this->messageCreator->createMessage($mail));
     return $message;
 }
开发者ID:phpro,项目名称:zf-mail-manager,代码行数:18,代码来源:ZendMailAdapter.php

示例11: sendVerificationEmailMessage

 public function sendVerificationEmailMessage(Model $record)
 {
     $fromAddress = $this->getEmailMessageOptions()->getEmailFromAddress();
     $subject = $this->getEmailMessageOptions()->getVerificationEmailSubjectLine();
     $message = new EmailMessage();
     $message->setFrom($fromAddress);
     $message->setTo($record->getEmailAddress());
     $message->setSubject($subject);
     $viewModel = new ViewModel(array('record' => $record));
     $viewModel->setTerminal(true)->setTemplate('cdli-twostagesignup/email/verification');
     $message->setBody($this->emailRenderer->render($viewModel));
     $this->emailTransport->send($message);
 }
开发者ID:cdli,项目名称:cdlitwostagesignup,代码行数:13,代码来源:EmailVerification.php

示例12: send

 public function send($template, $subject, $recipients, $model)
 {
     $content = $this->renderer->render("email/{$template}", $model);
     $html = new MimePart($content);
     $html->type = "text/html";
     $body = new MimeMessage();
     $body->setParts([$html]);
     $mail = new Message();
     $mail->setBody($body);
     $mail->setFrom($this->from);
     $mail->setTo($recipients);
     $mail->setSubject($subject);
     $this->transport->send($mail);
 }
开发者ID:jingjangjung,项目名称:webapp-template,代码行数:14,代码来源:Mail.php

示例13: contruirCorreo

 public function contruirCorreo(array $param = null)
 {
     $mail = new Mail\Message();
     $mail->setTo('jgbpqek@gmail.com', 'Jeisson');
     //de
     $mail->addFrom('jgb_17@hotmail.com');
     //para
     $mail->setSubject('Clave ingreso');
     //asunto
     $cfg = array('ssl' => 'tls', 'username' => 'jgbpqek@gmail.com', 'password' => 'JeissonB_1989');
     $smtpOption = new Mail\Transport\SmtpOptions();
     $smtpOption->setHost('smtp.gmail.com')->setConnectionClass('login')->setName('smtp.gmail.com')->setConnectionConfig($cfg);
     $smtp = new Mail\Transport\Smtp($smtpOption);
     $smtp->send($mail);
 }
开发者ID:nathalysalamanca,项目名称:Observatorio,代码行数:15,代码来源:SendMail.php

示例14: send

 public function send()
 {
     $this->logger->log(Logger::INFO, "Sending email to: " . implode(",", $this->recipients));
     try {
         $message = new Message();
         $message->setTo($this->recipients);
         $message->setFrom('cf8qde01@gmail.com', "XML generator");
         $message->setSubject('The Night Life XML');
         $message->setBody($this->prepareMimeMessage());
         $this->transport->send($message);
         return true;
     } catch (\Exception $e) {
         $this->logger->log(Logger::ALERT, "Sending email error: " . $e->getMessage());
         return false;
     }
 }
开发者ID:vagovszky,项目名称:nightlife,代码行数:16,代码来源:Mailer.php

示例15: sendMail

 public function sendMail($email, $fullname, $linkActive)
 {
     $message = new \Zend\Mail\Message();
     $smtpOption = new SmtpOptions($this->_config);
     $message->setFrom($this->_config['connectionConfig']['username'], "bookStoreOnline");
     $message->setTo($email, $fullname);
     $message->setSubject("Kích hoạt tài khoản");
     $message->setEncoding("utf-8");
     //set HTML
     $content = new \Zend\Mime\Part("<p>Xin chào " . $fullname . "</p> \n\t\t\t<p>Bạn vừa đăng ký tài khoản tại website BookOnline,\n\t\t\tđể hoàn thành việc đăng ký bạn cui lòng <a href='" . $linkActive . "'>Click vào đây</a>\n\t\t\tđể kích hoạt tài khoản</p>");
     $content->type = Mime::TYPE_HTML;
     $content->charset = "utf-8";
     $mimeMessage = new \Zend\Mime\Message();
     $mimeMessage->setParts(array($content));
     $message->setBody($mimeMessage);
     $transport = new \Zend\Mail\Transport\Smtp($smtpOption);
     $transport->send($message);
 }
开发者ID:trongle,项目名称:book_zend2,代码行数:18,代码来源:Mail.php


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