本文整理汇总了PHP中Illuminate\Mail\Mailer::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::send方法的具体用法?PHP Mailer::send怎么用?PHP Mailer::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Mail\Mailer
的用法示例。
在下文中一共展示了Mailer::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
});
}
示例2: 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!');
});
}
示例3: 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);
});
}
示例4: handle
/**
* Handle the event.
*
* @param CheckoutEvent $event
* @return void
*/
public function handle(CheckoutEvent $event)
{
$user = $event->getUser();
$order = $event->getOrder();
return $this->mailer->send('emails.checkout', ['user' => $user, 'order' => $order], function ($message) use($user) {
$message->to($user->email, $user->name)->subject("{$user->name}, seu pedido foi realizado com sucesso!");
});
}
示例5: handle
public function handle(UserCreatedEvent $event)
{
$user = $event->getUser();
$plainPassword = $event->getPlainPassword();
return $this->mailer->send('email.registration', ['username' => $user->email, 'password' => $plainPassword], function ($message) use($user) {
$message->to($user->email, $user->name)->subject("{$user->name}, your account was created!");
});
}
示例6: 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);
}
}
示例7: handle
/**
* @param \Otman\Events\UserRegistered $event
*/
public function handle(UserRegistered $event)
{
$user = $event->getUser();
$data = array('user' => $user);
$this->mailer->send('emails.registration', $data, function ($message) use($user) {
$message->from('noreply@otman.org', 'OT Manager');
$message->to($user->email, 'Anonymous User')->subject('Welcome!');
});
}
示例8: send
/**
* Sends an email using laravel's mailer.
*
* @param array|string $views
* @param mixed $data
* @param $callback
*
* @return bool
*/
public function send($views, $data, $callback)
{
try {
$this->mail->send($views, $data, $callback);
return true;
} catch (Swift_TransportException $e) {
return false;
}
}
示例9: send
/**
* Send or queue the current email.
*/
public function send()
{
$this->mailer->send([$this->view_html, $this->view_plain], $this->data, function (\Illuminate\Mail\Message $message) {
$message->to($this->to);
$message->subject($this->subject);
if ($this->attachment) {
$message->attach($this->attachment);
}
});
}
示例10: handle
/**
* @param \Otman\Events\OvertimeRequested $event
*/
public function handle(OvertimeRequested $event)
{
$manager = $event->getUser()->getManager();
$data = array('user' => $event->getUser(), 'overtime' => $event->getOvertime());
$this->mailer->send('emails.overtime_request', $data, function ($message) use($manager) {
$message->from('noreply@otman.org', 'OT Manager');
$message->to($manager->email, $this->setMailingName($manager));
$message->subject('New Overtime request submitted');
});
}
示例11: sendVerificationEmail
/**
* Send the email for user's email address verification.
*
* @param string $name
* @param string $email
*
* @return string
*/
public function sendVerificationEmail($name, $email)
{
// generate verification code
$verification_code = $this->verifier->newCode($email);
// send verification email
$this->mailer->send('emails.auth.verification', compact('name', 'email', 'verification_code'), function ($message) use($name, $email) {
$message->to($email, $name)->subject(Lang::get('email.email_verification'));
});
return $verification_code;
}
示例12: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
foreach ($this->recipients as $recipient) {
$mailer->send('emails.reports.efficiency_report', ['logs' => $this->logs], function ($message) use($recipient) {
$message->from('production@mtech.co.za', 'Production @ MTech SA')->to($recipient->email, $recipient->name)->subject(Carbon::now()->format('j M Y A') . ' Efficiency Report');
});
}
// Email production admin
$mailer->send('emails.reports.efficiency_report', ['logs' => $this->logs], function ($message) {
$message->from('production@mtech.co.za', 'Production @ MTech SA')->to('pm@mtech.co.za', 'Production Management')->subject(Carbon::now()->format('j M Y A') . ' Efficiency Report');
});
}
示例13: handle
/**
* Handle the event.
*
* @param Created $event
*
* @return void
*/
public function handle(Created $event)
{
$users = $this->user->whereIsAdministrator()->get();
foreach ($users as $user) {
// Only notify users who don't own the ticket.
if ($event->issue->user->id != $user->id) {
$this->mailer->send('emails.issues.new', compact('event'), function ($m) use($event, $user) {
$m->to($user->email);
$m->subject("New Ticket: {$event->issue->title}");
});
}
}
}
示例14: 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);
}
示例15: send
/**
* Send a new message using a view.
*
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @return mixed
*/
public function send($view, array $data, $callback)
{
if ($this->autoResetEnabled()) {
$this->resetSwiftTransport();
}
return $this->mailer->send($view, $data, $callback);
}