Changeset 2682

Show
Ignore:
Timestamp:
05/21/2008 09:18:46 AM (5 months ago)
Author:
Shadowhand
Message:

Fixing #576

Location:
trunk/system
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/config/email.php

    r2505 r2682  
    1212 
    1313/** 
     14 * To use secure connections with SMTP, set "port" to 465 instead of 25. 
     15 * To enable TLS, set "encryption" to "tls". 
     16 * 
    1417 * Driver options: 
    1518 * @param   null    native: no options 
    1619 * @param   string  sendmail: executable path, with -bs or equivalent attached 
    17  * @param   array   smtp: hostname, (username), (password), (port), (auth) 
     20 * @param   array   smtp: hostname, (username), (password), (port), (auth), (encryption) 
    1821 */ 
    1922$config['options'] = NULL; 
  • trunk/system/helpers/email.php

    r2511 r2682  
    3838                { 
    3939                        case 'smtp': 
     40                                // Set port 
     41                                $port = empty($config['options']['port']) ? 25 : (int) $config['options']['port']; 
     42 
     43                                if (empty($config['options']['encryption'])) 
     44                                { 
     45                                        // No encryption 
     46                                        $encryption = Swift_Connection_SMTP::ENC_OFF; 
     47                                } 
     48                                else 
     49                                { 
     50                                        // Set encryption 
     51                                        switch (strtolower($config['options']['encryption'])) 
     52                                        { 
     53                                                case 'tls': $encryption = Swift_Connection_SMTP::ENC_TLS; break; 
     54                                                case 'ssl': $encryption = Swift_Connection_SMTP::ENC_SSL; break; 
     55                                        } 
     56                                } 
     57 
    4058                                // Create a SMTP connection 
    41                                 $connection = new Swift_Connection_SMTP 
    42                                 ( 
    43                                         $config['options']['hostname'], 
    44                                         empty($config['options']['port']) ? 25 : (int) $config['options']['port'] 
    45                                 ); 
     59                                $connection = new Swift_Connection_SMTP($config['options']['hostname'], $port, $encryption); 
    4660 
    4761                                // Do authentication, if part of the DSN