⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.142
Server IP:
217.76.53.76
Server:
Linux vmi1397931.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
Server Software:
Apache
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
ppt.com.ng
/
app
/
Console
/
Commands
/
View File Name :
SendContactMessages.php
line(""); $this->line("****************************************************************"); $this->info("Started Sync of Contact Messages"); $this->line("****************************************************************"); $now = Carbon::now(); $contactMessages = ContactMessage::where('status','Pending')->get(); foreach ($contactMessages as $contactMessage){ $emails = []; if($contactMessage['mode'] == 'Send to All'){ array_push($emails, CardOwner::where('status','Active')->pluck('email')); array_push($emails, User::where('status','Active')->pluck('email')); }else if($contactMessage['mode'] == 'Send to One'){ $emails = User::where('id',$contactMessage['single_receiver_id'])->pluck('email'); }else if($contactMessage['mode'] == 'Send to All Company Staff'){ $emails = User::where('user_role_id',2)->where('status','Active')->pluck('email'); }else if($contactMessage['mode'] == 'Send to All Naip Member'){ $emails = User::where('user_role_id',4)->where('status','Active')->pluck('email'); }else if($contactMessage['mode'] == 'Send to All Medical Reps'){ $emails = CardOwner::where('status','Active')->pluck('email'); } $this->info(count($emails)." Email(s) Found to send Contact Message."); try { foreach ($emails as $email){ sendEmail($email, 'mails.contact_messages.message-email', ['subject' => $contactMessage['title'], 'content' => $contactMessage['message'], 'email' => $email]); } $contactMessage['status'] = 'Sent'; }catch (\Exception $e){ $contactMessage['status'] = 'Failed'; $contactMessage['response'] = $e->getMessage(); } $contactMessage->save(); } $this->line("****************************************************************"); $this->info("All Contact Messages Synced !!! "); $this->line("****************************************************************"); $this->line(""); } }