Skip to content

Commit

Permalink
#26: RELEASE 1.2.26, 'debug_output' option: Let CLI autodetection can…
Browse files Browse the repository at this point in the history
… be invoked by NULL or empty string value.

Signed-off-by:Ivan Tcholakov <[email protected]>
  • Loading branch information
ivantcholakov committed Nov 5, 2017
1 parent d3777ee commit 23f8bf1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $config['smtp_port'] = 587;
$config['smtp_timeout'] = 30; // (in seconds)
$config['smtp_crypto'] = 'tls'; // '' or 'tls' or 'ssl'
$config['smtp_debug'] = 0; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
$config['debug_output'] = (strpos(PHP_SAPI, 'cli') !== false OR defined('STDIN')) ? 'echo' : 'html'; // PHPMailer's SMTP debug output: 'html', 'echo', 'error_log' or user defined function with parameter $str and $level.
$config['debug_output'] = ''; // PHPMailer's SMTP debug output: 'html', 'echo', 'error_log' or user defined function with parameter $str and $level. NULL or '' means 'echo' on CLI, 'html' otherwise.
$config['smtp_auto_tls'] = false; // Whether to enable TLS encryption automatically if a server supports it, even if `smtp_crypto` is not set to 'tls'.
$config['smtp_conn_options'] = array(); // SMTP connection options, an array passed to the function stream_context_create() when connecting via SMTP.
$config['wordwrap'] = true;
Expand Down
2 changes: 1 addition & 1 deletion config/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$config['smtp_timeout'] = 30; // (in seconds)
$config['smtp_crypto'] = ''; // '' or 'tls' or 'ssl'
$config['smtp_debug'] = 0; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
$config['debug_output'] = (strpos(PHP_SAPI, 'cli') !== false OR defined('STDIN')) ? 'echo' : 'html'; // PHPMailer's SMTP debug output: 'html', 'echo', 'error_log' or user defined function with parameter $str and $level.
$config['debug_output'] = ''; // PHPMailer's SMTP debug output: 'html', 'echo', 'error_log' or user defined function with parameter $str and $level. NULL or '' means 'echo' on CLI, 'html' otherwise.
$config['smtp_auto_tls'] = true; // Whether to enable TLS encryption automatically if a server supports it, even if `smtp_crypto` is not set to 'tls'.
$config['smtp_conn_options'] = array(); // SMTP connection options, an array passed to the function stream_context_create() when connecting via SMTP.
$config['wordwrap'] = true;
Expand Down
16 changes: 12 additions & 4 deletions libraries/MY_Email_2_x.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MY_Email extends CI_Email {
'send_multipart' => TRUE,
'bcc_batch_mode' => FALSE,
'bcc_batch_size' => 200,
'debug_output' => 'echo',
'debug_output' => '',
'smtp_debug' => 0,
'encoding' => '8bit',
'smtp_auto_tls' => true,
Expand Down Expand Up @@ -968,9 +968,10 @@ public function set_smtp_debug($level) {
// PHPMailer's SMTP debug output.
// How to handle debug output.
// Options:
// `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output. This is default value for CodeIgniter
// `echo` Output plain-text as-is, should be avoid in web production
// `error_log` Output to error log as configured in php.ini
// `html` - Output escaped, line breaks converted to `<br>`, appropriate for browser output. This is default value for CodeIgniter
// `echo` - Output plain-text as-is, should be avoid in web production
// `error_log` - Output to error log as configured in php.ini
// NULL or '' - default: 'echo' on CLI, 'html' otherwise.
//
// Alternatively, you can provide a callable expecting two params: a message string and the debug level:
// <code>
Expand All @@ -979,6 +980,13 @@ public function set_smtp_debug($level) {
// </code>

This comment has been minimized.

Copy link
@Bankde

Bankde Nov 5, 2017

Contributor

I think I messed up a bit. This should be inside the quote. (All of 3 versions)
// set_debug_output('custom_debug');

@ivantcholakov Could you please fix that for me ? Thank again.

This comment has been minimized.

Copy link
@ivantcholakov

ivantcholakov Nov 5, 2017

Author Owner

This comment has been minimized.

Copy link
@ivantcholakov

ivantcholakov Nov 5, 2017

Author Owner

@Bankde
69b38b4
I could make another release, no problem.

public function set_debug_output($handle) {

if ($handle === null
||
is_string($handle) && $handle == ''
) {
$handle = self::$default_properties['debug_output'];
}

$this->properties['debug_output'] = $handle;

if ($this->mailer_engine == 'phpmailer') {
Expand Down
16 changes: 12 additions & 4 deletions libraries/MY_Email_3_0_x.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MY_Email extends CI_Email {
'send_multipart' => TRUE,
'bcc_batch_mode' => FALSE,
'bcc_batch_size' => 200,
'debug_output' => 'echo',
'debug_output' => '',
'smtp_debug' => 0,
'encoding' => '8bit',
'smtp_auto_tls' => true,
Expand Down Expand Up @@ -973,9 +973,10 @@ public function set_smtp_debug($level) {
// PHPMailer's SMTP debug output.
// How to handle debug output.
// Options:
// `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output. This is default value for CodeIgniter
// `echo` Output plain-text as-is, should be avoid in web production
// `error_log` Output to error log as configured in php.ini
// `html` - Output escaped, line breaks converted to `<br>`, appropriate for browser output. This is default value for CodeIgniter
// `echo` - Output plain-text as-is, should be avoid in web production
// `error_log` - Output to error log as configured in php.ini
// NULL or '' - default: 'echo' on CLI, 'html' otherwise.
//
// Alternatively, you can provide a callable expecting two params: a message string and the debug level:
// <code>
Expand All @@ -984,6 +985,13 @@ public function set_smtp_debug($level) {
// </code>
public function set_debug_output($handle) {

if ($handle === null
||
is_string($handle) && $handle == ''
) {
$handle = self::$default_properties['debug_output'];
}

$this->properties['debug_output'] = $handle;

if ($this->mailer_engine == 'phpmailer') {
Expand Down
16 changes: 12 additions & 4 deletions libraries/MY_Email_3_1_x.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MY_Email extends CI_Email {
'send_multipart' => TRUE,
'bcc_batch_mode' => FALSE,
'bcc_batch_size' => 200,
'debug_output' => 'echo',
'debug_output' => '',
'smtp_debug' => 0,
'encoding' => '8bit',
'smtp_auto_tls' => true,
Expand Down Expand Up @@ -965,9 +965,10 @@ public function set_smtp_debug($level) {
// PHPMailer's SMTP debug output.
// How to handle debug output.
// Options:
// `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output. This is default value for CodeIgniter
// `echo` Output plain-text as-is, should be avoid in web production
// `error_log` Output to error log as configured in php.ini
// `html` - Output escaped, line breaks converted to `<br>`, appropriate for browser output. This is default value for CodeIgniter
// `echo` - Output plain-text as-is, should be avoid in web production
// `error_log` - Output to error log as configured in php.ini
// NULL or '' - default: 'echo' on CLI, 'html' otherwise.
//
// Alternatively, you can provide a callable expecting two params: a message string and the debug level:
// <code>
Expand All @@ -976,6 +977,13 @@ public function set_smtp_debug($level) {
// </code>
public function set_debug_output($handle) {

if ($handle === null
||
is_string($handle) && $handle == ''
) {
$handle = self::$default_properties['debug_output'];
}

$this->properties['debug_output'] = $handle;

if ($this->mailer_engine == 'phpmailer') {
Expand Down

0 comments on commit 23f8bf1

Please sign in to comment.