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


PHP Message::setFrom方法代码示例

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


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

示例1: composeMail

 private function composeMail($from, $to, $subject)
 {
     $this->mail = new Message();
     $this->mail->setFrom($from)->setSubject($subject);
     $this->processFromEmail($from)->processToEmail($to);
     return $this->mail;
 }
开发者ID:xruff,项目名称:apputils,代码行数:7,代码来源:Email.php

示例2: setFrom

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

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

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

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

示例7: sendMail

 public function sendMail($formValues)
 {
     //        dump($formValues);
     //        die();
     //
     $template = new Nette\Templating\FileTemplate(__DIR__ . '/emailTemplates/' . $this->templateFilename);
     $template->registerFilter(new Nette\Latte\Engine());
     $template->registerHelperLoader('Nette\\Templating\\Helpers::loader');
     $attachments = array();
     if (isset($formValues['cv']) && $formValues['cv'] instanceof Nette\Http\FileUpload) {
         if ($formValues['cv']->isOk()) {
             $attachments[$formValues['cv']->getName()] = $formValues['cv']->getContents();
         }
     }
     unset($formValues['cv']);
     $template->values = $formValues;
     //        echo $template;
     //        die();
     $mail = new \Nette\Mail\Message();
     $mail->setFrom($this->from)->setSubject($this->subject)->addTo($this->to)->setHtmlBody($template);
     if ($attachments) {
         foreach ($attachments as $name => $content) {
             $mail->addAttachment($name, $content);
         }
     }
     //        foreach ($tos as $to) {
     //            $mail->addTo($to);
     //        }
     $mail->send();
 }
开发者ID:jurasm2,项目名称:bubo-sandbox,代码行数:30,代码来源:MailForm.php

示例8: prepareMessage

 /**
  *
  * @return Message 
  */
 private function prepareMessage()
 {
     $message = new Message();
     $message->setFrom($this->from, $this->fromName);
     $message->setMailer($this->mailer);
     return $message;
 }
开发者ID:bazo,项目名称:translation-ui,代码行数:11,代码来源:MailBuilder.php

示例9: orderFormSucceeded

 function orderFormSucceeded(Form $form, $values)
 {
     $user = $this->findUser();
     $order = new Order($user);
     $order->setType($values->type);
     $order->setAmount($values->amount);
     $order->setName($values->name);
     $order->setPhone($values->phone);
     $order->setBusinessName($values->business_name);
     $order->setIc($values->ic);
     $order->setDic($values->dic);
     $order->setAddress($values->address);
     $order->setInvoiceAddress($values->invoice_address);
     $order->setShippingMethod($values->shipping_method);
     $order->setNote($values->note);
     $price_index = $values->type . '.price_per_unit';
     $order->setPricePerUnit(Settings::get($price_index));
     $this->em->persist($order);
     $this->em->flush();
     $order->createNum();
     $this->em->flush();
     $this->orderManager->invoice($order, true);
     $mail = new Message();
     $mail->setFrom(Settings::get('contact.name') . ' <' . Settings::get('contact.email') . '>')->addTo($order->getUser()->getEmail())->setSubject('Your order ' . $order->getNum())->setBody('You have placed a new order on kryo.mossbauer.cz. Please follow payment instructions in attachment.');
     $mail->addAttachment(WWW_DIR . '/../temp/' . $order->getInvoiceFileName());
     $this->mailer->send($mail);
     $this->flashMessage('Order has been successfully created!', 'success');
     $this->redirect('this');
 }
开发者ID:vitush93,项目名称:kryo,代码行数:29,代码来源:HomepagePresenter.php

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

示例11: send

 /**
  * @param string $senderEmail
  * @param string $recipientEmail
  * @param callable $templateCallback
  * @param array $param
  * @throws InvalidStateException
  */
 public function send($senderEmail, $recipientEmail, callable $templateCallback, array $param = [])
 {
     $template = $this->prepareTemplate($templateCallback, $param);
     $mail = new Message();
     $mail->setFrom($senderEmail)->addTo($recipientEmail)->setHtmlBody($template);
     $this->mailer->send($mail);
 }
开发者ID:blitzik,项目名称:vycetky,代码行数:14,代码来源:EmailNotifier.php

示例12: buyFormSucceeded

 public function buyFormSucceeded(\CustomForm $form, $values)
 {
     $product = $this->context->moduleSimpleEshopModel->getProduct($this->getParameter("id"), 1);
     $this->iModuleId = $product["page_page_modules_id"];
     $this->loadModuleFromDB();
     if ($form->isValid()) {
         $values["product_id"] = $product["id"];
         $values["product_title"] = $product["title"];
         $values["page_page_modules_id"] = $product["page_page_modules_id"];
         $order = $this->db->createOrder($values);
         if (!$order) {
             $this->flashMessage('Jejda. :( Něco je špatně. Zkuste znovu nebo se s námi spojte přímo. Děkujeme za pochopení.');
         } else {
             $mail = new Message();
             $mailer = new SendmailMailer();
             $emailHTML = $this->getEmailHTML($order, $product);
             // send confirmation email to customer
             $mail->setFrom($this->module->settings->email)->addTo($order->email)->setSubject('Potvrzení o koupi.')->setHTMLBody($emailHTML);
             $mailer->send($mail);
             // send confirmation email to owner of the eshop
             $mail->setFrom($this->module->settings->email)->addTo($this->module->settings->email)->setSubject('Potvrzení o koupi.')->setHTMLBody($emailHTML);
             $mailer->send($mail);
             $this->flashMessage($this->module->settings->order_confirmation, 'success');
         }
     } else {
         $this->flashMessage('Doplňte prosím všechny povinné položky.');
     }
     $this->redirect(":" . $this->getName() . ':Product', array('id' => $product['nice_url_segment'], 'moduleid' => $product['page_page_modules_id']));
 }
开发者ID:petrparolek,项目名称:web_cms,代码行数:29,代码来源:ModuleSimpleEshopPresenter.php

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

示例14: send

 public function send($from, $to, $subject, $template)
 {
     $mail = new Message();
     $mail->setFrom($from)->addTo($to)->setSubject($subject)->setHTMLBody($template);
     $mailer = new SendmailMailer();
     $mailer->send($mail);
 }
开发者ID:jaromir92,项目名称:Sportwin,代码行数:7,代码来源:MailSender.php

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


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