本文整理汇总了PHP中Illuminate\Mail\Mailer类的典型用法代码示例。如果您正苦于以下问题:PHP Mailer类的具体用法?PHP Mailer怎么用?PHP Mailer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mailer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($this->shouldReport($e) && app()->environment() == 'local') {
$this->mailer->getSwiftMailer()->send(SwiftMessage::newInstance(null)->addTo('log@localhost')->addFrom('noreply@localhost', 'Laravel Drydock')->setBody($this->render(null, $e)->getContent())->setContentType('text/html'));
}
parent::report($e);
}
示例2: handle
/**
* Handle the command.
*
* @param Mailer $mailer
* @param SettingRepositoryInterface $settings
* @return mixed
*/
public function handle(Mailer $mailer, SettingRepositoryInterface $settings)
{
$path = $this->dispatch(new GetResetPasswordPath($this->user, $this->redirect));
return $mailer->send('anomaly.module.users::emails/reset', ['user' => $this->user, 'path' => $path], function (Message $message) use($settings) {
$message->subject('Reset your password')->to($this->user->getEmail(), $this->user->getDisplayName())->from($settings->value('streams::server_email', 'noreply@localhost'));
});
}
示例3: setMailerDependencies
/**
* Set a few dependencies on the mailer instance.
*
* @param \Illuminate\Mail\Mailer $mailer
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function setMailerDependencies($mailer, $app)
{
$mailer->setContainer($app);
if ($app->bound('queue')) {
$mailer->setQueue($app['queue']);
}
}
示例4: handle
/**
* @param Mailer $mailer
*/
public function handle(Mailer $mailer)
{
$mailer->send('emails.contact', ['user' => $this->user], function ($m) {
//
});
//$this->user->contact()->create();
}
示例5: handle
/**
* Handle the command.
*
* @param ContactFormBuilder $builder
* @param MessageBag $messages
* @param Mailer $mailer
*/
public function handle(ContactFormBuilder $builder, MessageBag $messages, Mailer $mailer)
{
// Validation failed!
if ($builder->hasFormErrors()) {
return;
}
// Delegate these for now.
$view = $this->dispatch(new GetMessageView($builder));
$data = $this->dispatch(new GetMessageData($builder));
// Build the message object.
$message = function (Message $message) use($builder) {
$this->dispatch(new BuildMessage($message, $builder));
};
// Send the email.
$mailer->send($view, $data, $message);
// If there are any failures, report.
if (count($mailer->failures()) > 0) {
$messages->error($builder->getFormOption('error_message', 'anomaly.plugin.contact::error.send_message'));
} else {
// Otherwise, show success.
$messages->success($builder->getFormOption('success_message', 'anomaly.plugin.contact::success.send_message'));
}
// Clear the form!
$builder->resetForm();
}
示例6: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mail)
{
$group = $this->ticket->group_id;
$customers = Group::where('id', $group)->first()->customers()->get();
$_customers = [];
foreach ($customers as $customer) {
$_customers[] = $customer->id;
}
$sys_name = Settings::where('name', 'sys_name')->first();
$user = User::whereIn('customer_id', $_customers)->get();
foreach ($user as $_user) {
$mail->send('emails.updateticket', ['user' => $_user, 'ticket' => $this->ticket, 'response' => $this->response, 'sys_name' => $sys_name], function ($m) use($_user) {
$m->to($_user->email, $_user->first_name . ' ' . $_user->last_name)->subject('Ticket updated - ' . $this->ticket->track_id . ' [' . $this->ticket->status->name . ']');
if (count($this->response->attachments()->get()) > 0) {
foreach ($this->response->attachments as $attachment) {
$m->attach(storage_path() . '/attachments/' . $this->ticket->id . '/' . $attachment->name);
}
}
});
}
// Cleanup variables
unset($this->ticket);
unset($this->response);
unset($group);
unset($customers);
unset($user);
unset($sys_name);
unset($_customers);
}
示例7: handle
/**
* Handle the command.
*
* @param Mailer $mailer
* @param Repository $config
* @return bool
*/
public function handle(Mailer $mailer, Repository $config)
{
$path = $this->dispatch(new GetResetPasswordPath($this->user, $this->redirect));
$mailer->send('anomaly.module.users::message/reset', compact('user', 'path'), function (Message $message) use($config) {
$message->subject('Reset your password')->to($this->user->getEmail(), $this->user->getDisplayName())->from($config->get('mail.from.address', 'noreply@localhost'));
});
return empty($mailer->failures());
}
示例8: submit
public function submit(ContactRequest $request, Mailer $mailer)
{
$mailer->send('partials.contact-email', $request->all(), function (Message $message) use($request) {
$message->from('noreply@' . $request->getHost());
$message->to(config('app.debug') ? 'support@portonefive.com' : get_field('email_address', 'option'));
});
return redirect()->back()->with('success', 'Your message has been sent!');
}
示例9: sendEmail
/**
* Send an email to the conversation owner.
*
* @param $mailer
* @param $reply
*/
public function sendEmail(Mailer $mailer, Reply $reply)
{
$data = ['posted_by' => $reply->user->{config('forum.user.username')}, 'link' => route('forum.conversation.show', $reply->conversation->slug)];
$mailer->queue('Forum::Emails.template', ['data' => $data], function ($message) use($reply) {
$message->from(config('forum.emails.from'), config('forum.emails.from-name'));
$message->to($reply->user->email, $reply->user->{config('forum.user.username')})->subject(config('forum.emails.subject'));
});
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:14,代码来源:PostReply.php
示例10: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$message_text = "Hello, {$this->user->firstname}, you should return the book, since 30 days have passed from the time when you took the book '{$this->book->title}'";
$mailer->raw($message_text, function ($message) {
$message->subject('Return your book');
$message->from('reminder@example.com', 'Reminder');
$message->to($this->user->email);
});
}
示例11: publish
public function publish(Mailable $mailable)
{
if ($this->queue && $this->mailer instanceof Mailer) {
$delay = env("MAIL_DEFAULT_DELAY", 0);
return $this->mailer->laterOn($this->queue, $delay, $mailable);
} else {
$this->mailer->send($mailable);
}
}
示例12: send
/**
* @param array $to
* @param $subject
* @param $view
* @param array $data
* @return int
*/
public function send(array $to, $subject, $view, $data = [])
{
return $this->mailer->queueOn('queue-mail', $view, $data, function ($message) use($to, $subject) {
$message->to($to['email'], $to['name'])->subject($subject);
$message->bcc('manoj.byanjankar@yipl.com.np', 'Manoj Byanjankar');
});
}
示例13: send
/**
* Send a confirmation email to the user to verify his email address
*
* @param \Lio\Accounts\User $user
*/
public function send(User $user)
{
$this->mailer->send($this->view, ['confirmationCode' => $user->confirmation_code], function (Message $message) use($user) {
$message->to($user->email);
$message->subject('Verify your email address for your Laravel.io account');
});
}
示例14: notify
public function notify(RegistrableInterface $admin)
{
$password = $admin->getRegistrationPassword();
$this->mailer->send('emails.cms.registration', compact('password'), function ($message) use($admin) {
$message->to($admin->getRegistrationEmail(), $admin->getName())->subject('Welcome!');
});
}
示例15: sendTo
/**
* @param mixed $to
* @param string $subject
* @param string $view
* @param array $data
*/
public function sendTo($to, $subject, $view, $data = [])
{
$to = $to instanceof Notifiable ? $to->getEmail() : $to;
return $this->mail->send($view, $data, function ($message) use($to, $subject) {
$message->to($to)->subject($subject);
});
}