本文整理汇总了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);
}