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


PHP Message::setSubject方法代码示例

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


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

示例1: send

 /** Funkcia pre odoslanie emailu
  * @param array $params Parametre správy
  * @param string $subjekt Subjekt emailu
  * @return string Zoznam komu bol odoslany email
  * @throws SendException
  */
 public function send($params, $subjekt)
 {
     $templ = new Latte\Engine();
     $this->mail->setFrom($params["site_name"] . ' <' . $this->from . '>');
     $this->mail->setSubject($subjekt)->setHtmlBody($templ->renderToString($this->template, $params));
     try {
         $sendmail = new SendmailMailer();
         $sendmail->send($this->mail);
         return $this->email_list;
     } catch (Exception $e) {
         throw new SendException('Došlo k chybe pri odosielaní e-mailu. Skúste neskôr znovu...' . $e->getMessage());
     }
 }
开发者ID:petak23,项目名称:echo-msz,代码行数:19,代码来源:Email.php

示例2: createMessage

 /**
  * Vytvoří novou zprávu jakožto objekt \Nette\Mail\Message.
  * @see \Nette\Mail\Message
  * @param string|array $to Příjemce zprávy. Víc příjemců může být předáno jako pole.
  * @param string $subject Předmět zprávy.
  * @param string $message Předmět zprávy, nastavuje se přes setHtmlBody, tudíž lze předat výstup šablony.
  */
 public function createMessage($to, $subject, $message)
 {
     $this->message = new \Nette\Mail\Message();
     $this->message->setFrom($this->from);
     if (is_array($to)) {
         foreach ($to as $recipient) {
             $this->message->addTo($recipient);
         }
     } else {
         $this->message->addTo($to);
     }
     $this->message->setSubject($subject);
     $this->message->setHtmlBody($message);
 }
开发者ID:JZechy,项目名称:ZBox,代码行数:21,代码来源:Mailer.php

示例3: formSucceeded

 /**
  * Callback method, that is called once form is successfully submitted, without validation errors.
  *
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     if (!($user = $this->userRepository->findOneBy(['email' => $values->email]))) {
         $form['email']->addError("User with given email doesn't exist");
         return;
     }
     // this is not a very secure way of getting new password
     // but it's the same way the symfony app is doing it...
     $newPassword = $user->generateRandomPassword();
     $this->em->flush();
     try {
         $message = new Nette\Mail\Message();
         $message->setSubject('Notejam password');
         $message->setFrom('noreply@notejamapp.com');
         $message->addTo($user->getEmail());
         // !!! Never send passwords through email !!!
         // This is only for demonstration purposes of Notejam.
         // Ideally, you can create a unique link where user can change his password
         // himself for limited amount of time, and then send the link.
         $message->setBody("Your new password is {$newPassword}");
         $this->mailer->send($message);
     } catch (Nette\Mail\SendException $e) {
         Debugger::log($e, 'email');
         $form->addError('Could not send email with new password');
     }
     $this->onSuccess($this);
 }
开发者ID:martinmayer,项目名称:notejam,代码行数:33,代码来源:ForgottenPasswordControl.php

示例4: send

 /**
  * @param string $user
  * @param string $name
  * @param string $type
  * @param string $action
  * @param mixed[] $templateArgs
  */
 public function send($user, $name, $type, $action, array $templateArgs = array())
 {
     $presenter = $this->createPresenter();
     $request = $this->getRequest($type, $action);
     $response = $presenter->run($request);
     $presenter->template->user = $user;
     $presenter->template->name = $name;
     foreach ($templateArgs as $key => $val) {
         $presenter->template->{$key} = $val;
     }
     if (!$response instanceof TextResponse) {
         throw new InvalidArgumentException(sprintf('Type \'%s\' does not exist.', $type));
     }
     try {
         $data = (string) $response->getSource();
     } catch (\Nette\Application\BadRequestException $e) {
         if (Strings::startsWith($e->getMessage(), 'Page not found. Missing template')) {
             throw new InvalidArgumentException(sprintf('Type \'%s\' does not exist.', $type));
         }
     }
     $message = new Message();
     $message->setHtmlBody($data);
     $message->setSubject(ucfirst($action));
     $message->setFrom($this->senderEmail, $this->senderName ?: null);
     $message->addTo($user, $name);
     $this->mailer->send($message);
 }
开发者ID:venne,项目名称:venne,代码行数:34,代码来源:EmailManager.php

