本文整理匯總了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;
}