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


PHP Message::addTo方法代碼示例

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


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

示例1: addEmail

 /**
  * Add email to mail message object
  * @param string|array $email
  */
 private function addEmail($email)
 {
     if (is_array($email)) {
         $this->mail->addTo($email[0], $email[1]);
     } else {
         $this->mail->addTo($email);
     }
 }
開發者ID:xruff,項目名稱:apputils,代碼行數:12,代碼來源:Email.php

示例2: __construct

 /** @param string $template Kompletná cesta k súboru template */
 public function __construct($template, $user_profiles, $from, $id_registracia)
 {
     parent::__construct();
     $this->mail = new Message();
     $this->template = $template;
     $uf = $user_profiles->find($from);
     $this->from = $uf->users->email;
     $this->email_list = $user_profiles->emailUsersListStr($id_registracia);
     foreach (explode(",", $this->email_list) as $c) {
         $this->mail->addTo(trim($c));
     }
 }
開發者ID:petak23,項目名稱:echo-msz,代碼行數:13,代碼來源:Email.php

示例3: sendMail

 /**
  * Odesila email pres PHP nastaveni
  * @param string $from
  * @param string | array $to
  * @param string $body
  * @param string $subject
  */
 private function sendMail($from, $to, $body, $subject)
 {
     $mail = new Message();
     $mail->setFrom($from)->setSubject($subject)->setHtmlBody($body);
     if (is_array($to)) {
         foreach ($to as $toItem) {
             $mail->addTo($toItem);
         }
     } else {
         $mail->addTo($to);
     }
     $this->appMailer->send($mail);
 }
開發者ID:kysela-petr,項目名稱:generator-kysela,代碼行數:20,代碼來源:MailFactory.php

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

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

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

示例8: onFinish

 public function onFinish()
 {
     if (!count($this->messages)) {
         return;
     }
     // everything went alright
     $contents = implode(PHP_EOL, $this->messages) . PHP_EOL;
     // Only write the |$contents| to the file when this is not ran as part of a unit test.
     // Ideally we would verify that the write was successful, but there's no good fallback.
     if (!$this->isTest) {
         file_put_contents(self::ERROR_LOG, $contents, FILE_APPEND);
     }
     // Early-return if there are no failures, because there is no need to send an alert message
     // for successful service execution.
     if ($this->failures == 0) {
         return;
     }
     $configuration = Configuration::getInstance();
     // E-mail alerts can be disabled by the configuration, but force-enable them for tests.
     if (!$configuration->get('serviceLog/alerts') && !$this->isTest) {
         return;
     }
     // Compose an e-mail message for sending out an alert message. The recipients of this
     // message are defined in the main configuration file.
     $alert = new Message();
     $alert->setFrom($configuration->get('serviceLog/from'))->setSubject($configuration->get('serviceLog/subject'))->setBody($contents);
     foreach ($configuration->get('serviceLog/recipients') as $recipient) {
         $alert->addTo($recipient);
     }
     $this->mailer->send($alert);
 }
開發者ID:AnimeNL,項目名稱:anime-2016,代碼行數:31,代碼來源:ServiceLogImpl.php

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

示例10: addTo

 /**
  * @param string $email
  * @param string $name
  */
 public function addTo($email, $name = null)
 {
     try {
         $this->message->addTo($email, $name);
     } catch (\Exception $e) {
         throw new MailerException($e->getMessage());
     }
 }
開發者ID:rukzuk,項目名稱:rukzuk,代碼行數:12,代碼來源:Mailer.php

示例11: sendKontaktMail

 public function sendKontaktMail($clovekMail, $clovekName, $zprava, $spravci)
 {
     $mail = new Message();
     $mail->setFrom($this->mailerFromAddress)->setSubject('Nová zpráva z konktaktního formuláře webu SVJ Čiklova 647/3')->addReplyTo($clovekMail)->setBody($clovekName . " s emailem " . $clovekMail . " posílá následující dotaz: \n\n" . $zprava);
     foreach ($spravci as $address) {
         $mail->addTo($address);
     }
     $this->mailer->send($mail);
     return 1;
 }
開發者ID:bkralik,項目名稱:BarakIS,代碼行數:10,代碼來源:DruzstvoMailer.php

示例12: processContactForm

 /**
  * Process contact form, send message
  * @param Form
  */
 public function processContactForm(Form $form)
 {
     $values = $form->getValues(TRUE);
     $message = new Message();
     $message->addTo('myofficialemail@centrum.sk')->setFrom($values['email'])->setSubject('Zpráva z kontaktního formuláře')->setBody($values['message']);
     $mailer = new SendmailMailer();
     $mailer->send($message);
     $this->flashMessage('Zpráva byla odeslána');
     $this->redirect('this');
 }
開發者ID:xHRo,項目名稱:simpleForum,代碼行數:14,代碼來源:AdminPresenter.php

示例13: send

 /**
  * @param $to array|string
  * @param $params array
  * @param $template string
  * @return bool|string
  * @throws \Exception
  */
 public function send($to, $params, $template)
 {
     $latte = new \Latte\Engine();
     $mail = new Message();
     $mail->setFrom($this->fromEmail)->setHtmlBody($latte->renderToString($this->templateDir . '/' . $template, $params));
     if (!empty($this->archiveEmail)) {
         $mail->addBcc($this->archiveEmail);
     }
     if (is_string($to)) {
         $mail->addTo($to);
     } elseif (is_array($to) && count($to) > 0) {
         $mail->addTo($to[0]);
         for ($i = 1; $i < count($to); $i++) {
             $mail->addCc($to[$i]);
         }
     } else {
         return "Bad 'to' parameter";
     }
     $this->mailer->send($mail);
     return true;
 }
開發者ID:gritbox,項目名稱:gritbox,代碼行數:28,代碼來源:EmailService.php

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

示例15: processForm

 /**
  * @param UI\Form $form
  */
 public function processForm(UI\Form $form)
 {
     $values = $form->getValues();
     $template = $this->createTemplate();
     $mail = new Message();
     $template->setFile(__DIR__ . '/../presenters/templates/Emails/contactForm.latte');
     $mail->addTo($this->settings['adminMail'])->setFrom($values['email']);
     $template->title = 'Zpráva z kontaktního formuláře';
     $template->values = $values;
     $mail->setHtmlBody($template);
     $this->mailer->send($mail);
     $this->flashMessage('Zpráva byla odeslána');
     $this->presenter->redirect('Pages:view', ['id' => $this->settings['thanksPage']]);
 }
開發者ID:svatekr,項目名稱:rsrs,代碼行數:17,代碼來源:ContactControl.php


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