| | |
| | | )); |
| | | |
| | | $smtp_timeout = null; |
| | | $smtp_host = $CONFIG['smtp_server']; |
| | | $smtp_host = str_replace('%h', $_SESSION['imap_host'], $CONFIG['smtp_server']); |
| | | $smtp_port = is_numeric($CONFIG['smtp_port']) ? $CONFIG['smtp_port'] : 25; |
| | | $smtp_host_url = parse_url($CONFIG['smtp_server']); |
| | | |
| | | $smtp_host_url = parse_url($smtp_host); |
| | | |
| | | // overwrite port |
| | | if (isset($smtp_host_url['host']) && isset($smtp_host_url['port'])) |
| | | { |
| | |
| | | $helo_host = 'localhost'; |
| | | |
| | | $SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host); |
| | | |
| | | if($RCMAIL->config->get('smtp_debug')) |
| | | $SMTP_CONN->setDebug(true, 'smtp_debug_handler'); |
| | | |
| | | // try to connect to server and exit on failure |
| | | $result = $SMTP_CONN->connect($smtp_timeout); |
| | |
| | | } |
| | | } |
| | | |
| | | /* this is our own debug handler for the SMTP connection */ |
| | | function smtp_debug_handler(&$smtp, $message) |
| | | { |
| | | write_log('smtp', preg_replace('/\r\n$/', '', $message)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Take an array of mail headers and return a string containing |