Skip to content

Commit

Permalink
- added 'smtp_debug' option
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Jul 14, 2009
1 parent ec31b6f commit 19862b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG
Expand Up @@ -5,7 +5,7 @@ CHANGELOG RoundCube Webmail
- Added hook to write_log function (#1485971) - Added hook to write_log function (#1485971)
- Performance improvements by use UID commands (#1485690) - Performance improvements by use UID commands (#1485690)
- Fix HTML editor tabIndex setting (#1485972) - Fix HTML editor tabIndex setting (#1485972)
- Added 'imap_debug' option - Added 'imap_debug' and 'smtp_debug' options
- Support strftime's format modifiers in date_* options (#1484806) - Support strftime's format modifiers in date_* options (#1484806)
- Support %h variable in 'smtp_server' option (#1485766) - Support %h variable in 'smtp_server' option (#1485766)
- Show SMTP errors in browser (#1485927) - Show SMTP errors in browser (#1485927)
Expand Down
3 changes: 3 additions & 0 deletions config/main.inc.php.dist
Expand Up @@ -130,6 +130,9 @@ $rcmail_config['sql_debug'] = false;
// Log IMAP conversation to <log_dir>/imap or to syslog // Log IMAP conversation to <log_dir>/imap or to syslog
$rcmail_config['imap_debug'] = false; $rcmail_config['imap_debug'] = false;


// Log SMTP conversation to <log_dir>/smtp or to syslog
$rcmail_config['smtp_debug'] = false;

// How many seconds must pass between emails sent by a user // How many seconds must pass between emails sent by a user
$rcmail_config['sendmail_delay'] = 0; $rcmail_config['sendmail_delay'] = 0;


Expand Down
9 changes: 9 additions & 0 deletions program/include/rcube_smtp.inc
Expand Up @@ -92,6 +92,9 @@ function smtp_mail($from, $recipients, &$headers, &$body, &$response, &$error)


$SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host); $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 // try to connect to server and exit on failure
$result = $SMTP_CONN->connect($smtp_timeout); $result = $SMTP_CONN->connect($smtp_timeout);
if (PEAR::isError($result)) if (PEAR::isError($result))
Expand Down Expand Up @@ -247,6 +250,12 @@ function smtp_disconnect()
} }
} }


/* 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 * Take an array of mail headers and return a string containing
Expand Down

0 comments on commit 19862b5

Please sign in to comment.