⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.112
Server IP:
65.21.180.239
Server:
Linux gowhm.eplangoweb.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.0.30
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
eplangoweb
/
.trash
/
core
/
app
/
Http
/
Helpers
/
Edit File: MegaMailer.php
<?php namespace App\Http\Helpers; use App\Models\BasicExtended; use App\Models\EmailTemplate; use App\Models\Language; use Illuminate\Support\Facades\Session; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; class MegaMailer { public function mailFromAdmin($data) { $temp = EmailTemplate::where('email_type', '=', $data['templateType'])->first(); $body = $temp->email_body; if (array_key_exists('username', $data)) { $body = preg_replace("/{username}/", $data['username'], $body); } if (array_key_exists('replaced_package', $data)) { $body = preg_replace("/{replaced_package}/", $data['replaced_package'], $body); } if (array_key_exists('removed_package_title', $data)) { $body = preg_replace("/{removed_package_title}/", $data['removed_package_title'], $body); } if (array_key_exists('package_title', $data)) { $body = preg_replace("/{package_title}/", $data['package_title'], $body); } if (array_key_exists('package_price', $data)) { $body = preg_replace("/{package_price}/", $data['package_price'], $body); } if (array_key_exists('discount', $data)) { $body = preg_replace("/{discount}/", $data['discount'], $body); } if (array_key_exists('total', $data)) { $body = preg_replace("/{total}/", $data['total'], $body); } if (array_key_exists('activation_date', $data)) { $body = preg_replace("/{activation_date}/", $data['activation_date'], $body); } if (array_key_exists('expire_date', $data)) { $body = preg_replace("/{expire_date}/", $data['expire_date'], $body); } if (array_key_exists('requested_domain', $data)) { $body = preg_replace("/{requested_domain}/", "<a href='http://" . $data['requested_domain'] . "'>" . $data['requested_domain'] . "</a>", $body); } if (array_key_exists('previous_domain', $data)) { $body = preg_replace("/{previous_domain}/", "<a href='http://" . $data['previous_domain'] . "'>" . $data['previous_domain'] . "</a>", $body); } if (array_key_exists('current_domain', $data)) { $body = preg_replace("/{current_domain}/", "<a href='http://" . $data['current_domain'] . "'>" . $data['current_domain'] . "</a>", $body); } if (array_key_exists('subdomain', $data)) { $body = preg_replace("/{subdomain}/", "<a href='http://" . $data['subdomain'] . "'>" . $data['subdomain'] . "</a>", $body); } if (array_key_exists('last_day_of_membership', $data)) { $body = preg_replace("/{last_day_of_membership}/", $data['last_day_of_membership'], $body); } if (array_key_exists('login_link', $data)) { $body = preg_replace("/{login_link}/", $data['login_link'], $body); } if (array_key_exists('customer_name', $data)) { $body = preg_replace("/{customer_name}/", $data['customer_name'], $body); } if (array_key_exists('verification_link', $data)) { $body = preg_replace("/{verification_link}/", $data['verification_link'], $body); } if (array_key_exists('website_title', $data)) { $body = preg_replace("/{website_title}/", $data['website_title'], $body); } if (session()->has('lang')) { $currentLang = Language::where('code', session()->get('lang'))->first(); } else { $currentLang = Language::where('is_default', 1)->first(); } $be = $currentLang->basic_extended; $mail = new PHPMailer(true); if ($be->is_smtp == 1) { try { $mail->isSMTP(); $mail->Host = $be->smtp_host; $mail->SMTPAuth = true; $mail->Username = $be->smtp_username; $mail->Password = $be->smtp_password; $mail->SMTPSecure = $be->encryption; $mail->Port = $be->smtp_port; } catch (Exception $e) { } } try { //Recipients $mail->setFrom($be->from_mail, $be->from_name); $mail->addAddress($data['toMail'], $data['toName']); // Attachments if (array_key_exists('membership_invoice', $data)) { $mail->addAttachment('assets/front/invoices/' . $data['membership_invoice']); } // Content $mail->isHTML(true); $mail->Subject = $temp->email_subject; $mail->Body = $body; $mail->send(); // Attachments if (array_key_exists('membership_invoice', $data)) { @unlink('assets/front/invoices/' . $data['membership_invoice']); } } catch (Exception $e) { } } public function mailToAdmin($data) { $be = BasicExtended::first(); $mail = new PHPMailer(true); if ($be->is_smtp == 1) { try { $mail->isSMTP(); $mail->Host = $be->smtp_host; $mail->SMTPAuth = true; $mail->Username = $be->smtp_username; $mail->Password = $be->smtp_password; $mail->SMTPSecure = $be->encryption; $mail->Port = $be->smtp_port; } catch (Exception $e) { Session::flash('error', $e->getMessage()); return back(); } } try { $mail->setFrom($data['fromMail'], $data['fromName']); $mail->addAddress($be->from_mail); // Add a recipient // Attachments if (array_key_exists('attachments', $data)) { $mail->addAttachment('front/invoices/' . $data['attachments']); // Add attachments } // Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = $data['subject']; $mail->Body = $data['body']; $mail->send(); } catch (\Exception $e) { Session::flash('error', $e->getMessage()); return back(); } } public function mailContactMessage($data) { if (session()->has('lang')) { $currentLang = Language::where('code', session()->get('lang'))->first(); } else { $currentLang = Language::where('is_default', 1)->first(); } $be = $currentLang->basic_extended; $mail = new PHPMailer(true); if ($be->is_smtp == 1) { try { $mail->isSMTP(); $mail->Host = $be->smtp_host; $mail->SMTPAuth = true; $mail->Username = $be->smtp_username; $mail->Password = $be->smtp_password; $mail->SMTPSecure = $be->encryption; $mail->Port = $be->smtp_port; } catch (Exception $e) { Session::flash('error', $e->getMessage()); return back(); } } try { //Recipients $mail->setFrom($be->from_mail, $data['fullname']); $mail->addAddress($data['toMail'], $data['toName']); // Content $mail->isHTML(true); $mail->Subject = $data['subject']; $mail->Body = $data['body']; $mail->addReplyTo($data['email']); $mail->send(); } catch (Exception $e) { Session::flash('error', $e->getMessage()); return back(); } } }
Simpan