FuelPHP Bin
//sending all start if($mail->for_all == 1){ $teachers = Model_User::find("all", [ "where" => [ ["group_id", 10], ["deleted_at", 0], ], "order_by" => [ ["id", "desc"] ] ]); foreach($teachers as $teacher){ $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"),Config::get("statics.info_name")); $sendmail->to($teacher->email); $sendmail->subject("{$mail->title} / OliveCode"); $sendmail->html_body("Dear {$teacher->firstname},<br><br>". htmlspecialchars_decode($body) . "If you are no longer interested, you can " . "<a href=". Uri::base() ."?" . md5('id') . "={$teacher->id}/unsubscribe=" . md5($teacher->email) .">Unsubscribe.</a>"); $sendmail->send(); } $students = Model_User::find("all", [ "where" => [ ["group_id", 1], ["deleted_at", 0], ], "order_by" => [ ["id", "desc"] ] ]); foreach($students as $student){ $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"),Config::get("statics.info_name")); $sendmail->to($student->email); $sendmail->subject("{$mail->title} / OliveCode"); $sendmail->html_body("Dear {$student->firstname},<br><br>". htmlspecialchars_decode($body) . "If you are no longer interested, you can " . "<a href=". Uri::base() . "?" . md5('id') . "={$student->id}/unsubscribe=" . md5($student->email) .">Unsubscribe.</a>"); $sendmail->send(); } Response::redirect("/admin/mail/sent"); }//sending all end