本文整理汇总了PHP中Illuminate\Mail\Mailer::raw方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::raw方法的具体用法?PHP Mailer::raw怎么用?PHP Mailer::raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Mail\Mailer
的用法示例。
在下文中一共展示了Mailer::raw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$books = Book::with('user')->where('taken_at', '<', date('Y-m-d H:i:s', time() - 2592000))->get();
/** @var Book[] $books */
foreach ($books as $book) {
$this->mailer->raw(sprintf("Hi %s,\nPlease return back %s by %s.\nRegards,\nYour Library", $book->user->first_name, $book->title, $book->author), function ($message) use($book) {
$message->subject('Reminder');
$message->from(getenv('EMAIL_FROM'));
$message->to($book->user->email);
});
}
}
示例2: 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);
});
}
示例3: handle
/**
* Execute the command.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$users = User::all();
$message_text = "Hello, new book was add to our library: '{$this->book->title}' by {$this->book->author}";
foreach ($users as $user) {
$mailer->raw($message_text, function ($message) use($user) {
$message->subject('New book add to the library');
$message->from('no-reply@example.com', 'Admin');
$message->to($user->email);
});
}
}
示例4: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$users = Model\User::all(['first_name']);
/** @var Model\User[] $users */
foreach ($users as $user) {
$mailer->raw(sprintf("Hi %s,\nWe have a new book %s by %s.\nRegards,\nYour Library", $user->first_name, $this->book->title, $this->book->author), function ($message) use($user) {
$message->subject('Brand new book');
$message->from(getenv('EMAIL_FROM'));
$message->to($user->email);
});
}
}
示例5: raw
/**
* Send a new message when only a raw text part.
*
* @param string $text
* @param mixed $callback
* @return int
* @static
*/
public static function raw($text, $callback)
{
return \Illuminate\Mail\Mailer::raw($text, $callback);
}
示例6: send
/**
* Send a template email.
*
* @param $template
* @param $data
* @return bool
*/
public function send($template, $data)
{
return $this->mailer->raw($template, $data);
}
示例7: raw
/**
* Send a new message when only a raw text part.
*
* @param string $text
* @param \Closure|string $callback
* @return int
*/
public function raw($text, $callback)
{
return $this->mailer->raw($text, $callback);
}