示例5: sendMailConsumer

 public function sendMailConsumer(\PhpAmqpLib\Message\AMQPMessage $message)
 {
     $sendMail = json_decode($message->body);
     $latte = new Latte\Engine();
     $sendMail->templateArr->email = $sendMail->to;
     $sendMail->templateArr->subject = $sendMail->subject;
     if (!is_null($sendMail->unsubscribeLink)) {
         $sendMail->templateArr->unsubscribeLink = $sendMail->unsubscribeLink;
     }
     $mail = new Nette\Mail\Message();
     $mail->setFrom($sendMail->from)->addTo($sendMail->to)->setHtmlBody($latte->renderToString($this->config["appDir"] . $this->config['mailer']['templateDir'] . (is_null($sendMail->template) ? $this->config['mailer']['defaultTemplate'] : $sendMail->template), (array) $sendMail->templateArr));
     if (!is_null($sendMail->unsubscribeEmail) || !is_null($sendMail->unsubscribeLink)) {
         $mail->setHeader('List-Unsubscribe', (!is_null($sendMail->unsubscribeEmail) ? '<mailto:' . $sendMail->unsubscribeEmail . '>' : '') . (!is_null($sendMail->unsubscribeEmail) && !is_null($sendMail->unsubscribeLink) ? ", " : "") . (!is_null($sendMail->unsubscribeLink) ? '<' . $sendMail->unsubscribeLink . '>' : ''), TRUE);
     }
     $mail->setSubject($sendMail->subject);
     try {
         $mailer = $this->emailFactory->getConnection($sendMail->connection);
         $mailer->send($mail);
         dump($sendMail->to);
         if ($sendMail->imapSave) {
             $this->saveToImap($mail->generateMessage(), is_null($sendMail->imapFolder) ? $this->config['imap']['sendFolder'] : $sendMail->imapFolder, $sendMail->imapConnection);
         }
         return TRUE;
     } catch (\Exception $e) {
         return FALSE;
     }
 }
开发者ID:trejjam,项目名称:emailing,代码行数:27,代码来源:Mailer.php

示例6: formSucceeded

 /**
  * Callback for ForgottenPasswordForm onSuccess event.
  * @param Form      $form
  * @param ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     $user = $this->userManager->findByEmail($values->email);
     if (!$user) {
         $form->addError('No user with given email found');
         return;
     }
     $password = Nette\Utils\Random::generate(10);
     $this->userManager->setNewPassword($user->id, $password);
     try {
         // !!! Never send passwords through email !!!
         // This is only for demonstration purposes of Notejam.
         // Ideally, you can create a unique link where user can change his password
         // himself for limited amount of time, and then send the link.
         $mail = new Nette\Mail\Message();
         $mail->setFrom('noreply@notejamapp.com', 'Notejamapp');
         $mail->addTo($user->email);
         $mail->setSubject('New notejam password');
         $mail->setBody(sprintf('Your new password: %s', $password));
         $this->mailer->send($mail);
     } catch (Nette\Mail\SendException $e) {
         Debugger::log($e, Debugger::EXCEPTION);
         $form->addError('Could not send email with new password');
     }
 }
开发者ID:martinmayer,项目名称:notejam,代码行数:30,代码来源:ForgottenPasswordFormFactory.php

示例7: setSubject

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

示例8: mail

 /**
  * 发送邮件
  */
 public function mail()
 {
     $mail = new Message();
     $mail->addTo("690035384@qq.com");
     $mail->setSubject("hello world");
     $mailer = new \Nette\Mail\SmtpMailer(require BASE_PATH . "/config/mail.php");
     $mailer->send($mail);
 }
开发者ID:sky-L,项目名称:task,代码行数:11,代码来源:BaseAction.php

示例9: generateMessage

 public function generateMessage(Reciever $reciever, ContentConfig $contentConfig)
 {
     $message = new Message();
     $message->setFrom($this->sender->getEmail(), $this->sender->getName());
     $message->setBody($contentConfig->getContent($reciever));
     $message->setSubject($contentConfig->getSubject());
     $message->addTo($reciever->getEmail(), $reciever->getFullName());
     $message->addBcc($this->sender->getEmail());
     foreach ($contentConfig->getAttachments() as $attachment) {
         $message->addAttachment($attachment);
     }
     return $message;
 }
开发者ID:cinno,项目名称:massmailer-1,代码行数:13,代码来源:ContentPreparer.php

示例10: sendMail

 private function sendMail($values)
 {
     $mail = new Message();
     $mail->setSubject('Nová zpráva z kontaktního formuláře');
     $mail->setFrom($values['email'], $values['name']);
     $mail->addTo('feedback@zlomky-hrave.cz', 'Feedback form');
     $template = $this->createTemplate();
     $template->setFile(__DIR__ . '/templates/Mail.phtml');
     $template->name = $values['name'];
     $template->email = $values['email'];
     $template->text = $values['text'];
     $mail->setHtmlBody($template);
     $mailer = new SendmailMailer();
     $mailer->send($mail);
 }
