本文整理汇总了PHP中Illuminate\Contracts\Mail\Mailer::alwaysFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::alwaysFrom方法的具体用法?PHP Mailer::alwaysFrom怎么用?PHP Mailer::alwaysFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Mail\Mailer
的用法示例。
在下文中一共展示了Mailer::alwaysFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* Register the mailer.
*
* @return void
*/
protected function register()
{
if (!$this->app->bound('view')) {
$this->app['view'] = new ViewFactory();
}
$this->registerSwiftMailer();
$this->mailer = new Mailer($this->app['view'], $this->app['swift.mailer'], $this->app['events']);
$this->setMailerDependencies();
$from = $this->app['config']['mail.from'];
if (is_array($from) && isset($from['address'])) {
$this->mailer->alwaysFrom($from['address'], $from['name']);
}
$to = $this->app['config']['mail.to'];
if (is_array($to) && isset($to['address'])) {
$this->mailer->alwaysTo($to['address'], $to['name']);
}
}
示例2: send
/**
* send.
*
* @param string $slug
* @param array $data
* @param \Closure|string $callback
*
* @return void
*/
public function send($slug, $data, $closure)
{
$view = $this->getView($slug);
$attributes = $this->getAttributes($slug);
if (empty($attributes->from_address) === false) {
$this->mailer->alwaysFrom($attributes->from_address, $attributes->from_name);
}
$sended = $this->mailer->send($slug, $data, $closure);
return $sended;
}