本文整理汇总了PHP中Illuminate\Contracts\Mail\Mailer::queue方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::queue方法的具体用法?PHP Mailer::queue怎么用?PHP Mailer::queue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Mail\Mailer
的用法示例。
在下文中一共展示了Mailer::queue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Bus\Events\Incident\IncidentHasReportedEvent $event
*
* @return void
*/
public function handle(IncidentWasReportedEvent $event)
{
if (!$event->incident->notify) {
return false;
}
$incident = AutoPresenter::decorate($event->incident);
$component = AutoPresenter::decorate($event->incident->component);
// Only send emails for public incidents.
if ($event->incident->visible === 1) {
foreach ($this->subscriber->isVerified()->get() as $subscriber) {
$mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'has_component' => $event->incident->component ? true : false, 'component_name' => $component ? $component->name : null, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, 'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]), 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code])];
$this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}
}
示例2: sendTo
/**
* Convenience function for sending mail
*
* @param $email
* @param $subject
* @param $view
* @param array $data
*/
public function sendTo($email, $subject, $view, $data = array())
{
$sender = $this->gatherSenderAddress();
$this->mailer->queue($view, $data, function ($message) use($email, $subject, $sender) {
$message->to($email)->from($sender['address'], $sender['name'])->subject($subject);
});
}
示例3: handle
public function handle(ModuleWasSubmittedForApproval $event)
{
$module = $event->module;
$this->mailer->queue('module::emails.thank-you', compact('module'), function (Message $message) use($module) {
$message->subject('AsgardCms: Module submitted');
$message->to($module->user->email);
});
}
示例4: handle
/**
* Handle the event.
*
* @param BusinessWasFlagged $event
* @return void
*/
public function handle(BusinessWasFlagged $event)
{
$data = ['user' => $event->user, 'business' => $event->business];
$this->mailer->queue('emails.admin.business.flagged', $data, function (Message $message) {
$message->to(env('APP_EMAIL_SENDER', 'Toilets for Trans Folk'));
$message->from(env('APP_EMAIL_SENDER', 'TFTF Web App'));
});
}
示例5: notify
/**
* Send notification to subscriber.
*
* @param \CachetHQ\Cachet\Models\Component $component
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function notify(Component $component, Subscriber $subscriber)
{
$component = AutoPresenter::decorate($component);
$mail = ['subject' => trans('cachet.subscriber.email.component.subject'), 'component_name' => $component->name, 'component_human_status' => $component->human_status];
$mail['email'] = $subscriber->email;
$mail['manage_link'] = route('subscribe.manage', ['code' => $subscriber->verify_code]);
$this->mailer->queue(['html' => 'emails.components.update-html', 'text' => 'emails.components.update-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
示例6: create
public function create(SubmitWebsiteRequest $request)
{
$data = $request->all();
$this->mailer->queue('emails.website-proposal', ['data' => $data], function (Message $message) use($data) {
$message->to('n.widart@gmail.com');
$message->replyTo($data['email'], $data['name']);
$message->subject('AsgardCms: New Website Proposal');
});
return response()->json('Thank you for submitting your website! We\'ll get back to your as soon as possible .');
}
示例7: created
/**
* @param Message $message
*/
public function created(Message $message)
{
if (!app()->runningInConsole()) {
$this->mailer->queue('emails.business.message', ['msg' => $message], function (MailMessage $mail) use($message) {
if ($message->anonymous) {
$mail->from(env('APP_EMAIL_SENDER'), 'Toilets For Transfolk');
} else {
$mail->from($message->user->email, $message->user->name);
}
$mail->to($message->business->email, $message->business->name);
});
}
}
示例8: handle
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Events\IncidentHasReportedEvent $event
*/
public function handle(IncidentHasReportedEvent $event)
{
$data = $this->presenter->decorate($event->incident);
// Only send emails for public incidents.
if ($event->incident->visible === 1) {
foreach ($this->subscriber->all() as $subscriber) {
$mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'status' => $data->humanStatus, 'htmlContent' => $data->formattedMessage, 'textContent' => $data->message, 'token' => $subscriber->token, 'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->verify_code]), 'appUrl' => env('APP_URL')];
$this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}
}
示例9: send
/**
* Base send method
*
* @param $to
* @param $subject
* @param $view
* @param array $data
* @param array|null $cc
* @param array|null $bcc
*
* @return mixed
*/
public function send($to, $subject, $view, $data = [], $cc = [], $bcc = [])
{
return $this->mailer->queue($view, $data, function ($m) use($to, $subject, $cc, $bcc) {
$m->to($to);
if ($cc) {
$m->cc($cc);
}
if ($bcc) {
$m->bcc($bcc);
}
$m->subject(sprintf("[%s] %s", config('project.name'), $subject));
});
}
示例10: handle
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent $event
*
* @return void
*/
public function handle(ComponentWasUpdatedEvent $event)
{
$component = AutoPresenter::decorate($event->component);
$mail = ['subject' => trans('cachet.subscriber.email.component.subject'), 'component_name' => $component->name, 'component_human_status' => $component->human_status];
foreach (Subscription::isVerifiedForComponent($component->id)->with('subscriber')->get() as $subscription) {
$subscriber = $subscription->subscriber;
$mail['email'] = $subscriber->email;
$mail['unsubscribe_link'] = route('subscribe.unsubscribe', ['code' => $subscriber->verify_code, 'subscription' => $subscription->id]);
$this->mailer->queue(['html' => 'emails.components.update-html', 'text' => 'emails.components.update-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}
示例11: handle
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Events\Incident\IncidentHasReportedEvent $event
*
* @return void
*/
public function handle(IncidentWasReportedEvent $event)
{
$incident = $this->presenter->decorate($event->incident);
$component = $this->presenter->decorate($event->incident->component);
// Only send emails for public incidents.
if ($event->incident->visible === 1) {
foreach ($this->subscriber->all() as $subscriber) {
$mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'has_component' => $event->incident->component ? true : false, 'component_name' => $component ? $component->name : null, 'status' => $incident->humanStatus, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]), 'app_url' => env('APP_URL')];
$this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}
}
示例12: handle
/**
* Handle the event.
*
* @param \Gitamin\Events\Issue\IssueHasAddedEvent $event
*
* @return void
*/
public function handle(IssueWasAddedEvent $event)
{
if (!$event->issue->notify) {
return false;
}
$issue = AutoPresenter::decorate($event->issue);
$project = AutoPresenter::decorate($event->issue->project);
// Only send emails for public issues.
if ($event->issue->visible === 1) {
foreach ($this->subscriber->all() as $subscriber) {
$mail = ['email' => $subscriber->email, 'subject' => 'New issue reported.', 'has_project' => $event->issue->project ? true : false, 'project_name' => $project ? $project->name : null, 'status' => $issue->humanStatus, 'html_content' => $issue->formattedMessage, 'text_content' => $issue->message, 'token' => $subscriber->token, 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code])];
$this->mailer->queue(['html' => 'emails.issues.new-html', 'text' => 'emails.issues.new-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}
}
示例13: notify
/**
* Send notification to subscriber.
*
* @param \CachetHQ\Cachet\Bus\Events\IncidentWasReportedEvent $event
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function notify(IncidentWasReportedEvent $event, $subscriber)
{
$incident = AutoPresenter::decorate($event->incident);
$component = AutoPresenter::decorate($event->incident->component);
$mail = ['email' => $subscriber->email, 'subject' => trans('cachet.subscriber.email.incident.subject', ['status' => $incident->human_status, 'name' => $incident->name]), 'has_component' => $event->incident->component ? true : false, 'component_name' => $component ? $component->name : null, 'name' => $incident->name, 'timestamp' => $incident->created_at_formatted, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, 'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]), 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code])];
$this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
示例14: emailQueueVerificationLink
/**
* Prepare and push a job onto the queue to send the e-mail with the verification token link.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string $subject
* @param string $from
* @param string $name
* @return mixed
*/
protected function emailQueueVerificationLink(AuthenticatableContract $user, $subject, $from = null, $name = null)
{
return $this->mailer->queue($this->emailView, compact('user'), function ($m) use($user, $subject, $from, $name) {
if (!empty($from)) {
$m->from($from, $name);
}
$m->to($user->email);
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
event(new VerificationEmailSent($user));
});
}
示例15: addToQueue
/**
* add mail to queue
* @param $view
* @param $data
* @param $callback
*/
protected function addToQueue($view, $data, $callback)
{
$this->mailer->queue($view, $data, $callback);
}