开发者ID:amertak,项目名称:Fractions,代码行数:15,代码来源:ContactPresenter.php

示例11: sendMail

 /**
  * Send mail by calling a single method - as you often don't need more...
  *
  * @param string|array $recipients
  * @param string $subject
  * @param string $body
  * @param string|NULL $sender
  * @return void
  * @throws SendException
  */
 public function sendMail($recipients, $subject, $body, $sender = NULL)
 {
     $mail = new Message();
     if ($sender !== NULL) {
         $mail->setFrom($sender);
     }
     $mail->setSubject($subject)->setBody($body);
     if (!is_array($recipients)) {
         $recipients = [$recipients];
     }
     foreach ($recipients as $rcpt) {
         $mail->addTo($rcpt);
     }
     $mailer = $this->mailer;
     $mailer->send($mail);
 }
开发者ID:instante,项目名称:utils,代码行数:26,代码来源:MailDecorator.php

示例12: toMessage

 /**
  * @param array $templateParameters
  * @return Nette\Mail\Message
  */
 public function toMessage($templateParameters = [])
 {
     $latte = $this->latteFactory instanceof Nette\Bridges\ApplicationLatte\ILatteFactory ? $this->latteFactory->create() : new Latte\Engine();
     $latte->setLoader(new Latte\Loaders\StringLoader());
     $htmlBody = $latte->renderToString($this->template, $templateParameters);
     $mail = new Nette\Mail\Message();
     $mail->setFrom($this->from);
     $mail->setSubject($this->subject);
     $mail->setHtmlBody($htmlBody);
     if ($this->cc !== NULL) {
         foreach ($this->cc as $cc) {
             $mail->addCc($cc);
         }
     }
     if ($this->bcc !== NULL) {
         foreach ($this->bcc as $bcc) {
             $mail->addBcc($bcc);
         }
     }
     return $mail;
 }
开发者ID:zaxxx,项目名称:zaxcms,代码行数:25,代码来源:Entity.php

示例13: mailNotify

 /**
  * Notify an humean on email
  *
  * @param $subject
  * @param $message
  * @param array $data
  */
 public function mailNotify($subject, $message, $data = array())
 {
     $table = "<table>\n";
     foreach ($data as $key => $value) {
         try {
             $value = (string) $value;
         } catch (\Exception $e) {
             $value = "<i>hodnota není text</i>";
         }
         $table .= "<tr><th>{$key}</th><td>{$value}</td></tr>\n";
     }
     $table .= "</table>\n";
     $message = "<p>{$message}</p>\n\n";
     if (count($data)) {
         $message .= "<p>Tabulka dat:</p>\n{$table}";
     }
     $mail = new Nette\Mail\Message();
     $mail->setSubject($subject);
     $mail->setHtmlBody($message);
     $mail->addTo(self::NOTIFY_EMAIL_ADDRESS);
     $mailer = new Nette\Mail\SendmailMailer();
     $mailer->send($mail);
 }
开发者ID:vladimirslevercz,项目名称:sos,代码行数:30,代码来源:BasePresenter.php

示例14: setSubject

 function setSubject($args)
 {
     $this->Message->setSubject($args);
 }
开发者ID:profectsro,项目名称:mailgun-mailer,代码行数:4,代码来源:MailgunMailer.php

示例15: sendTicket

 private function sendTicket($ticket)
 {
     $event = $ticket->event;
     $message = "<p>Děkujeme o Váš zájem, zde je Vaše vstupenka, můžete si ji vytisknout nebo připravit do mobilního telefonu.</p>\n" . "<img src=\"http://hudebnisos.cz/content/ticket/" . $event->id . ".jpg\" width=\"600\" />\n" . "<p>Vaše vstupenka má originální číslo <b>" . $ticket->id . "</b>.</p><br/><br/>\n" . "<p><a href=\"http://hudebnisos.cz/event/show/" . $event->id . "\">odkaz na akci " . $event->name . "</p>\n" . "<p><a href=\"http://hudebnisos.cz/\">www.hudebnisos.cz</a></p>\n";
     $mail = new Nette\Mail\Message();
     $mail->setSubject('SOS Vstupenka - ' . $event->name);
     $mail->setHtmlBody($message);
     $mail->addTo($ticket->email);
     $mailer = new Nette\Mail\SendmailMailer();
     $mailer->send($mail);
 }
开发者ID:vladimirslevercz,项目名称:sos,代码行数:11,代码来源:EventPresenter.php


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