ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
class.ilMailMimeTransportSmtp.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected function onBeforeSend(): void
24 {
25 $this->mailer->isSMTP();
26
27 $this->mailer->Host = $this->settings->get('mail_smtp_host', '');
28 $this->mailer->Port = (int) $this->settings->get('mail_smtp_port', '25');
29 if ($this->settings->get('mail_smtp_user', '') !== '') {
30 $this->mailer->SMTPAuth = true;
31 $this->mailer->Username = $this->settings->get('mail_smtp_user', '');
32 $this->mailer->Password = $this->settings->get('mail_smtp_password', '');
33 }
34 $this->mailer->SMTPSecure = $this->settings->get('mail_smtp_encryption', '');
35 $this->mailer->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_LOWLEVEL;
36 $this->mailer->SMTPKeepAlive = true;
37 }
38
39 public function __destruct()
40 {
41 try {
42 $this->mailer->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_OFF;
43 $this->mailer->smtpClose();
44 } catch (Throwable) {
45 }
46 }
47}