Пример #1
0
 public static function getPhpMailer()
 {
     // Setup mailer for sending message
     $mail = new \PHPMailer();
     $mail->isSMTP();
     $mail->isHTML(true);
     $mailerSettings = array("SMTP_SMTP_DEBUG" => 'SMTPDebug', "SMTP_DEBUGOUTPUT" => "Debugoutput", "SMTP_SECURE" => "SMTPSecure", "SMTP_AUTH" => "SMTPAuth", "SMTP_SERVER_HOST" => "Host", "SMTP_SERVER_PORT" => "Port", "SMTP_SERVER_USERNAME" => "Username", "SMTP_SERVER_PASSWORD" => "Password");
     foreach ($mailerSettings as $name => $value) {
         $var = ConfigData::getVariableByName($name);
         if ($var && $var->disabled != 1) {
             $mail->{$value} = $var->value;
         } else {
             self::logMailError(LOG_WARNING, "ERROR RETRIEVING SMTP SETTING <{$name}>");
         }
     }
     return $mail;
 }