Skip to content

Commit

Permalink
Merge branch 'master' into 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Sep 21, 2016
2 parents 0d0a626 + 2635725 commit c7650fb
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 6 deletions.
File renamed without changes.
44 changes: 44 additions & 0 deletions docs/Note_for_SMTP_debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#SMTP Debugging

If you are having problems connecting or sending emails through your SMTP server, the SMTP class can provide more information about the processing/errors taking place.
Use the debug functionality of the class to see what's going on in your connections. To do that, set the debug level in your script. For example:

```php
$mail->SMTPDebug = 2;
$mail->isSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP port
$mail->Host = "mail.yourhost.com"; // SMTP server
$mail->Username = "[email protected]"; // SMTP account username
$mail->Password = "your password"; // SMTP account password
```

##Debug levels

Setting the `SMTPDebug` property results in different amounts of output:

* `0`: Disable debugging (you can also leave this out completely, 0 is the default).
* `1`: Output messages sent by the client.
* `2`: as 1, plus responses received from the server (this is probably the most useful setting for debugging).
* `3`: as 2, plus more information about the initial connection.
* `4`: as 3, plus even lower-level information, very verbose.

You don't need to use levels above 2 unless you're having trouble connecting at all - it will just make output more verbose and more difficult to read.

Note that you will get no output until you call `send()`, because no SMTP conversation takes place until you do that.

##Debug output format

The form that the debug output taks is determined by the `Debugoutput` property. This has several options:

* `echo` Output plain-text as-is, appropriate for CLI
* `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
* `error_log` Output to error log as configured in php.ini

By default PHPMailer will use `echo` if run from a `cli` or `cli-server` SAPI, `html` otherwise. Alternatively, you can implement your own system by providing a callable expecting two parameters: a message string and the debug level:

$mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};

You can of course make this more complex - for example your could capture all the output and store it in a database.

And finally, don't forget to disable debugging before going into production.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: ';
$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: ';
$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.';
//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: ';
$PHPMAILER_LANG['invalid_address'] = 'Felaktig adress: ';
$PHPMAILER_LANG['provide_address'] = 'Du måste ange minst en mottagares e-postadress.';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
$PHPMAILER_LANG['signing'] = 'Signerings fel: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() misslyckades.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP server fel: ';
$PHPMAILER_LANG['variable_set'] = 'Kunde inte definiera eller återställa variabel: ';
$PHPMAILER_LANG['extension_missing'] = 'Tillägg ej tillgängligt: ';
4 changes: 4 additions & 0 deletions src/PHPMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,11 @@ public function setLanguage($langcode = 'en', $lang_path = '')
{
// Backwards compatibility for renamed language codes
$renamed_langcodes = array(
'br' => 'pt_br',
'cz' => 'cs',
'dk' => 'da',
'no' => 'nb',
'se' => 'sv',
);

if (isset($renamed_langcodes[$langcode])) {
Expand Down

0 comments on commit c7650fb

Please sign in to comment.