[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/ -> MP_Swift_Connection_smtp.class.php (source)

   1  <?php
   2  class MP_Swift_Connection_smtp extends MP_Swift_connection_
   3  {
   4      public $Swift_Connection_type = 'SMTP';
   5  
   6  	function connect( $mail_id, $y )
   7      {
   8          $settings = get_option( MailPress::option_name_smtp );
   9  
  10          $conn = new Swift_SmtpTransport();
  11  
  12          $conn->setHost( $settings['server'] );
  13          $conn->setPort( $settings['port'] );
  14  
  15          if ( !empty( $settings['ssl'] ) )
  16              $conn->setEncryption( $settings['ssl'] );
  17  
  18          if ( empty( $settings['username'] ) && empty( $settings['password'] ) )
  19          {
  20              $y->log( "**** Empty user/password for SMTP connection ****" );
  21          }
  22          else
  23          {
  24              if ( !empty( $settings['username'] ) )
  25              {
  26                  $conn->setUsername( $settings ['username'] );
  27                  if ( !empty( $settings['password'] ) )
  28                      $conn->setPassword( $settings ['password'] );
  29              }
  30          }
  31  
  32          // eventually popb4smtp ( other authentications are detected automatically )
  33          if ( isset( $settings['smtp-auth'] ) && ( !empty( $settings['smtp-auth'] ) ) )
  34          {
  35              switch ( $settings['smtp-auth'] )
  36              {
  37                  case '@PopB4Smtp' :
  38                      add_filter( 'MailPress_swift_registerPlugin', array( __CLASS__, 'registerPlugin' ), 8, 1 );
  39                  break;
  40              }
  41          }
  42  
  43          return $conn;
  44      }
  45  
  46  	public static function registerPlugin( $_this_swift )
  47      {
  48          $settings = get_option( MailPress::option_name_smtp );
  49  
  50          $_this_swift->registerPlugin( new Swift_Plugins_PopBeforeSmtpPlugin( $settings['pophost'], $settings['popport'] ) );
  51  
  52          return $_this_swift;
  53      }
  54  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1