本文整理匯總了PHP中Nette\Mail\Message::addReplyTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Message::addReplyTo方法的具體用法?PHP Message::addReplyTo怎麽用?PHP Message::addReplyTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nette\Mail\Message
的用法示例。
在下文中一共展示了Message::addReplyTo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addReplyTo
/**
* @param string $email
* @param string $name
*/
public function addReplyTo($email, $name = null)
{
try {
$this->message->addReplyTo($email, $name);
} catch (\Exception $e) {
throw new MailerException($e->getMessage());
}
}
示例2: send
/**
* @param string $view email template
* @param User $user
* @param NULL|array $args template variables
*
* @throws Exception from Latte\Engine
* @throws SmtpException from Mailer
*/
public function send($view, User $user, array $args = [])
{
if ($this->orm->unsubscribes->getByEmail($user->email)) {
// Last line of defense. Make sure unsubscribed users
// really dont receive any email. This should however
// be handled before the task is queued.
$this->logger->addAlert("Email to '{$user->email}' not send, user unsubscribed. Find out why it was queued");
return;
}
$msg = new Message();
$msg->setFrom('Khanova škola <reply@khanovaskola.cz>');
$msg->addReplyTo('Markéta Matějíčková <marketa@khanovaskola.cz>');
$msg->addTo($user->email, $user->name);
$token = Unsubscribe::createFromUser($user);
$token->emailType = $view;
$this->orm->tokens->attach($token);
$this->orm->flush();
$args['recipient'] = $user;
$args['email'] = $msg;
$args['unsubscribe'] = (object) ['token' => $token, 'code' => $token->getUnsafe()];
$args['baseUrl'] = rtrim($this->baseUrl, '/');
$latte = new Engine();
/** @var Presenters\Token $presenter */
$presenter = $this->factory->createPresenter('Token');
$presenter->autoCanonicalize = FALSE;
$ref = new \ReflectionProperty(Presenter::class, 'globalParams');
$ref->setAccessible(TRUE);
$ref->setValue($presenter, []);
$latte->addFilter('token', function (Token $token, $unsafe) use($presenter, $view) {
return $presenter->link('//Token:', ['token' => $token->toString($unsafe), 'utm_campaign' => "email-{$view}"]);
});
$latte->addFilter('vocative', function ($phrase) {
return $this->inflection->inflect($phrase, 5);
});
$template = $latte->renderToString($this->getTemplate($view), $args);
$msg->setHtmlBody($template);
$this->mailer->send($msg);
$this->logger->addInfo('Email send', ['view' => $view, 'email' => $user->email]);
}
示例3: addReplyTo
function addReplyTo($args)
{
$this->Message->addReplyTo($args);
}