feat(webstatement): tambahkan opsi abaikan validasi sertifikat SSL pada PHPMailer
- **Penyesuaian Konfigurasi PHPMailer**:
- Menambahkan logika baru untuk mengabaikan validasi sertifikat SSL agar mendukung lingkungan yang menggunakan sertifikat self-signed atau tidak valid.
- Menambahkan pengecekan properti konfigurasi `ignore_certificate_errors`.
- Konfigurasi tambahan meliputi:
- `verify_peer` diatur ke `false`.
- `verify_peer_name` diatur ke `false`.
- `allow_self_signed` diatur ke `true`.
- **Peningkatan Debugging**:
- Mengaktifkan mode debug jika aplikasi dalam mode debug (`config('app.debug')`).
- **Tujuan Perubahan**:
- Memfasilitasi pengelolaan email di lingkungan development atau pengujian.
- Mendukung sertifikat SSL non-standar tanpa mengganggu fungsionalitas pengiriman email lainnya.
Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
@@ -107,10 +107,22 @@ class PHPMailerService
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Debug mode - COMMENTED OUT
|
// --- TAMBAHKAN BAGIAN INI UNTUK MENGABAIKAN VALIDASI SERTIFIKAT ---
|
||||||
// if (config('app.debug')) {
|
if (isset($config['ignore_certificate_errors']) && $config['ignore_certificate_errors']) {
|
||||||
// $this->mailer->SMTPDebug = SMTP::DEBUG_SERVER;
|
$this->mailer->SMTPOptions = [
|
||||||
// }
|
'ssl' => [
|
||||||
|
'verify_peer' => false,
|
||||||
|
'verify_peer_name' => false,
|
||||||
|
'allow_self_signed' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
// --- AKHIR TAMBAHAN ---
|
||||||
|
|
||||||
|
// Debug mode
|
||||||
|
if (config('app.debug')) {
|
||||||
|
$this->mailer->SMTPDebug = SMTP::DEBUG_SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
// Timeout settings
|
// Timeout settings
|
||||||
$this->mailer->Timeout = config('mail.mailers.phpmailer.timeout', 30);
|
$this->mailer->Timeout = config('mail.mailers.phpmailer.timeout', 30);
|
||||||
|
|||||||
Reference in New Issue
Block a user