⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.134
Server IP:
68.65.123.197
Server:
Linux premium49.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
smarbgfw
/
card.smartech-hub.com
/
app
/
Services
/
View File Name :
MailgunService.php
<?php namespace App\Services; use Mailgun\Mailgun; use Illuminate\Support\Facades\DB; class MailgunService { protected $mg; protected $domain; protected $from; public function __construct() { // Get Mailgun credentials from config table $mailgunApiKey = DB::table('config')->where('config_key', 'mailgun_smtp_password')->value('config_value'); $mailFrom = DB::table('config')->where('config_key', 'mailgun_from_address')->value('config_value'); // Create Mailgun client $this->mg = Mailgun::create( $mailgunApiKey ?? '', 'https://api.mailgun.net' ); // Set domain $this->domain = env('MAIN_DOMAIN'); // Build from address $this->from = env('MAIL_FROM_NAME', config('app.name')) . ' <' . ($mailFrom ?? env('MAIL_FROM_ADDRESS')) . '>'; } /** * Send an email via Mailgun */ public function sendEmail($to, $subject, $html, $from = null) { return $this->mg->messages()->send($this->domain, [ 'from' => $from ?? $this->from, 'to' => $to, 'subject' => $subject, 'html' => $html, // use 'text' if plain text only ]); } }