Beispiel #1
0
 public static function get()
 {
     $mail_function = forum_get_global_setting('mail_function', null, MAIL_FUNCTION_PHP);
     if ($mail_function == MAIL_FUNCTION_NONE) {
         return Swift_NullTransport::newInstance();
     }
     if ($mail_function == MAIL_FUNCTION_SMTP && ($smtp_server = forum_get_global_setting('smtp_server'))) {
         $smtp_port = forum_get_global_setting('smtp_port', null, '25');
         $smtp_ssl = forum_get_global_setting('smtp_ssl', 'Y');
         $transport = Swift_SmtpTransportSingleton::getInstance($smtp_server, $smtp_port, $smtp_ssl);
         if (($smtp_username = forum_get_global_setting('smtp_username', 'strlen', false)) !== false) {
             /** @noinspection PhpUndefinedMethodInspection */
             $transport->setUsername($smtp_username);
         }
         if (($smtp_password = forum_get_global_setting('smtp_password', 'strlen', false)) !== false) {
             /** @noinspection PhpUndefinedMethodInspection */
             $transport->setPassword($smtp_password);
         }
         return $transport;
     }
     if ($mail_function == MAIL_FUNCTION_SENDMAIL && ($sendmail_path = forum_get_global_setting('sendmail_path'))) {
         return Swift_SendmailTransportSingleton::getInstance($sendmail_path);
     }
     return Swift_MailTransportSingleton::getInstance();
 }
Beispiel #2
0
 public static function get()
 {
     $mail_function = forum_get_global_setting('mail_function', false, MAIL_FUNCTION_PHP);
     if ($mail_function == MAIL_FUNCTION_SMTP && ($smtp_server = forum_get_global_setting('smtp_server'))) {
         $smtp_port = forum_get_global_setting('smtp_port', false, '25');
         $transport = Swift_SmtpTransportSingleton::getInstance($smtp_server, $smtp_port);
         if ($smtp_username = forum_get_global_setting('smtp_username', 'strlen', '')) {
             $transport->setUsername($smtp_username);
         }
         if ($smtp_password = forum_get_global_setting('smtp_password', 'strlen', '')) {
             $transport->setPassword($smtp_password);
         }
         return $transport;
     }
     if ($mail_function == MAIL_FUNCTION_SENDMAIL && ($sendmail_path = forum_get_global_setting('sendmail_path'))) {
         return Swift_SendmailTransportSingleton::getInstance($sendmail_path);
     }
     return Swift_MailTransportSingleton::getInstance();
 }