本文整理汇总了PHP中Nette\Mail\Message类的典型用法代码示例。如果您正苦于以下问题:PHP Message类的具体用法?PHP Message怎么用?PHP Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']));
}
示例2: 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());
}
示例3: 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);
}
示例4: nette
public function nette($from, $email, $subject, $content)
{
$mail = new Message();
$mail->setFrom($from)->addTo($email)->setSubject($subject)->setHtmlBody($content);
$mailer = new Nette\Mail\SmtpMailer(array('host' => getenv('NETTE_EMAIL_HOST') ?: '', 'smtp_port' => getenv('NETTE_EMAIL_PORT') ?: '25', 'username' => getenv('NETTE_EMAIL_USERNAME') ?: '', 'password' => getenv('NETTE_EMAIL_PASSWORD') ?: '', 'secure' => getenv('NETTE_EMAIL_SECURE') ?: 'ssl'));
$mailer->send($mail);
}
示例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;
}
}
示例6: prepareMessage
/**
*
* @return Message
*/
private function prepareMessage()
{
$message = new Message();
$message->setFrom($this->from, $this->fromName);
$message->setMailer($this->mailer);
return $message;
}
示例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();
}
示例8: 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;
}
示例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');
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: sendEmail
public function sendEmail($from, $to, $template)
{
$mail = new Message();
$mail->setFrom($from)->addTo($to)->setSubject($template->subject)->setHtmlBody($template->body);
// dump($from); dump($to); dump($template); exit;
$mailer = new SendmailMailer();
$mailer->send($mail);
}
示例14: notifyByEmail
/**
* @param int $id
*/
public function notifyByEmail($id)
{
$ne = $this->getNotifyEmailById($id);
$mail = new Message();
$mail->setFrom("Wifimapa <info@wifimapa.cz>")->addTo($ne["email"])->setSubject('Potvrzení získání dat')->setBody("Dobrý den,\ndata o která jste požádal byla získána do databáze.");
$mailer = new SendmailMailer();
$mailer->send($mail);
}
示例15: sendBootstrap
/**
* @param string $email address
* @param string $name
* @throws Exception
*/
public function sendBootstrap($email, $name)
{
$msg = new Message();
$latte = new Engine();
$args = ['email' => $msg];
$html = $latte->renderToString($this->getTemplatePath('bootstrap'), $args);
$msg->setFrom('foo@bar.dev', 'Application Name')->addTo($email, $name)->setHtmlBody($html);
$this->mailer->send($msg);
}