コード例 #1
0
ファイル: Mailer.php プロジェクト: roslairy/nofetch
 protected function send()
 {
     $mail = \App\Mail::getNextFireMail();
     if ($mail == null) {
         return;
     }
     $result = Mail::raw('', function (Message $message) {
         $mail = \App\Mail::getNextFireMail();
         $content = $mail->content;
         $name = $mail->name;
         $message->from(env('MAIL_USERNAME'), 'Pusher');
         $message->to(env('MAIL_TO'), 'Kindle');
         $message->subject($name);
         $message->attachData($content, $name);
     });
     // check if succeess
     $mail = \App\Mail::getNextFireMail();
     if ($result == 1) {
         $mail->state = 'sent';
     } else {
         $mail->state = 'failed';
     }
     $mail->save();
 }