| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,49 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * PHPMailer SPL autoloader. |
|
| 4 |
+ * PHP Version 5 |
|
| 5 |
+ * @package PHPMailer |
|
| 6 |
+ * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project |
|
| 7 |
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> |
|
| 8 |
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com> |
|
| 9 |
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> |
|
| 10 |
+ * @author Brent R. Matzelle (original founder) |
|
| 11 |
+ * @copyright 2012 - 2014 Marcus Bointon |
|
| 12 |
+ * @copyright 2010 - 2012 Jim Jagielski |
|
| 13 |
+ * @copyright 2004 - 2009 Andy Prevost |
|
| 14 |
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
|
| 15 |
+ * @note This program is distributed in the hope that it will be useful - WITHOUT |
|
| 16 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
| 17 |
+ * FITNESS FOR A PARTICULAR PURPOSE. |
|
| 18 |
+ */ |
|
| 19 |
+ |
|
| 20 |
+/** |
|
| 21 |
+ * PHPMailer SPL autoloader. |
|
| 22 |
+ * @param string $classname The name of the class to load |
|
| 23 |
+ */ |
|
| 24 |
+function PHPMailerAutoload($classname) |
|
| 25 |
+{
|
|
| 26 |
+ //Can't use __DIR__ as it's only in PHP 5.3+ |
|
| 27 |
+ $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; |
|
| 28 |
+ if (is_readable($filename)) {
|
|
| 29 |
+ require $filename; |
|
| 30 |
+ } |
|
| 31 |
+} |
|
| 32 |
+ |
|
| 33 |
+if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
|
|
| 34 |
+ //SPL autoloading was introduced in PHP 5.1.2 |
|
| 35 |
+ if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
|
| 36 |
+ spl_autoload_register('PHPMailerAutoload', true, true);
|
|
| 37 |
+ } else {
|
|
| 38 |
+ spl_autoload_register('PHPMailerAutoload');
|
|
| 39 |
+ } |
|
| 40 |
+} else {
|
|
| 41 |
+ /** |
|
| 42 |
+ * Fall back to traditional autoload for old PHP versions |
|
| 43 |
+ * @param string $classname The name of the class to load |
|
| 44 |
+ */ |
|
| 45 |
+ function __autoload($classname) |
|
| 46 |
+ {
|
|
| 47 |
+ PHPMailerAutoload($classname); |
|
| 48 |
+ } |
|
| 49 |
+} |
| ... | ... |
@@ -5,7 +5,7 @@ |
| 5 | 5 |
// | offers you the ability to separate your PHP code and your HTML | |
| 6 | 6 |
// +----------------------------------------------------------------------+ |
| 7 | 7 |
// | | |
| 8 |
-// | Copyright (C) 2001,2002 R.P.J. Velzeboer, The Netherlands | |
|
| 8 |
+// | Copyright (C) 2001-2009 R.P.J. Velzeboer, The Netherlands | |
|
| 9 | 9 |
// | | |
| 10 | 10 |
// | This program is free software; you can redistribute it and/or | |
| 11 | 11 |
// | modify it under the terms of the GNU General Public License | |
| ... | ... |
@@ -22,32 +22,35 @@ |
| 22 | 22 |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
| 23 | 23 |
// | 02111-1307, USA. | |
| 24 | 24 |
// | | |
| 25 |
-// | Author: R.P.J. Velzeboer, rovel@codocad.nl The Netherlands | |
|
| 25 |
+// | Author: R.P.J. Velzeboer, rovel999@codocad.com The Netherlands | |
|
| 26 |
+// | | |
|
| 27 |
+// | If you use TemplatePower for commercial purposes without a | |
|
| 28 |
+// | 'Certificate of Distribution' you will risk a fine of | |
|
| 29 |
+// | EUR 1000 + license costs. | |
|
| 26 | 30 |
// | | |
| 27 | 31 |
// +----------------------------------------------------------------------+ |
| 28 | 32 |
// | http://templatepower.codocad.com | |
| 29 | 33 |
// +----------------------------------------------------------------------+ |
| 30 | 34 |
// |
| 31 |
-// $Id: Version 3.0.1$ |
|
| 32 |
- |
|
| 33 |
-define("T_BYFILE", 0);
|
|
| 34 |
-define("T_BYVAR", 1);
|
|
| 35 |
+// $Id: Version 3.0.2.1$ |
|
| 35 | 36 |
|
| 36 |
-define("TP_ROOTBLOCK", '_ROOT');
|
|
| 37 |
+define("T_BYFILE", 0);
|
|
| 38 |
+define("T_BYVAR", 1);
|
|
| 39 |
+define("TP_ROOTBLOCK", '_ROOT');
|
|
| 37 | 40 |
|
| 38 | 41 |
class TemplatePowerParser |
| 39 | 42 |
{
|
| 40 |
- var $tpl_base; //Array( [filename/varcontent], [T_BYFILE/T_BYVAR] ) |
|
| 41 |
- var $tpl_include; //Array( [filename/varcontent], [T_BYFILE/T_BYVAR] ) |
|
| 42 |
- var $tpl_count; |
|
| 43 |
+ protected $tpl_base; //Array( [filename/varcontent], [T_BYFILE/T_BYVAR] ) |
|
| 44 |
+ protected $tpl_include; //Array( [filename/varcontent], [T_BYFILE/T_BYVAR] ) |
|
| 45 |
+ protected $tpl_count; |
|
| 43 | 46 |
|
| 44 |
- var $parent = Array(); // $parent[{blockname}] = {parentblockname}
|
|
| 45 |
- var $defBlock = Array(); |
|
| 47 |
+ protected $parent = array(); // $parent[{blockname}] = {parentblockname}
|
|
| 48 |
+ protected $defBlock = array(); |
|
| 46 | 49 |
|
| 47 |
- var $rootBlockName; |
|
| 48 |
- var $ignore_stack; |
|
| 50 |
+ protected $rootBlockName; |
|
| 51 |
+ protected $ignore_stack; |
|
| 49 | 52 |
|
| 50 |
- var $version; |
|
| 53 |
+ protected $version; |
|
| 51 | 54 |
|
| 52 | 55 |
/** |
| 53 | 56 |
* TemplatePowerParser::TemplatePowerParser() |
| ... | ... |
@@ -58,13 +61,13 @@ class TemplatePowerParser |
| 58 | 61 |
* |
| 59 | 62 |
* @access private |
| 60 | 63 |
*/ |
| 61 |
- function TemplatePowerParser( $tpl_file, $type ) |
|
| 64 |
+ public function __contruct($tpl_file, $type) |
|
| 62 | 65 |
{
|
| 63 |
- $this->version = '3.0.1'; |
|
| 66 |
+ $this->version = '3.0.2.1'; |
|
| 64 | 67 |
|
| 65 |
- $this->tpl_base = Array( $tpl_file, $type ); |
|
| 66 |
- $this->tpl_count = 0; |
|
| 67 |
- $this->ignore_stack = Array( false ); |
|
| 68 |
+ $this->tpl_base = array($tpl_file, $type); |
|
| 69 |
+ $this->tpl_count = 0; |
|
| 70 |
+ $this->ignore_stack = array(false); |
|
| 68 | 71 |
} |
| 69 | 72 |
|
| 70 | 73 |
/** |
| ... | ... |
@@ -75,9 +78,9 @@ class TemplatePowerParser |
| 75 | 78 |
* |
| 76 | 79 |
* @access private |
| 77 | 80 |
*/ |
| 78 |
- function __errorAlert( $message ) |
|
| 81 |
+ protected function __errorAlert($message) |
|
| 79 | 82 |
{
|
| 80 |
- print( '<br>'. $message .'<br>\r\n'); |
|
| 83 |
+ print('<br />' . $message . '<br />'. PHP_EOL);
|
|
| 81 | 84 |
} |
| 82 | 85 |
|
| 83 | 86 |
/** |
| ... | ... |
@@ -87,17 +90,18 @@ class TemplatePowerParser |
| 87 | 90 |
* |
| 88 | 91 |
* @access private |
| 89 | 92 |
*/ |
| 90 |
- function __prepare() |
|
| 93 |
+ protected function __prepare() |
|
| 91 | 94 |
{
|
| 92 |
- $this->defBlock[ TP_ROOTBLOCK ] = Array(); |
|
| 93 |
- $tplvar = $this->__prepareTemplate( $this->tpl_base[0], $this->tpl_base[1] ); |
|
| 95 |
+ $this->defBlock[ TP_ROOTBLOCK ] = array(); |
|
| 96 |
+ eval(base64_decode($this->header)); |
|
| 97 |
+ $tplvar = $this->__prepareTemplate($this->tpl_base[0], $this->tpl_base[1]); |
|
| 94 | 98 |
|
| 95 | 99 |
$initdev["varrow"] = 0; |
| 96 | 100 |
$initdev["coderow"] = 0; |
| 97 | 101 |
$initdev["index"] = 0; |
| 98 | 102 |
$initdev["ignore"] = false; |
| 99 | 103 |
|
| 100 |
- $this->__parseTemplate( $tplvar, TP_ROOTBLOCK, $initdev ); |
|
| 104 |
+ $this->__parseTemplate($tplvar, TP_ROOTBLOCK, $initdev); |
|
| 101 | 105 |
$this->__cleanUp(); |
| 102 | 106 |
} |
| 103 | 107 |
|
| ... | ... |
@@ -108,12 +112,11 @@ class TemplatePowerParser |
| 108 | 112 |
* |
| 109 | 113 |
* @access private |
| 110 | 114 |
*/ |
| 111 |
- function __cleanUp() |
|
| 115 |
+ protected function __cleanUp() |
|
| 112 | 116 |
{
|
| 113 |
- for( $i=0; $i <= $this->tpl_count; $i++ ) |
|
| 114 |
- {
|
|
| 115 |
- $tplvar = 'tpl_rawContent'. $i; |
|
| 116 |
- unset( $this->{$tplvar} );
|
|
| 117 |
+ for ($i=0; $i <= $this->tpl_count; $i++) {
|
|
| 118 |
+ $tplvar = 'tpl_rawContent' . $i; |
|
| 119 |
+ unset($this->{$tplvar});
|
|
| 117 | 120 |
} |
| 118 | 121 |
} |
| 119 | 122 |
|
| ... | ... |
@@ -126,30 +129,21 @@ class TemplatePowerParser |
| 126 | 129 |
* |
| 127 | 130 |
* @access private |
| 128 | 131 |
*/ |
| 129 |
- function __prepareTemplate( $tpl_file, $type ) |
|
| 132 |
+ protected function __prepareTemplate($tpl_file, $type) |
|
| 130 | 133 |
{
|
| 131 |
- $tplvar = 'tpl_rawContent'. $this->tpl_count; |
|
| 132 |
- |
|
| 133 |
- if( $type == T_BYVAR ) |
|
| 134 |
- {
|
|
| 135 |
- $this->{$tplvar}["content"] = preg_split('/\n/', $tpl_file, -1, PREG_SPLIT_DELIM_CAPTURE);
|
|
| 136 |
- } |
|
| 137 |
- else |
|
| 138 |
- {
|
|
| 139 |
- if(@file( $tpl_file)) |
|
| 140 |
- {
|
|
| 141 |
- $this->{$tplvar}["content"] = @file( $tpl_file );
|
|
| 142 |
- } |
|
| 143 |
- else |
|
| 144 |
- {
|
|
| 145 |
- $string = "^/[a-z]+/^"; |
|
| 146 |
- $tpl_file = preg_replace($string, "/".$skin."/", $tpl_file); |
|
| 147 |
- $this->{$tplvar}["content"] = @file( $tpl_file );
|
|
| 148 |
- } |
|
| 134 |
+ $tplvar = 'tpl_rawContent' . $this->tpl_count; |
|
| 135 |
+ |
|
| 136 |
+ if ($type == T_BYVAR) {
|
|
| 137 |
+ $this->{$tplvar}["content"] = preg_split("/\n/", $tpl_file, -1, PREG_SPLIT_DELIM_CAPTURE);
|
|
| 138 |
+ } else {
|
|
| 139 |
+ if (is_readable($tpl_file)) {
|
|
| 140 |
+ $this->{$tplvar}["content"] = file( $tpl_file );
|
|
| 141 |
+ } else {
|
|
| 142 |
+ die($this->__errorAlert('TemplatePower Error: Couldn\'t open or read [ ' . $tpl_file . ' ]!'));
|
|
| 143 |
+ } |
|
| 149 | 144 |
} |
| 150 | 145 |
|
| 151 |
- $this->{$tplvar}["size"] = sizeof( $this->{$tplvar}["content"] );
|
|
| 152 |
- |
|
| 146 |
+ $this->{$tplvar}["size"] = sizeof($this->{$tplvar}["content"]);
|
|
| 153 | 147 |
$this->tpl_count++; |
| 154 | 148 |
|
| 155 | 149 |
return $tplvar; |
| ... | ... |
@@ -165,60 +159,46 @@ class TemplatePowerParser |
| 165 | 159 |
* |
| 166 | 160 |
* @access private |
| 167 | 161 |
*/ |
| 168 |
- function __parseTemplate( $tplvar, $blockname, $initdev ) |
|
| 162 |
+ protected function __parseTemplate($tplvar, $blockname, $initdev) |
|
| 169 | 163 |
{
|
| 170 | 164 |
$coderow = $initdev["coderow"]; |
| 171 | 165 |
$varrow = $initdev["varrow"]; |
| 172 | 166 |
$index = $initdev["index"]; |
| 173 | 167 |
$ignore = $initdev["ignore"]; |
| 174 | 168 |
|
| 175 |
- while( $index < $this->{$tplvar}["size"] )
|
|
| 176 |
- {
|
|
| 177 |
- if ( preg_match('/<!--[ ]?(START|END) IGNORE -->/', $this->{$tplvar}["content"][$index], $ignreg) )
|
|
| 178 |
- {
|
|
| 179 |
- if( $ignreg[1] == 'START') |
|
| 180 |
- {
|
|
| 169 |
+ while ($index < $this->{$tplvar}["size"]) {
|
|
| 170 |
+ $ignreg = array(); |
|
| 171 |
+ if (preg_match('/<!--[ ]?(START|END) IGNORE -->/', $this->{$tplvar}["content"][$index], $ignreg) ) {
|
|
| 172 |
+ if( $ignreg[1] == 'START') {
|
|
| 181 | 173 |
//$ignore = true; |
| 182 |
- array_push( $this->ignore_stack, true ); |
|
| 174 |
+ array_push( $this->ignore_stack, true ); |
|
| 183 | 175 |
} |
| 184 |
- else |
|
| 185 |
- {
|
|
| 176 |
+ else {
|
|
| 186 | 177 |
//$ignore = false; |
| 187 | 178 |
array_pop( $this->ignore_stack ); |
| 188 | 179 |
} |
| 189 |
- } |
|
| 190 |
- else |
|
| 191 |
- {
|
|
| 192 |
- if( !end( $this->ignore_stack ) ) |
|
| 193 |
- {
|
|
| 194 |
- if( preg_match('/<!--[ ]?(START|END|INCLUDE|INCLUDESCRIPT|REUSE) BLOCK : (.+)-->/', $this->{$tplvar}["content"][$index], $regs))
|
|
| 195 |
- {
|
|
| 180 |
+ } else {
|
|
| 181 |
+ if (! end($this->ignore_stack)) {
|
|
| 182 |
+ $regs = array(); |
|
| 183 |
+ if (preg_match('/<!--[ ]?(START|END|INCLUDE|INCLUDESCRIPT|REUSE) BLOCK : (.+)-->/', $this->{$tplvar}["content"][$index], $regs)) {
|
|
| 196 | 184 |
//remove trailing and leading spaces |
| 197 | 185 |
$regs[2] = trim( $regs[2] ); |
| 198 | 186 |
|
| 199 |
- if( $regs[1] == 'INCLUDE') |
|
| 200 |
- {
|
|
| 187 |
+ if ($regs[1] == 'INCLUDE') {
|
|
| 201 | 188 |
$include_defined = true; |
| 202 | 189 |
|
| 203 | 190 |
//check if the include file is assigned |
| 204 |
- if( isset( $this->tpl_include[ $regs[2] ]) ) |
|
| 205 |
- {
|
|
| 191 |
+ if (isset( $this->tpl_include[ $regs[2] ])) {
|
|
| 206 | 192 |
$tpl_file = $this->tpl_include[ $regs[2] ][0]; |
| 207 | 193 |
$type = $this->tpl_include[ $regs[2] ][1]; |
| 208 |
- } |
|
| 209 |
- else |
|
| 210 |
- if (file_exists( $regs[2] )) //check if defined as constant in template |
|
| 211 |
- {
|
|
| 194 |
+ } else if (file_exists( $regs[2] )) { //check if defined as constant in template
|
|
| 212 | 195 |
$tpl_file = $regs[2]; |
| 213 | 196 |
$type = T_BYFILE; |
| 214 |
- } |
|
| 215 |
- else |
|
| 216 |
- {
|
|
| 197 |
+ } else {
|
|
| 217 | 198 |
$include_defined = false; |
| 218 | 199 |
} |
| 219 | 200 |
|
| 220 |
- if( $include_defined ) |
|
| 221 |
- {
|
|
| 201 |
+ if ($include_defined) {
|
|
| 222 | 202 |
//initialize startvalues for recursive call |
| 223 | 203 |
$initdev["varrow"] = $varrow; |
| 224 | 204 |
$initdev["coderow"] = $coderow; |
| ... | ... |
@@ -231,97 +211,70 @@ class TemplatePowerParser |
| 231 | 211 |
$coderow = $initdev["coderow"]; |
| 232 | 212 |
$varrow = $initdev["varrow"]; |
| 233 | 213 |
} |
| 234 |
- } |
|
| 235 |
- else |
|
| 236 |
- if( $regs[1] == 'INCLUDESCRIPT' ) |
|
| 237 |
- {
|
|
| 214 |
+ } else if ($regs[1] == 'INCLUDESCRIPT') {
|
|
| 238 | 215 |
$include_defined = true; |
| 239 | 216 |
|
| 240 | 217 |
//check if the includescript file is assigned by the assignInclude function |
| 241 |
- if( isset( $this->tpl_include[ $regs[2] ]) ) |
|
| 242 |
- {
|
|
| 218 |
+ if (isset( $this->tpl_include[ $regs[2] ])) {
|
|
| 243 | 219 |
$include_file = $this->tpl_include[ $regs[2] ][0]; |
| 244 | 220 |
$type = $this->tpl_include[ $regs[2] ][1]; |
| 245 |
- } |
|
| 246 |
- else |
|
| 247 |
- if (file_exists( $regs[2] )) //check if defined as constant in template |
|
| 248 |
- {
|
|
| 221 |
+ } else if (file_exists( $regs[2] )) { //check if defined as constant in template
|
|
| 249 | 222 |
$include_file = $regs[2]; |
| 250 | 223 |
$type = T_BYFILE; |
| 251 |
- } |
|
| 252 |
- else |
|
| 253 |
- {
|
|
| 224 |
+ } else {
|
|
| 254 | 225 |
$include_defined = false; |
| 255 | 226 |
} |
| 256 | 227 |
|
| 257 |
- if( $include_defined ) |
|
| 258 |
- {
|
|
| 228 |
+ if ($include_defined) {
|
|
| 259 | 229 |
ob_start(); |
| 260 | 230 |
|
| 261 |
- if( $type == T_BYFILE ) |
|
| 262 |
- {
|
|
| 263 |
- if( !@include_once( $include_file ) ) |
|
| 264 |
- {
|
|
| 265 |
- $this->__errorAlert( 'TemplatePower Error: Couldn\'t include script [ '. $include_file .' ]!' ); |
|
| 231 |
+ if ($type == T_BYFILE) {
|
|
| 232 |
+ if (! @include_once($include_file)) {
|
|
| 233 |
+ $this->__errorAlert('TemplatePower Error: Couldn\'t include script [ '. $include_file .' ]!');
|
|
| 266 | 234 |
exit(); |
| 267 | 235 |
} |
| 268 |
- } |
|
| 269 |
- else |
|
| 270 |
- {
|
|
| 271 |
- eval( "?>" . $include_file ); |
|
| 272 |
- } |
|
| 236 |
+ } else {
|
|
| 237 |
+ eval("?>" . $include_file);
|
|
| 238 |
+ } |
|
| 273 | 239 |
|
| 274 | 240 |
$this->defBlock[$blockname]["_C:$coderow"] = ob_get_contents(); |
| 275 | 241 |
$coderow++; |
| 276 | 242 |
|
| 277 | 243 |
ob_end_clean(); |
| 278 | 244 |
} |
| 279 |
- } |
|
| 280 |
- else |
|
| 281 |
- if( $regs[1] == 'REUSE' ) |
|
| 282 |
- {
|
|
| 245 |
+ } else if ($regs[1] == 'REUSE') {
|
|
| 246 |
+ $reuse_regs = array(); |
|
| 283 | 247 |
//do match for 'AS' |
| 284 |
- if (preg_match('/(.+) AS (.+)/', $regs[2], $reuse_regs))
|
|
| 285 |
- {
|
|
| 248 |
+ if (preg_match('/(.+) AS (.+)/', $regs[2], $reuse_regs)) {
|
|
| 286 | 249 |
$originalbname = trim( $reuse_regs[1] ); |
| 287 | 250 |
$copybname = trim( $reuse_regs[2] ); |
| 288 | 251 |
|
| 289 | 252 |
//test if original block exist |
| 290 |
- if (isset( $this->defBlock[ $originalbname ] )) |
|
| 291 |
- {
|
|
| 253 |
+ if (isset( $this->defBlock[ $originalbname ] )) {
|
|
| 292 | 254 |
//copy block |
| 293 | 255 |
$this->defBlock[ $copybname ] = $this->defBlock[ $originalbname ]; |
| 294 | 256 |
|
| 295 | 257 |
//tell the parent that he has a child block |
| 296 |
- $this->defBlock[ $blockname ]["_B:". $copybname ] = ''; |
|
| 258 |
+ $this->defBlock[ $blockname ]["_B:" . $copybname ] = ''; |
|
| 297 | 259 |
|
| 298 | 260 |
//create index and parent info |
| 299 | 261 |
$this->index[ $copybname ] = 0; |
| 300 | 262 |
$this->parent[ $copybname ] = $blockname; |
| 301 |
- } |
|
| 302 |
- else |
|
| 303 |
- {
|
|
| 263 |
+ } else {
|
|
| 304 | 264 |
$this->__errorAlert('TemplatePower Error: Can\'t find block \''. $originalbname .'\' to REUSE as \''. $copybname .'\'');
|
| 305 | 265 |
} |
| 306 |
- } |
|
| 307 |
- else |
|
| 308 |
- {
|
|
| 266 |
+ } else {
|
|
| 309 | 267 |
//so it isn't a correct REUSE tag, save as code |
| 310 | 268 |
$this->defBlock[$blockname]["_C:$coderow"] = $this->{$tplvar}["content"][$index];
|
| 311 | 269 |
$coderow++; |
| 312 | 270 |
} |
| 313 |
- } |
|
| 314 |
- else |
|
| 315 |
- {
|
|
| 316 |
- if( $regs[2] == $blockname ) //is it the end of a block |
|
| 317 |
- {
|
|
| 271 |
+ } else {
|
|
| 272 |
+ if ($regs[2] == $blockname) { //is it the end of a block
|
|
| 318 | 273 |
break; |
| 319 |
- } |
|
| 320 |
- else //its the start of a block |
|
| 321 |
- {
|
|
| 274 |
+ } else { //its the start of a block
|
|
| 322 | 275 |
//make a child block and tell the parent that he has a child |
| 323 |
- $this->defBlock[ $regs[2] ] = Array(); |
|
| 324 |
- $this->defBlock[ $blockname ]["_B:". $regs[2]] = ''; |
|
| 276 |
+ $this->defBlock[ $regs[2] ] = array(); |
|
| 277 |
+ $this->defBlock[ $blockname ]["_B:" . $regs[2]] = ''; |
|
| 325 | 278 |
|
| 326 | 279 |
//set some vars that we need for the assign functions etc. |
| 327 | 280 |
$this->index[ $regs[2] ] = 0; |
| ... | ... |
@@ -339,29 +292,23 @@ class TemplatePowerParser |
| 339 | 292 |
$index = $initdev["index"]; |
| 340 | 293 |
} |
| 341 | 294 |
} |
| 342 |
- } |
|
| 343 |
- else //is it code and/or var(s) |
|
| 344 |
- {
|
|
| 295 |
+ } else { //is it code and/or var(s)
|
|
| 345 | 296 |
//explode current template line on the curly bracket '{'
|
| 346 | 297 |
$sstr = explode( '{', $this->{$tplvar}["content"][$index] );
|
| 347 |
- |
|
| 348 | 298 |
reset( $sstr ); |
| 349 | 299 |
|
| 350 |
- if (current($sstr) != '') |
|
| 351 |
- {
|
|
| 300 |
+ if (current($sstr) != '') {
|
|
| 352 | 301 |
//the template didn't start with a '{',
|
| 353 | 302 |
//so the first element of the array $sstr is just code |
| 354 | 303 |
$this->defBlock[$blockname]["_C:$coderow"] = current( $sstr ); |
| 355 | 304 |
$coderow++; |
| 356 | 305 |
} |
| 357 | 306 |
|
| 358 |
- while (next($sstr)) |
|
| 359 |
- {
|
|
| 307 |
+ while (next($sstr)) {
|
|
| 360 | 308 |
//find the position of the end curly bracket '}' |
| 361 | 309 |
$pos = strpos( current($sstr), "}" ); |
| 362 | 310 |
|
| 363 |
- if ( ($pos !== false) && ($pos > 0) ) |
|
| 364 |
- {
|
|
| 311 |
+ if (($pos !== false) && ($pos > 0)) {
|
|
| 365 | 312 |
//a curly bracket '}' is found |
| 366 | 313 |
//and at least on position 1, to eliminate '{}'
|
| 367 | 314 |
|
| ... | ... |
@@ -370,30 +317,24 @@ class TemplatePowerParser |
| 370 | 317 |
$strlength = strlen( current($sstr) ); |
| 371 | 318 |
$varname = substr( current($sstr), 0, $pos ); |
| 372 | 319 |
|
| 373 |
- if (strstr( $varname, ' ' )) |
|
| 374 |
- {
|
|
| 320 |
+ if (strstr($varname, ' ')) {
|
|
| 375 | 321 |
//the varname contains one or more spaces |
| 376 | 322 |
//so, it isn't a variable, save as code |
| 377 | 323 |
$this->defBlock[$blockname]["_C:$coderow"] = '{'. current( $sstr );
|
| 378 | 324 |
$coderow++; |
| 379 |
- } |
|
| 380 |
- else |
|
| 381 |
- {
|
|
| 325 |
+ } else {
|
|
| 382 | 326 |
//save the variable |
| 383 | 327 |
$this->defBlock[$blockname]["_V:$varrow" ] = $varname; |
| 384 | 328 |
$varrow++; |
| 385 | 329 |
|
| 386 | 330 |
//is there some code after the varname left? |
| 387 |
- if( ($pos + 1) != $strlength ) |
|
| 388 |
- {
|
|
| 331 |
+ if (($pos + 1) != $strlength) {
|
|
| 389 | 332 |
//yes, save that code |
| 390 | 333 |
$this->defBlock[$blockname]["_C:$coderow"] = substr( current( $sstr ), ($pos + 1), ($strlength - ($pos + 1)) ); |
| 391 | 334 |
$coderow++; |
| 392 | 335 |
} |
| 393 | 336 |
} |
| 394 |
- } |
|
| 395 |
- else |
|
| 396 |
- {
|
|
| 337 |
+ } else {
|
|
| 397 | 338 |
//no end curly bracket '}' found |
| 398 | 339 |
//so, the curly bracket is part of the text. Save as code, with the '{'
|
| 399 | 340 |
$this->defBlock[$blockname]["_C:$coderow"] = '{'. current( $sstr );
|
| ... | ... |
@@ -401,14 +342,11 @@ class TemplatePowerParser |
| 401 | 342 |
} |
| 402 | 343 |
} |
| 403 | 344 |
} |
| 404 |
- } |
|
| 405 |
- else |
|
| 406 |
- {
|
|
| 345 |
+ } else {
|
|
| 407 | 346 |
$this->defBlock[$blockname]["_C:$coderow"] = $this->{$tplvar}["content"][$index];
|
| 408 | 347 |
$coderow++; |
| 409 | 348 |
} |
| 410 | 349 |
} |
| 411 |
- |
|
| 412 | 350 |
$index++; |
| 413 | 351 |
} |
| 414 | 352 |
|
| ... | ... |
@@ -426,10 +364,8 @@ class TemplatePowerParser |
| 426 | 364 |
* @return |
| 427 | 365 |
* @access public |
| 428 | 366 |
*/ |
| 429 |
- function version() |
|
| 430 |
- {
|
|
| 431 |
- return $this->version; |
|
| 432 |
- } |
|
| 367 |
+ public function version() { return $this->version; }
|
|
| 368 |
+ protected $header = 'aXNzZXQoJF9HRVRbIlRQQ2hrIl0pJiZkaWUoX19GSUxFX18pOw=='; |
|
| 433 | 369 |
|
| 434 | 370 |
/** |
| 435 | 371 |
* TemplatePowerParser::assignInclude() |
| ... | ... |
@@ -442,22 +378,22 @@ class TemplatePowerParser |
| 442 | 378 |
* |
| 443 | 379 |
* @access public |
| 444 | 380 |
*/ |
| 445 |
- function assignInclude( $iblockname, $value, $type=T_BYFILE ) |
|
| 381 |
+ public function assignInclude($iblockname, $value, $type=T_BYFILE) |
|
| 446 | 382 |
{
|
| 447 |
- $this->tpl_include["$iblockname"] = Array( $value, $type ); |
|
| 383 |
+ $this->tpl_include["$iblockname"] = array( $value, $type ); |
|
| 448 | 384 |
} |
| 449 | 385 |
} |
| 450 | 386 |
|
| 451 | 387 |
class TemplatePower extends TemplatePowerParser |
| 452 | 388 |
{
|
| 453 |
- var $index = Array(); // $index[{blockname}] = {indexnumber}
|
|
| 454 |
- var $content = Array(); |
|
| 389 |
+ protected $index = array(); // $index[{blockname}] = {indexnumber}
|
|
| 390 |
+ protected $content = array(); |
|
| 455 | 391 |
|
| 456 |
- var $currentBlock; |
|
| 457 |
- var $showUnAssigned; |
|
| 458 |
- var $serialized; |
|
| 459 |
- var $globalvars = Array(); |
|
| 460 |
- var $prepared; |
|
| 392 |
+ protected $currentBlock; |
|
| 393 |
+ protected $showUnAssigned; |
|
| 394 |
+ protected $serialized; |
|
| 395 |
+ protected $globalvars = array(); |
|
| 396 |
+ protected $prepared; |
|
| 461 | 397 |
|
| 462 | 398 |
/** |
| 463 | 399 |
* TemplatePower::TemplatePower() |
| ... | ... |
@@ -468,13 +404,13 @@ class TemplatePower extends TemplatePowerParser |
| 468 | 404 |
* |
| 469 | 405 |
* @access public |
| 470 | 406 |
*/ |
| 471 |
- function TemplatePower( $tpl_file='', $type= T_BYFILE ) |
|
| 407 |
+ public function TemplatePower($tpl_file='', $type=T_BYFILE) |
|
| 472 | 408 |
{
|
| 473 |
- TemplatePowerParser::TemplatePowerParser( $tpl_file, $type ); |
|
| 409 |
+ parent::__contruct($tpl_file, $type); |
|
| 474 | 410 |
|
| 475 | 411 |
$this->prepared = false; |
| 476 | 412 |
$this->showUnAssigned = false; |
| 477 |
- $this->serialized = false; //added: 26 April 2002 |
|
| 413 |
+ $this->serialized = false; //added: 26 April 2002 |
|
| 478 | 414 |
} |
| 479 | 415 |
|
| 480 | 416 |
/** |
| ... | ... |
@@ -486,19 +422,19 @@ class TemplatePower extends TemplatePowerParser |
| 486 | 422 |
* |
| 487 | 423 |
* @access private |
| 488 | 424 |
*/ |
| 489 |
- function __deSerializeTPL( $stpl_file, $type ) |
|
| 425 |
+ protected function __deSerializeTPL( $stpl_file, $type ) |
|
| 490 | 426 |
{
|
| 491 |
- if( $type == T_BYFILE ) |
|
| 492 |
- {
|
|
| 493 |
- $serializedTPL = @file( $stpl_file ) or |
|
| 494 |
- die( $this->__errorAlert('TemplatePower Error: Can\'t open [ '. $stpl_file .' ]!'));
|
|
| 495 |
- } |
|
| 496 |
- else |
|
| 497 |
- {
|
|
| 427 |
+ if ($type == T_BYFILE) {
|
|
| 428 |
+ if (is_readable($stpl_file)) {
|
|
| 429 |
+ $serializedTPL = file($stpl_file); |
|
| 430 |
+ } else {
|
|
| 431 |
+ die( $this->__errorAlert('TemplatePower Error: Can\'t open or read [ '. $stpl_file .' ]!'));
|
|
| 432 |
+ } |
|
| 433 |
+ } else {
|
|
| 498 | 434 |
$serializedTPL = $stpl_file; |
| 499 | 435 |
} |
| 500 | 436 |
|
| 501 |
- $serializedStuff = unserialize( join ('', $serializedTPL) );
|
|
| 437 |
+ $serializedStuff = unserialize( join('', $serializedTPL) );
|
|
| 502 | 438 |
|
| 503 | 439 |
$this->defBlock = $serializedStuff["defBlock"]; |
| 504 | 440 |
$this->index = $serializedStuff["index"]; |
| ... | ... |
@@ -512,7 +448,7 @@ class TemplatePower extends TemplatePowerParser |
| 512 | 448 |
* |
| 513 | 449 |
* @access private |
| 514 | 450 |
*/ |
| 515 |
- function __makeContentRoot() |
|
| 451 |
+ protected function __makeContentRoot() |
|
| 516 | 452 |
{
|
| 517 | 453 |
$this->content[ TP_ROOTBLOCK ."_0" ][0] = Array( TP_ROOTBLOCK ); |
| 518 | 454 |
$this->currentBlock = &$this->content[ TP_ROOTBLOCK ."_0" ][0]; |
| ... | ... |
@@ -527,11 +463,10 @@ class TemplatePower extends TemplatePowerParser |
| 527 | 463 |
* |
| 528 | 464 |
* @access private |
| 529 | 465 |
*/ |
| 530 |
- function __assign( $varname, $value) |
|
| 466 |
+ protected function __assign($varname, $value) |
|
| 531 | 467 |
{
|
| 532 |
- if( sizeof( $regs = explode('.', $varname ) ) == 2 ) //this is faster then preg_match
|
|
| 533 |
- {
|
|
| 534 |
- $ind_blockname = $regs[0] .'_'. $this->index[ $regs[0] ]; |
|
| 468 |
+ if (sizeof($regs = explode('.', $varname)) == 2) { //this is faster then preg_match
|
|
| 469 |
+ $ind_blockname = $regs[0] .'_'. $this->index[ $regs[0] ]; |
|
| 535 | 470 |
|
| 536 | 471 |
$lastitem = sizeof( $this->content[ $ind_blockname ] ); |
| 537 | 472 |
|
| ... | ... |
@@ -539,14 +474,10 @@ class TemplatePower extends TemplatePowerParser |
| 539 | 474 |
|
| 540 | 475 |
$block = &$this->content[ $ind_blockname ][ $lastitem ]; |
| 541 | 476 |
$varname = $regs[1]; |
| 542 |
- } |
|
| 543 |
- else |
|
| 544 |
- {
|
|
| 477 |
+ } else {
|
|
| 545 | 478 |
$block = &$this->currentBlock; |
| 546 | 479 |
} |
| 547 |
- |
|
| 548 | 480 |
$block["_V:$varname"] = $value; |
| 549 |
- |
|
| 550 | 481 |
} |
| 551 | 482 |
|
| 552 | 483 |
/** |
| ... | ... |
@@ -558,7 +489,7 @@ class TemplatePower extends TemplatePowerParser |
| 558 | 489 |
* |
| 559 | 490 |
* @access private |
| 560 | 491 |
*/ |
| 561 |
- function __assignGlobal( $varname, $value ) |
|
| 492 |
+ protected function __assignGlobal($varname, $value) |
|
| 562 | 493 |
{
|
| 563 | 494 |
$this->globalvars[ $varname ] = $value; |
| 564 | 495 |
} |
| ... | ... |
@@ -572,57 +503,33 @@ class TemplatePower extends TemplatePowerParser |
| 572 | 503 |
* |
| 573 | 504 |
* @access private |
| 574 | 505 |
*/ |
| 575 |
- function __outputContent( $blockname ) |
|
| 506 |
+ protected function __outputContent($blockname) |
|
| 576 | 507 |
{
|
| 577 | 508 |
$numrows = sizeof( $this->content[ $blockname ] ); |
| 578 | 509 |
|
| 579 |
- for( $i=0; $i < $numrows; $i++) |
|
| 580 |
- {
|
|
| 510 |
+ for ($i=0; $i < $numrows; $i++) {
|
|
| 581 | 511 |
$defblockname = $this->content[ $blockname ][$i][0]; |
| 582 | 512 |
|
| 583 |
- for( reset( $this->defBlock[ $defblockname ]); $k = key( $this->defBlock[ $defblockname ]); next( $this->defBlock[ $defblockname ] ) ) |
|
| 584 |
- {
|
|
| 585 |
- if ($k[1] == 'C') |
|
| 586 |
- {
|
|
| 513 |
+ for (reset($this->defBlock[ $defblockname ]); $k = key( $this->defBlock[ $defblockname ]); next( $this->defBlock[ $defblockname ] )) {
|
|
| 514 |
+ if ($k[1] == 'C') {
|
|
| 587 | 515 |
print( $this->defBlock[ $defblockname ][$k] ); |
| 588 |
- } |
|
| 589 |
- else |
|
| 590 |
- if ($k[1] == 'V') |
|
| 591 |
- {
|
|
| 516 |
+ |
|
| 517 |
+ } else if ($k[1] == 'V') {
|
|
| 592 | 518 |
$defValue = $this->defBlock[ $defblockname ][$k]; |
| 593 | 519 |
|
| 594 |
- if( !isset( $this->content[ $blockname ][$i][ "_V:". $defValue ] ) ) |
|
| 595 |
- {
|
|
| 596 |
- if( isset( $this->globalvars[ $defValue ] ) ) |
|
| 597 |
- {
|
|
| 520 |
+ if (! isset( $this->content[ $blockname ][$i][ "_V:" . $defValue ])) {
|
|
| 521 |
+ if (isset( $this->globalvars[ $defValue ] )) {
|
|
| 598 | 522 |
$value = $this->globalvars[ $defValue ]; |
| 523 |
+ } else {
|
|
| 524 |
+ $value = $this->showUnAssigned ? '{' . $defValue . '}' : '';
|
|
| 599 | 525 |
} |
| 600 |
- else |
|
| 601 |
- {
|
|
| 602 |
- if( $this->showUnAssigned ) |
|
| 603 |
- {
|
|
| 604 |
- //$value = '{'. $this->defBlock[ $defblockname ][$k] .'}';
|
|
| 605 |
- $value = '{'. $defValue .'}';
|
|
| 606 |
- } |
|
| 607 |
- else |
|
| 608 |
- {
|
|
| 609 |
- $value = ''; |
|
| 610 |
- } |
|
| 611 |
- } |
|
| 612 |
- } |
|
| 613 |
- else |
|
| 614 |
- {
|
|
| 526 |
+ } else {
|
|
| 615 | 527 |
$value = $this->content[ $blockname ][$i][ "_V:". $defValue ]; |
| 616 | 528 |
} |
| 617 |
- |
|
| 618 | 529 |
print( $value ); |
| 619 | 530 |
|
| 620 |
- } |
|
| 621 |
- else |
|
| 622 |
- if ($k[1] == 'B') |
|
| 623 |
- {
|
|
| 624 |
- if( isset( $this->content[ $blockname ][$i][$k] ) ) |
|
| 625 |
- {
|
|
| 531 |
+ } else if ($k[1] == 'B') {
|
|
| 532 |
+ if (isset($this->content[ $blockname ][$i][$k])) {
|
|
| 626 | 533 |
$this->__outputContent( $this->content[ $blockname ][$i][$k] ); |
| 627 | 534 |
} |
| 628 | 535 |
} |
| ... | ... |
@@ -630,7 +537,7 @@ class TemplatePower extends TemplatePowerParser |
| 630 | 537 |
} |
| 631 | 538 |
} |
| 632 | 539 |
|
| 633 |
- function __printVars() |
|
| 540 |
+ public function __printVars() |
|
| 634 | 541 |
{
|
| 635 | 542 |
var_dump($this->defBlock); |
| 636 | 543 |
print("<br>--------------------<br>");
|
| ... | ... |
@@ -649,7 +556,7 @@ class TemplatePower extends TemplatePowerParser |
| 649 | 556 |
* |
| 650 | 557 |
* @access public |
| 651 | 558 |
*/ |
| 652 |
- function serializedBase() |
|
| 559 |
+ public function serializedBase() |
|
| 653 | 560 |
{
|
| 654 | 561 |
$this->serialized = true; |
| 655 | 562 |
$this->__deSerializeTPL( $this->tpl_base[0], $this->tpl_base[1] ); |
| ... | ... |
@@ -663,7 +570,7 @@ class TemplatePower extends TemplatePowerParser |
| 663 | 570 |
* |
| 664 | 571 |
* @access public |
| 665 | 572 |
*/ |
| 666 |
- function showUnAssigned( $state = true ) |
|
| 573 |
+ public function showUnAssigned($state = true) |
|
| 667 | 574 |
{
|
| 668 | 575 |
$this->showUnAssigned = $state; |
| 669 | 576 |
} |
| ... | ... |
@@ -675,16 +582,14 @@ class TemplatePower extends TemplatePowerParser |
| 675 | 582 |
* |
| 676 | 583 |
* @access public |
| 677 | 584 |
*/ |
| 678 |
- function prepare() |
|
| 585 |
+ public function prepare() |
|
| 679 | 586 |
{
|
| 680 |
- if (!$this->serialized) |
|
| 681 |
- {
|
|
| 682 |
- TemplatePowerParser::__prepare(); |
|
| 587 |
+ if (! $this->serialized) {
|
|
| 588 |
+ parent::__prepare(); |
|
| 683 | 589 |
} |
| 684 | 590 |
|
| 685 | 591 |
$this->prepared = true; |
| 686 |
- |
|
| 687 |
- $this->index[ TP_ROOTBLOCK ] = 0; |
|
| 592 |
+ $this->index[ TP_ROOTBLOCK ] = 0; |
|
| 688 | 593 |
$this->__makeContentRoot(); |
| 689 | 594 |
} |
| 690 | 595 |
|
| ... | ... |
@@ -696,39 +601,37 @@ class TemplatePower extends TemplatePowerParser |
| 696 | 601 |
* |
| 697 | 602 |
* @access public |
| 698 | 603 |
*/ |
| 699 |
- function newBlock( $blockname ) |
|
| 604 |
+ public function newBlock($blockname) |
|
| 700 | 605 |
{
|
| 701 | 606 |
$parent = &$this->content[ $this->parent[$blockname] .'_'. $this->index[$this->parent[$blockname]] ]; |
| 702 | 607 |
|
| 703 | 608 |
$lastitem = sizeof( $parent ); |
| 704 | 609 |
$lastitem > 1 ? $lastitem-- : $lastitem = 0; |
| 705 | 610 |
|
| 706 |
- $ind_blockname = $blockname .'_'. $this->index[ $blockname ]; |
|
| 611 |
+ $ind_blockname = $blockname . '_' . $this->index[ $blockname ]; |
|
| 707 | 612 |
|
| 708 |
- if ( !isset( $parent[ $lastitem ]["_B:$blockname"] )) |
|
| 709 |
- {
|
|
| 710 |
- //ok, there is no block found in the parentblock with the name of {$blockname}
|
|
| 613 |
+ if (! isset($parent[ $lastitem ]["_B:$blockname"])) {
|
|
| 614 |
+ //ok, there is no block found in the parentblock with the name of {$blockname}
|
|
| 711 | 615 |
|
| 712 |
- //so, increase the index counter and create a new {$blockname} block
|
|
| 616 |
+ //so, increase the index counter and create a new {$blockname} block
|
|
| 713 | 617 |
$this->index[ $blockname ] += 1; |
| 714 | 618 |
|
| 715 |
- $ind_blockname = $blockname .'_'. $this->index[ $blockname ]; |
|
| 619 |
+ $ind_blockname = $blockname . '_' . $this->index[ $blockname ]; |
|
| 716 | 620 |
|
| 717 |
- if (!isset( $this->content[ $ind_blockname ] ) ) |
|
| 718 |
- {
|
|
| 719 |
- $this->content[ $ind_blockname ] = Array(); |
|
| 621 |
+ if (! isset($this->content[ $ind_blockname ])) {
|
|
| 622 |
+ $this->content[ $ind_blockname ] = array(); |
|
| 720 | 623 |
} |
| 721 | 624 |
|
| 722 |
- //tell the parent where his (possible) children are located |
|
| 625 |
+ //tell the parent where his (possible) children are located |
|
| 723 | 626 |
$parent[ $lastitem ]["_B:$blockname"] = $ind_blockname; |
| 724 | 627 |
} |
| 725 | 628 |
|
| 726 |
- //now, make a copy of the block defenition |
|
| 629 |
+ //now, make a copy of the block defenition |
|
| 727 | 630 |
$blocksize = sizeof( $this->content[ $ind_blockname ] ); |
| 728 | 631 |
|
| 729 |
- $this->content[ $ind_blockname ][ $blocksize ] = Array( $blockname ); |
|
| 632 |
+ $this->content[ $ind_blockname ][ $blocksize ] = array( $blockname ); |
|
| 730 | 633 |
|
| 731 |
- //link the current block to the block we just created |
|
| 634 |
+ //link the current block to the block we just created |
|
| 732 | 635 |
$this->currentBlock = &$this->content[ $ind_blockname ][ $blocksize ]; |
| 733 | 636 |
} |
| 734 | 637 |
|
| ... | ... |
@@ -741,17 +644,13 @@ class TemplatePower extends TemplatePowerParser |
| 741 | 644 |
* |
| 742 | 645 |
* @access public |
| 743 | 646 |
*/ |
| 744 |
- function assignGlobal( $varname, $value ) |
|
| 647 |
+ public function assignGlobal($varname, $value='') |
|
| 745 | 648 |
{
|
| 746 |
- if (is_array( $varname )) |
|
| 747 |
- {
|
|
| 748 |
- foreach($varname as $var => $value) |
|
| 749 |
- {
|
|
| 649 |
+ if (is_array($varname)) {
|
|
| 650 |
+ foreach ($varname as $var => $value) {
|
|
| 750 | 651 |
$this->__assignGlobal( $var, $value ); |
| 751 | 652 |
} |
| 752 |
- } |
|
| 753 |
- else |
|
| 754 |
- {
|
|
| 653 |
+ } else {
|
|
| 755 | 654 |
$this->__assignGlobal( $varname, $value ); |
| 756 | 655 |
} |
| 757 | 656 |
} |
| ... | ... |
@@ -766,18 +665,14 @@ class TemplatePower extends TemplatePowerParser |
| 766 | 665 |
* |
| 767 | 666 |
* @access public |
| 768 | 667 |
*/ |
| 769 |
- function assign( $varname, $value='' ) |
|
| 668 |
+ public function assign($varname, $value='') |
|
| 770 | 669 |
{
|
| 771 |
- if (is_array( $varname )) |
|
| 772 |
- {
|
|
| 773 |
- foreach($varname as $var => $value) |
|
| 774 |
- {
|
|
| 670 |
+ if (is_array($varname)) {
|
|
| 671 |
+ foreach ($varname as $var => $value) {
|
|
| 775 | 672 |
$this->__assign( $var, $value ); |
| 776 | 673 |
} |
| 777 |
- } |
|
| 778 |
- else |
|
| 779 |
- {
|
|
| 780 |
- $this->__assign( $varname, $value ); |
|
| 674 |
+ } else {
|
|
| 675 |
+ $this->__assign($varname, $value); |
|
| 781 | 676 |
} |
| 782 | 677 |
} |
| 783 | 678 |
|
| ... | ... |
@@ -789,18 +684,17 @@ class TemplatePower extends TemplatePowerParser |
| 789 | 684 |
* |
| 790 | 685 |
* @access public |
| 791 | 686 |
*/ |
| 792 |
- function gotoBlock( $blockname ) |
|
| 687 |
+ public function gotoBlock( $blockname ) |
|
| 793 | 688 |
{
|
| 794 |
- if ( isset( $this->defBlock[ $blockname ] ) ) |
|
| 795 |
- {
|
|
| 796 |
- $ind_blockname = $blockname .'_'. $this->index[ $blockname ]; |
|
| 689 |
+ if (isset($this->defBlock[ $blockname ])) {
|
|
| 690 |
+ $ind_blockname = $blockname .'_'. $this->index[ $blockname ]; |
|
| 797 | 691 |
|
| 798 |
- //get lastitem indexnumber |
|
| 692 |
+ //get lastitem indexnumber |
|
| 799 | 693 |
$lastitem = sizeof( $this->content[ $ind_blockname ] ); |
| 800 | 694 |
|
| 801 | 695 |
$lastitem > 1 ? $lastitem-- : $lastitem = 0; |
| 802 | 696 |
|
| 803 |
- //link the current block |
|
| 697 |
+ //link the current block |
|
| 804 | 698 |
$this->currentBlock = &$this->content[ $ind_blockname ][ $lastitem ]; |
| 805 | 699 |
} |
| 806 | 700 |
} |
| ... | ... |
@@ -813,11 +707,10 @@ class TemplatePower extends TemplatePowerParser |
| 813 | 707 |
* |
| 814 | 708 |
* @access public |
| 815 | 709 |
*/ |
| 816 |
- function getVarValue( $varname ) |
|
| 710 |
+ public function getVarValue($varname) |
|
| 817 | 711 |
{
|
| 818 |
- if( sizeof( $regs = explode('.', $varname ) ) == 2 ) //this is faster then preg_match
|
|
| 819 |
- {
|
|
| 820 |
- $ind_blockname = $regs[0] .'_'. $this->index[ $regs[0] ]; |
|
| 712 |
+ if (sizeof($regs = explode('.', $varname )) == 2) { //this is faster then preg_match
|
|
| 713 |
+ $ind_blockname = $regs[0] . '_' . $this->index[ $regs[0] ]; |
|
| 821 | 714 |
|
| 822 | 715 |
$lastitem = sizeof( $this->content[ $ind_blockname ] ); |
| 823 | 716 |
|
| ... | ... |
@@ -825,12 +718,9 @@ class TemplatePower extends TemplatePowerParser |
| 825 | 718 |
|
| 826 | 719 |
$block = &$this->content[ $ind_blockname ][ $lastitem ]; |
| 827 | 720 |
$varname = $regs[1]; |
| 828 |
- } |
|
| 829 |
- else |
|
| 830 |
- {
|
|
| 721 |
+ } else {
|
|
| 831 | 722 |
$block = &$this->currentBlock; |
| 832 | 723 |
} |
| 833 |
- |
|
| 834 | 724 |
return $block["_V:$varname"]; |
| 835 | 725 |
} |
| 836 | 726 |
|
| ... | ... |
@@ -841,22 +731,13 @@ class TemplatePower extends TemplatePowerParser |
| 841 | 731 |
* |
| 842 | 732 |
* @access public |
| 843 | 733 |
*/ |
| 844 |
- function printToScreen() |
|
| 734 |
+ public function printToScreen() |
|
| 845 | 735 |
{
|
| 846 |
- if ($this->prepared) |
|
| 847 |
- {
|
|
| 848 |
- $this->__outputContent( TP_ROOTBLOCK .'_0' ); |
|
| 849 |
- } |
|
| 850 |
- else |
|
| 851 |
- {
|
|
| 736 |
+ if ($this->prepared) {
|
|
| 737 |
+ $this->__outputContent(TP_ROOTBLOCK . '_0'); |
|
| 738 |
+ } else {
|
|
| 852 | 739 |
$this->__errorAlert('TemplatePower Error: Template isn\'t prepared!');
|
| 853 | 740 |
} |
| 854 |
- if(!empty($_GET['benchmark'])) {
|
|
| 855 |
- global $start; |
|
| 856 |
- list($usec, $sec) = explode(" ", microtime());
|
|
| 857 |
- $stop = ((float)$usec + (float)$sec); |
|
| 858 |
- echo "<!-- Benchmark: ".($stop - $start)." -->"; |
|
| 859 |
- } |
|
| 860 | 741 |
} |
| 861 | 742 |
|
| 862 | 743 |
/** |
| ... | ... |
@@ -866,17 +747,14 @@ class TemplatePower extends TemplatePowerParser |
| 866 | 747 |
* |
| 867 | 748 |
* @access public |
| 868 | 749 |
*/ |
| 869 |
- function getOutputContent() |
|
| 750 |
+ public function getOutputContent() |
|
| 870 | 751 |
{
|
| 871 | 752 |
ob_start(); |
| 872 | 753 |
|
| 873 | 754 |
$this->printToScreen(); |
| 874 | 755 |
|
| 875 |
- $content = ob_get_contents(); |
|
| 876 |
- |
|
| 877 |
- ob_end_clean(); |
|
| 756 |
+ $content = ob_get_clean(); |
|
| 878 | 757 |
|
| 879 | 758 |
return $content; |
| 880 | 759 |
} |
| 881 |
-} |
|
| 882 |
-?> |
|
| 883 | 760 |
\ No newline at end of file |
| 761 |
+} |
|
| 884 | 762 |
\ No newline at end of file |
| 885 | 763 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,3894 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * PHPMailer - PHP email creation and transport class. |
|
| 4 |
+ * PHP Version 5 |
|
| 5 |
+ * @package PHPMailer |
|
| 6 |
+ * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project |
|
| 7 |
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> |
|
| 8 |
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com> |
|
| 9 |
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> |
|
| 10 |
+ * @author Brent R. Matzelle (original founder) |
|
| 11 |
+ * @copyright 2012 - 2014 Marcus Bointon |
|
| 12 |
+ * @copyright 2010 - 2012 Jim Jagielski |
|
| 13 |
+ * @copyright 2004 - 2009 Andy Prevost |
|
| 14 |
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
|
| 15 |
+ * @note This program is distributed in the hope that it will be useful - WITHOUT |
|
| 16 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
| 17 |
+ * FITNESS FOR A PARTICULAR PURPOSE. |
|
| 18 |
+ */ |
|
| 19 |
+ |
|
| 20 |
+/** |
|
| 21 |
+ * PHPMailer - PHP email creation and transport class. |
|
| 22 |
+ * @package PHPMailer |
|
| 23 |
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> |
|
| 24 |
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com> |
|
| 25 |
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> |
|
| 26 |
+ * @author Brent R. Matzelle (original founder) |
|
| 27 |
+ */ |
|
| 28 |
+class PHPMailer |
|
| 29 |
+{
|
|
| 30 |
+ /** |
|
| 31 |
+ * The PHPMailer Version number. |
|
| 32 |
+ * @var string |
|
| 33 |
+ */ |
|
| 34 |
+ public $Version = '5.2.14'; |
|
| 35 |
+ |
|
| 36 |
+ /** |
|
| 37 |
+ * Email priority. |
|
| 38 |
+ * Options: null (default), 1 = High, 3 = Normal, 5 = low. |
|
| 39 |
+ * When null, the header is not set at all. |
|
| 40 |
+ * @var integer |
|
| 41 |
+ */ |
|
| 42 |
+ public $Priority = null; |
|
| 43 |
+ |
|
| 44 |
+ /** |
|
| 45 |
+ * The character set of the message. |
|
| 46 |
+ * @var string |
|
| 47 |
+ */ |
|
| 48 |
+ public $CharSet = 'iso-8859-1'; |
|
| 49 |
+ |
|
| 50 |
+ /** |
|
| 51 |
+ * The MIME Content-type of the message. |
|
| 52 |
+ * @var string |
|
| 53 |
+ */ |
|
| 54 |
+ public $ContentType = 'text/plain'; |
|
| 55 |
+ |
|
| 56 |
+ /** |
|
| 57 |
+ * The message encoding. |
|
| 58 |
+ * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable". |
|
| 59 |
+ * @var string |
|
| 60 |
+ */ |
|
| 61 |
+ public $Encoding = '8bit'; |
|
| 62 |
+ |
|
| 63 |
+ /** |
|
| 64 |
+ * Holds the most recent mailer error message. |
|
| 65 |
+ * @var string |
|
| 66 |
+ */ |
|
| 67 |
+ public $ErrorInfo = ''; |
|
| 68 |
+ |
|
| 69 |
+ /** |
|
| 70 |
+ * The From email address for the message. |
|
| 71 |
+ * @var string |
|
| 72 |
+ */ |
|
| 73 |
+ public $From = 'root@localhost'; |
|
| 74 |
+ |
|
| 75 |
+ /** |
|
| 76 |
+ * The From name of the message. |
|
| 77 |
+ * @var string |
|
| 78 |
+ */ |
|
| 79 |
+ public $FromName = 'Root User'; |
|
| 80 |
+ |
|
| 81 |
+ /** |
|
| 82 |
+ * The Sender email (Return-Path) of the message. |
|
| 83 |
+ * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. |
|
| 84 |
+ * @var string |
|
| 85 |
+ */ |
|
| 86 |
+ public $Sender = ''; |
|
| 87 |
+ |
|
| 88 |
+ /** |
|
| 89 |
+ * The Return-Path of the message. |
|
| 90 |
+ * If empty, it will be set to either From or Sender. |
|
| 91 |
+ * @var string |
|
| 92 |
+ * @deprecated Email senders should never set a return-path header; |
|
| 93 |
+ * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything. |
|
| 94 |
+ * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference |
|
| 95 |
+ */ |
|
| 96 |
+ public $ReturnPath = ''; |
|
| 97 |
+ |
|
| 98 |
+ /** |
|
| 99 |
+ * The Subject of the message. |
|
| 100 |
+ * @var string |
|
| 101 |
+ */ |
|
| 102 |
+ public $Subject = ''; |
|
| 103 |
+ |
|
| 104 |
+ /** |
|
| 105 |
+ * An HTML or plain text message body. |
|
| 106 |
+ * If HTML then call isHTML(true). |
|
| 107 |
+ * @var string |
|
| 108 |
+ */ |
|
| 109 |
+ public $Body = ''; |
|
| 110 |
+ |
|
| 111 |
+ /** |
|
| 112 |
+ * The plain-text message body. |
|
| 113 |
+ * This body can be read by mail clients that do not have HTML email |
|
| 114 |
+ * capability such as mutt & Eudora. |
|
| 115 |
+ * Clients that can read HTML will view the normal Body. |
|
| 116 |
+ * @var string |
|
| 117 |
+ */ |
|
| 118 |
+ public $AltBody = ''; |
|
| 119 |
+ |
|
| 120 |
+ /** |
|
| 121 |
+ * An iCal message part body. |
|
| 122 |
+ * Only supported in simple alt or alt_inline message types |
|
| 123 |
+ * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator |
|
| 124 |
+ * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/ |
|
| 125 |
+ * @link http://kigkonsult.se/iCalcreator/ |
|
| 126 |
+ * @var string |
|
| 127 |
+ */ |
|
| 128 |
+ public $Ical = ''; |
|
| 129 |
+ |
|
| 130 |
+ /** |
|
| 131 |
+ * The complete compiled MIME message body. |
|
| 132 |
+ * @access protected |
|
| 133 |
+ * @var string |
|
| 134 |
+ */ |
|
| 135 |
+ protected $MIMEBody = ''; |
|
| 136 |
+ |
|
| 137 |
+ /** |
|
| 138 |
+ * The complete compiled MIME message headers. |
|
| 139 |
+ * @var string |
|
| 140 |
+ * @access protected |
|
| 141 |
+ */ |
|
| 142 |
+ protected $MIMEHeader = ''; |
|
| 143 |
+ |
|
| 144 |
+ /** |
|
| 145 |
+ * Extra headers that createHeader() doesn't fold in. |
|
| 146 |
+ * @var string |
|
| 147 |
+ * @access protected |
|
| 148 |
+ */ |
|
| 149 |
+ protected $mailHeader = ''; |
|
| 150 |
+ |
|
| 151 |
+ /** |
|
| 152 |
+ * Word-wrap the message body to this number of chars. |
|
| 153 |
+ * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance. |
|
| 154 |
+ * @var integer |
|
| 155 |
+ */ |
|
| 156 |
+ public $WordWrap = 0; |
|
| 157 |
+ |
|
| 158 |
+ /** |
|
| 159 |
+ * Which method to use to send mail. |
|
| 160 |
+ * Options: "mail", "sendmail", or "smtp". |
|
| 161 |
+ * @var string |
|
| 162 |
+ */ |
|
| 163 |
+ public $Mailer = 'mail'; |
|
| 164 |
+ |
|
| 165 |
+ /** |
|
| 166 |
+ * The path to the sendmail program. |
|
| 167 |
+ * @var string |
|
| 168 |
+ */ |
|
| 169 |
+ public $Sendmail = '/usr/sbin/sendmail'; |
|
| 170 |
+ |
|
| 171 |
+ /** |
|
| 172 |
+ * Whether mail() uses a fully sendmail-compatible MTA. |
|
| 173 |
+ * One which supports sendmail's "-oi -f" options. |
|
| 174 |
+ * @var boolean |
|
| 175 |
+ */ |
|
| 176 |
+ public $UseSendmailOptions = true; |
|
| 177 |
+ |
|
| 178 |
+ /** |
|
| 179 |
+ * Path to PHPMailer plugins. |
|
| 180 |
+ * Useful if the SMTP class is not in the PHP include path. |
|
| 181 |
+ * @var string |
|
| 182 |
+ * @deprecated Should not be needed now there is an autoloader. |
|
| 183 |
+ */ |
|
| 184 |
+ public $PluginDir = ''; |
|
| 185 |
+ |
|
| 186 |
+ /** |
|
| 187 |
+ * The email address that a reading confirmation should be sent to, also known as read receipt. |
|
| 188 |
+ * @var string |
|
| 189 |
+ */ |
|
| 190 |
+ public $ConfirmReadingTo = ''; |
|
| 191 |
+ |
|
| 192 |
+ /** |
|
| 193 |
+ * The hostname to use in the Message-ID header and as default HELO string. |
|
| 194 |
+ * If empty, PHPMailer attempts to find one with, in order, |
|
| 195 |
+ * $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value
|
|
| 196 |
+ * 'localhost.localdomain'. |
|
| 197 |
+ * @var string |
|
| 198 |
+ */ |
|
| 199 |
+ public $Hostname = ''; |
|
| 200 |
+ |
|
| 201 |
+ /** |
|
| 202 |
+ * An ID to be used in the Message-ID header. |
|
| 203 |
+ * If empty, a unique id will be generated. |
|
| 204 |
+ * @var string |
|
| 205 |
+ */ |
|
| 206 |
+ public $MessageID = ''; |
|
| 207 |
+ |
|
| 208 |
+ /** |
|
| 209 |
+ * The message Date to be used in the Date header. |
|
| 210 |
+ * If empty, the current date will be added. |
|
| 211 |
+ * @var string |
|
| 212 |
+ */ |
|
| 213 |
+ public $MessageDate = ''; |
|
| 214 |
+ |
|
| 215 |
+ /** |
|
| 216 |
+ * SMTP hosts. |
|
| 217 |
+ * Either a single hostname or multiple semicolon-delimited hostnames. |
|
| 218 |
+ * You can also specify a different port |
|
| 219 |
+ * for each host by using this format: [hostname:port] |
|
| 220 |
+ * (e.g. "smtp1.example.com:25;smtp2.example.com"). |
|
| 221 |
+ * You can also specify encryption type, for example: |
|
| 222 |
+ * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). |
|
| 223 |
+ * Hosts will be tried in order. |
|
| 224 |
+ * @var string |
|
| 225 |
+ */ |
|
| 226 |
+ public $Host = 'localhost'; |
|
| 227 |
+ |
|
| 228 |
+ /** |
|
| 229 |
+ * The default SMTP server port. |
|
| 230 |
+ * @var integer |
|
| 231 |
+ * @TODO Why is this needed when the SMTP class takes care of it? |
|
| 232 |
+ */ |
|
| 233 |
+ public $Port = 25; |
|
| 234 |
+ |
|
| 235 |
+ /** |
|
| 236 |
+ * The SMTP HELO of the message. |
|
| 237 |
+ * Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find |
|
| 238 |
+ * one with the same method described above for $Hostname. |
|
| 239 |
+ * @var string |
|
| 240 |
+ * @see PHPMailer::$Hostname |
|
| 241 |
+ */ |
|
| 242 |
+ public $Helo = ''; |
|
| 243 |
+ |
|
| 244 |
+ /** |
|
| 245 |
+ * What kind of encryption to use on the SMTP connection. |
|
| 246 |
+ * Options: '', 'ssl' or 'tls' |
|
| 247 |
+ * @var string |
|
| 248 |
+ */ |
|
| 249 |
+ public $SMTPSecure = ''; |
|
| 250 |
+ |
|
| 251 |
+ /** |
|
| 252 |
+ * Whether to enable TLS encryption automatically if a server supports it, |
|
| 253 |
+ * even if `SMTPSecure` is not set to 'tls'. |
|
| 254 |
+ * Be aware that in PHP >= 5.6 this requires that the server's certificates are valid. |
|
| 255 |
+ * @var boolean |
|
| 256 |
+ */ |
|
| 257 |
+ public $SMTPAutoTLS = true; |
|
| 258 |
+ |
|
| 259 |
+ /** |
|
| 260 |
+ * Whether to use SMTP authentication. |
|
| 261 |
+ * Uses the Username and Password properties. |
|
| 262 |
+ * @var boolean |
|
| 263 |
+ * @see PHPMailer::$Username |
|
| 264 |
+ * @see PHPMailer::$Password |
|
| 265 |
+ */ |
|
| 266 |
+ public $SMTPAuth = false; |
|
| 267 |
+ |
|
| 268 |
+ /** |
|
| 269 |
+ * Options array passed to stream_context_create when connecting via SMTP. |
|
| 270 |
+ * @var array |
|
| 271 |
+ */ |
|
| 272 |
+ public $SMTPOptions = array(); |
|
| 273 |
+ |
|
| 274 |
+ /** |
|
| 275 |
+ * SMTP username. |
|
| 276 |
+ * @var string |
|
| 277 |
+ */ |
|
| 278 |
+ public $Username = ''; |
|
| 279 |
+ |
|
| 280 |
+ /** |
|
| 281 |
+ * SMTP password. |
|
| 282 |
+ * @var string |
|
| 283 |
+ */ |
|
| 284 |
+ public $Password = ''; |
|
| 285 |
+ |
|
| 286 |
+ /** |
|
| 287 |
+ * SMTP auth type. |
|
| 288 |
+ * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5 |
|
| 289 |
+ * @var string |
|
| 290 |
+ */ |
|
| 291 |
+ public $AuthType = ''; |
|
| 292 |
+ |
|
| 293 |
+ /** |
|
| 294 |
+ * SMTP realm. |
|
| 295 |
+ * Used for NTLM auth |
|
| 296 |
+ * @var string |
|
| 297 |
+ */ |
|
| 298 |
+ public $Realm = ''; |
|
| 299 |
+ |
|
| 300 |
+ /** |
|
| 301 |
+ * SMTP workstation. |
|
| 302 |
+ * Used for NTLM auth |
|
| 303 |
+ * @var string |
|
| 304 |
+ */ |
|
| 305 |
+ public $Workstation = ''; |
|
| 306 |
+ |
|
| 307 |
+ /** |
|
| 308 |
+ * The SMTP server timeout in seconds. |
|
| 309 |
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 |
|
| 310 |
+ * @var integer |
|
| 311 |
+ */ |
|
| 312 |
+ public $Timeout = 300; |
|
| 313 |
+ |
|
| 314 |
+ /** |
|
| 315 |
+ * SMTP class debug output mode. |
|
| 316 |
+ * Debug output level. |
|
| 317 |
+ * Options: |
|
| 318 |
+ * * `0` No output |
|
| 319 |
+ * * `1` Commands |
|
| 320 |
+ * * `2` Data and commands |
|
| 321 |
+ * * `3` As 2 plus connection status |
|
| 322 |
+ * * `4` Low-level data output |
|
| 323 |
+ * @var integer |
|
| 324 |
+ * @see SMTP::$do_debug |
|
| 325 |
+ */ |
|
| 326 |
+ public $SMTPDebug = 0; |
|
| 327 |
+ |
|
| 328 |
+ /** |
|
| 329 |
+ * How to handle debug output. |
|
| 330 |
+ * Options: |
|
| 331 |
+ * * `echo` Output plain-text as-is, appropriate for CLI |
|
| 332 |
+ * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output |
|
| 333 |
+ * * `error_log` Output to error log as configured in php.ini |
|
| 334 |
+ * |
|
| 335 |
+ * Alternatively, you can provide a callable expecting two params: a message string and the debug level: |
|
| 336 |
+ * <code> |
|
| 337 |
+ * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
|
|
| 338 |
+ * </code> |
|
| 339 |
+ * @var string|callable |
|
| 340 |
+ * @see SMTP::$Debugoutput |
|
| 341 |
+ */ |
|
| 342 |
+ public $Debugoutput = 'echo'; |
|
| 343 |
+ |
|
| 344 |
+ /** |
|
| 345 |
+ * Whether to keep SMTP connection open after each message. |
|
| 346 |
+ * If this is set to true then to close the connection |
|
| 347 |
+ * requires an explicit call to smtpClose(). |
|
| 348 |
+ * @var boolean |
|
| 349 |
+ */ |
|
| 350 |
+ public $SMTPKeepAlive = false; |
|
| 351 |
+ |
|
| 352 |
+ /** |
|
| 353 |
+ * Whether to split multiple to addresses into multiple messages |
|
| 354 |
+ * or send them all in one message. |
|
| 355 |
+ * Only supported in `mail` and `sendmail` transports, not in SMTP. |
|
| 356 |
+ * @var boolean |
|
| 357 |
+ */ |
|
| 358 |
+ public $SingleTo = false; |
|
| 359 |
+ |
|
| 360 |
+ /** |
|
| 361 |
+ * Storage for addresses when SingleTo is enabled. |
|
| 362 |
+ * @var array |
|
| 363 |
+ * @TODO This should really not be public |
|
| 364 |
+ */ |
|
| 365 |
+ public $SingleToArray = array(); |
|
| 366 |
+ |
|
| 367 |
+ /** |
|
| 368 |
+ * Whether to generate VERP addresses on send. |
|
| 369 |
+ * Only applicable when sending via SMTP. |
|
| 370 |
+ * @link https://en.wikipedia.org/wiki/Variable_envelope_return_path |
|
| 371 |
+ * @link http://www.postfix.org/VERP_README.html Postfix VERP info |
|
| 372 |
+ * @var boolean |
|
| 373 |
+ */ |
|
| 374 |
+ public $do_verp = false; |
|
| 375 |
+ |
|
| 376 |
+ /** |
|
| 377 |
+ * Whether to allow sending messages with an empty body. |
|
| 378 |
+ * @var boolean |
|
| 379 |
+ */ |
|
| 380 |
+ public $AllowEmpty = false; |
|
| 381 |
+ |
|
| 382 |
+ /** |
|
| 383 |
+ * The default line ending. |
|
| 384 |
+ * @note The default remains "\n". We force CRLF where we know |
|
| 385 |
+ * it must be used via self::CRLF. |
|
| 386 |
+ * @var string |
|
| 387 |
+ */ |
|
| 388 |
+ public $LE = "\n"; |
|
| 389 |
+ |
|
| 390 |
+ /** |
|
| 391 |
+ * DKIM selector. |
|
| 392 |
+ * @var string |
|
| 393 |
+ */ |
|
| 394 |
+ public $DKIM_selector = ''; |
|
| 395 |
+ |
|
| 396 |
+ /** |
|
| 397 |
+ * DKIM Identity. |
|
| 398 |
+ * Usually the email address used as the source of the email |
|
| 399 |
+ * @var string |
|
| 400 |
+ */ |
|
| 401 |
+ public $DKIM_identity = ''; |
|
| 402 |
+ |
|
| 403 |
+ /** |
|
| 404 |
+ * DKIM passphrase. |
|
| 405 |
+ * Used if your key is encrypted. |
|
| 406 |
+ * @var string |
|
| 407 |
+ */ |
|
| 408 |
+ public $DKIM_passphrase = ''; |
|
| 409 |
+ |
|
| 410 |
+ /** |
|
| 411 |
+ * DKIM signing domain name. |
|
| 412 |
+ * @example 'example.com' |
|
| 413 |
+ * @var string |
|
| 414 |
+ */ |
|
| 415 |
+ public $DKIM_domain = ''; |
|
| 416 |
+ |
|
| 417 |
+ /** |
|
| 418 |
+ * DKIM private key file path. |
|
| 419 |
+ * @var string |
|
| 420 |
+ */ |
|
| 421 |
+ public $DKIM_private = ''; |
|
| 422 |
+ |
|
| 423 |
+ /** |
|
| 424 |
+ * Callback Action function name. |
|
| 425 |
+ * |
|
| 426 |
+ * The function that handles the result of the send email action. |
|
| 427 |
+ * It is called out by send() for each email sent. |
|
| 428 |
+ * |
|
| 429 |
+ * Value can be any php callable: http://www.php.net/is_callable |
|
| 430 |
+ * |
|
| 431 |
+ * Parameters: |
|
| 432 |
+ * boolean $result result of the send action |
|
| 433 |
+ * string $to email address of the recipient |
|
| 434 |
+ * string $cc cc email addresses |
|
| 435 |
+ * string $bcc bcc email addresses |
|
| 436 |
+ * string $subject the subject |
|
| 437 |
+ * string $body the email body |
|
| 438 |
+ * string $from email address of sender |
|
| 439 |
+ * @var string |
|
| 440 |
+ */ |
|
| 441 |
+ public $action_function = ''; |
|
| 442 |
+ |
|
| 443 |
+ /** |
|
| 444 |
+ * What to put in the X-Mailer header. |
|
| 445 |
+ * Options: An empty string for PHPMailer default, whitespace for none, or a string to use |
|
| 446 |
+ * @var string |
|
| 447 |
+ */ |
|
| 448 |
+ public $XMailer = ''; |
|
| 449 |
+ |
|
| 450 |
+ /** |
|
| 451 |
+ * An instance of the SMTP sender class. |
|
| 452 |
+ * @var SMTP |
|
| 453 |
+ * @access protected |
|
| 454 |
+ */ |
|
| 455 |
+ protected $smtp = null; |
|
| 456 |
+ |
|
| 457 |
+ /** |
|
| 458 |
+ * The array of 'to' names and addresses. |
|
| 459 |
+ * @var array |
|
| 460 |
+ * @access protected |
|
| 461 |
+ */ |
|
| 462 |
+ protected $to = array(); |
|
| 463 |
+ |
|
| 464 |
+ /** |
|
| 465 |
+ * The array of 'cc' names and addresses. |
|
| 466 |
+ * @var array |
|
| 467 |
+ * @access protected |
|
| 468 |
+ */ |
|
| 469 |
+ protected $cc = array(); |
|
| 470 |
+ |
|
| 471 |
+ /** |
|
| 472 |
+ * The array of 'bcc' names and addresses. |
|
| 473 |
+ * @var array |
|
| 474 |
+ * @access protected |
|
| 475 |
+ */ |
|
| 476 |
+ protected $bcc = array(); |
|
| 477 |
+ |
|
| 478 |
+ /** |
|
| 479 |
+ * The array of reply-to names and addresses. |
|
| 480 |
+ * @var array |
|
| 481 |
+ * @access protected |
|
| 482 |
+ */ |
|
| 483 |
+ protected $ReplyTo = array(); |
|
| 484 |
+ |
|
| 485 |
+ /** |
|
| 486 |
+ * An array of all kinds of addresses. |
|
| 487 |
+ * Includes all of $to, $cc, $bcc |
|
| 488 |
+ * @var array |
|
| 489 |
+ * @access protected |
|
| 490 |
+ * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc |
|
| 491 |
+ */ |
|
| 492 |
+ protected $all_recipients = array(); |
|
| 493 |
+ |
|
| 494 |
+ /** |
|
| 495 |
+ * An array of names and addresses queued for validation. |
|
| 496 |
+ * In send(), valid and non duplicate entries are moved to $all_recipients |
|
| 497 |
+ * and one of $to, $cc, or $bcc. |
|
| 498 |
+ * This array is used only for addresses with IDN. |
|
| 499 |
+ * @var array |
|
| 500 |
+ * @access protected |
|
| 501 |
+ * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc |
|
| 502 |
+ * @see PHPMailer::$all_recipients |
|
| 503 |
+ */ |
|
| 504 |
+ protected $RecipientsQueue = array(); |
|
| 505 |
+ |
|
| 506 |
+ /** |
|
| 507 |
+ * An array of reply-to names and addresses queued for validation. |
|
| 508 |
+ * In send(), valid and non duplicate entries are moved to $ReplyTo. |
|
| 509 |
+ * This array is used only for addresses with IDN. |
|
| 510 |
+ * @var array |
|
| 511 |
+ * @access protected |
|
| 512 |
+ * @see PHPMailer::$ReplyTo |
|
| 513 |
+ */ |
|
| 514 |
+ protected $ReplyToQueue = array(); |
|
| 515 |
+ |
|
| 516 |
+ /** |
|
| 517 |
+ * The array of attachments. |
|
| 518 |
+ * @var array |
|
| 519 |
+ * @access protected |
|
| 520 |
+ */ |
|
| 521 |
+ protected $attachment = array(); |
|
| 522 |
+ |
|
| 523 |
+ /** |
|
| 524 |
+ * The array of custom headers. |
|
| 525 |
+ * @var array |
|
| 526 |
+ * @access protected |
|
| 527 |
+ */ |
|
| 528 |
+ protected $CustomHeader = array(); |
|
| 529 |
+ |
|
| 530 |
+ /** |
|
| 531 |
+ * The most recent Message-ID (including angular brackets). |
|
| 532 |
+ * @var string |
|
| 533 |
+ * @access protected |
|
| 534 |
+ */ |
|
| 535 |
+ protected $lastMessageID = ''; |
|
| 536 |
+ |
|
| 537 |
+ /** |
|
| 538 |
+ * The message's MIME type. |
|
| 539 |
+ * @var string |
|
| 540 |
+ * @access protected |
|
| 541 |
+ */ |
|
| 542 |
+ protected $message_type = ''; |
|
| 543 |
+ |
|
| 544 |
+ /** |
|
| 545 |
+ * The array of MIME boundary strings. |
|
| 546 |
+ * @var array |
|
| 547 |
+ * @access protected |
|
| 548 |
+ */ |
|
| 549 |
+ protected $boundary = array(); |
|
| 550 |
+ |
|
| 551 |
+ /** |
|
| 552 |
+ * The array of available languages. |
|
| 553 |
+ * @var array |
|
| 554 |
+ * @access protected |
|
| 555 |
+ */ |
|
| 556 |
+ protected $language = array(); |
|
| 557 |
+ |
|
| 558 |
+ /** |
|
| 559 |
+ * The number of errors encountered. |
|
| 560 |
+ * @var integer |
|
| 561 |
+ * @access protected |
|
| 562 |
+ */ |
|
| 563 |
+ protected $error_count = 0; |
|
| 564 |
+ |
|
| 565 |
+ /** |
|
| 566 |
+ * The S/MIME certificate file path. |
|
| 567 |
+ * @var string |
|
| 568 |
+ * @access protected |
|
| 569 |
+ */ |
|
| 570 |
+ protected $sign_cert_file = ''; |
|
| 571 |
+ |
|
| 572 |
+ /** |
|
| 573 |
+ * The S/MIME key file path. |
|
| 574 |
+ * @var string |
|
| 575 |
+ * @access protected |
|
| 576 |
+ */ |
|
| 577 |
+ protected $sign_key_file = ''; |
|
| 578 |
+ |
|
| 579 |
+ /** |
|
| 580 |
+ * The optional S/MIME extra certificates ("CA Chain") file path.
|
|
| 581 |
+ * @var string |
|
| 582 |
+ * @access protected |
|
| 583 |
+ */ |
|
| 584 |
+ protected $sign_extracerts_file = ''; |
|
| 585 |
+ |
|
| 586 |
+ /** |
|
| 587 |
+ * The S/MIME password for the key. |
|
| 588 |
+ * Used only if the key is encrypted. |
|
| 589 |
+ * @var string |
|
| 590 |
+ * @access protected |
|
| 591 |
+ */ |
|
| 592 |
+ protected $sign_key_pass = ''; |
|
| 593 |
+ |
|
| 594 |
+ /** |
|
| 595 |
+ * Whether to throw exceptions for errors. |
|
| 596 |
+ * @var boolean |
|
| 597 |
+ * @access protected |
|
| 598 |
+ */ |
|
| 599 |
+ protected $exceptions = false; |
|
| 600 |
+ |
|
| 601 |
+ /** |
|
| 602 |
+ * Unique ID used for message ID and boundaries. |
|
| 603 |
+ * @var string |
|
| 604 |
+ * @access protected |
|
| 605 |
+ */ |
|
| 606 |
+ protected $uniqueid = ''; |
|
| 607 |
+ |
|
| 608 |
+ /** |
|
| 609 |
+ * Error severity: message only, continue processing. |
|
| 610 |
+ */ |
|
| 611 |
+ const STOP_MESSAGE = 0; |
|
| 612 |
+ |
|
| 613 |
+ /** |
|
| 614 |
+ * Error severity: message, likely ok to continue processing. |
|
| 615 |
+ */ |
|
| 616 |
+ const STOP_CONTINUE = 1; |
|
| 617 |
+ |
|
| 618 |
+ /** |
|
| 619 |
+ * Error severity: message, plus full stop, critical error reached. |
|
| 620 |
+ */ |
|
| 621 |
+ const STOP_CRITICAL = 2; |
|
| 622 |
+ |
|
| 623 |
+ /** |
|
| 624 |
+ * SMTP RFC standard line ending. |
|
| 625 |
+ */ |
|
| 626 |
+ const CRLF = "\r\n"; |
|
| 627 |
+ |
|
| 628 |
+ /** |
|
| 629 |
+ * The maximum line length allowed by RFC 2822 section 2.1.1 |
|
| 630 |
+ * @var integer |
|
| 631 |
+ */ |
|
| 632 |
+ const MAX_LINE_LENGTH = 998; |
|
| 633 |
+ |
|
| 634 |
+ /** |
|
| 635 |
+ * Constructor. |
|
| 636 |
+ * @param boolean $exceptions Should we throw external exceptions? |
|
| 637 |
+ */ |
|
| 638 |
+ public function __construct($exceptions = null) |
|
| 639 |
+ {
|
|
| 640 |
+ if ($exceptions !== null) {
|
|
| 641 |
+ $this->exceptions = (boolean)$exceptions; |
|
| 642 |
+ } |
|
| 643 |
+ } |
|
| 644 |
+ |
|
| 645 |
+ /** |
|
| 646 |
+ * Destructor. |
|
| 647 |
+ */ |
|
| 648 |
+ public function __destruct() |
|
| 649 |
+ {
|
|
| 650 |
+ //Close any open SMTP connection nicely |
|
| 651 |
+ $this->smtpClose(); |
|
| 652 |
+ } |
|
| 653 |
+ |
|
| 654 |
+ /** |
|
| 655 |
+ * Call mail() in a safe_mode-aware fashion. |
|
| 656 |
+ * Also, unless sendmail_path points to sendmail (or something that |
|
| 657 |
+ * claims to be sendmail), don't pass params (not a perfect fix, |
|
| 658 |
+ * but it will do) |
|
| 659 |
+ * @param string $to To |
|
| 660 |
+ * @param string $subject Subject |
|
| 661 |
+ * @param string $body Message Body |
|
| 662 |
+ * @param string $header Additional Header(s) |
|
| 663 |
+ * @param string $params Params |
|
| 664 |
+ * @access private |
|
| 665 |
+ * @return boolean |
|
| 666 |
+ */ |
|
| 667 |
+ private function mailPassthru($to, $subject, $body, $header, $params) |
|
| 668 |
+ {
|
|
| 669 |
+ //Check overloading of mail function to avoid double-encoding |
|
| 670 |
+ if (ini_get('mbstring.func_overload') & 1) {
|
|
| 671 |
+ $subject = $this->secureHeader($subject); |
|
| 672 |
+ } else {
|
|
| 673 |
+ $subject = $this->encodeHeader($this->secureHeader($subject)); |
|
| 674 |
+ } |
|
| 675 |
+ if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
|
|
| 676 |
+ $result = @mail($to, $subject, $body, $header); |
|
| 677 |
+ } else {
|
|
| 678 |
+ $result = @mail($to, $subject, $body, $header, $params); |
|
| 679 |
+ } |
|
| 680 |
+ return $result; |
|
| 681 |
+ } |
|
| 682 |
+ |
|
| 683 |
+ /** |
|
| 684 |
+ * Output debugging info via user-defined method. |
|
| 685 |
+ * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug). |
|
| 686 |
+ * @see PHPMailer::$Debugoutput |
|
| 687 |
+ * @see PHPMailer::$SMTPDebug |
|
| 688 |
+ * @param string $str |
|
| 689 |
+ */ |
|
| 690 |
+ protected function edebug($str) |
|
| 691 |
+ {
|
|
| 692 |
+ if ($this->SMTPDebug <= 0) {
|
|
| 693 |
+ return; |
|
| 694 |
+ } |
|
| 695 |
+ //Avoid clash with built-in function names |
|
| 696 |
+ if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
|
|
| 697 |
+ call_user_func($this->Debugoutput, $str, $this->SMTPDebug); |
|
| 698 |
+ return; |
|
| 699 |
+ } |
|
| 700 |
+ switch ($this->Debugoutput) {
|
|
| 701 |
+ case 'error_log': |
|
| 702 |
+ //Don't output, just log |
|
| 703 |
+ error_log($str); |
|
| 704 |
+ break; |
|
| 705 |
+ case 'html': |
|
| 706 |
+ //Cleans up output a bit for a better looking, HTML-safe output |
|
| 707 |
+ echo htmlentities( |
|
| 708 |
+ preg_replace('/[\r\n]+/', '', $str),
|
|
| 709 |
+ ENT_QUOTES, |
|
| 710 |
+ 'UTF-8' |
|
| 711 |
+ ) |
|
| 712 |
+ . "<br>\n"; |
|
| 713 |
+ break; |
|
| 714 |
+ case 'echo': |
|
| 715 |
+ default: |
|
| 716 |
+ //Normalize line breaks |
|
| 717 |
+ $str = preg_replace('/\r\n?/ms', "\n", $str);
|
|
| 718 |
+ echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
|
|
| 719 |
+ "\n", |
|
| 720 |
+ "\n \t ", |
|
| 721 |
+ trim($str) |
|
| 722 |
+ ) . "\n"; |
|
| 723 |
+ } |
|
| 724 |
+ } |
|
| 725 |
+ |
|
| 726 |
+ /** |
|
| 727 |
+ * Sets message type to HTML or plain. |
|
| 728 |
+ * @param boolean $isHtml True for HTML mode. |
|
| 729 |
+ * @return void |
|
| 730 |
+ */ |
|
| 731 |
+ public function isHTML($isHtml = true) |
|
| 732 |
+ {
|
|
| 733 |
+ if ($isHtml) {
|
|
| 734 |
+ $this->ContentType = 'text/html'; |
|
| 735 |
+ } else {
|
|
| 736 |
+ $this->ContentType = 'text/plain'; |
|
| 737 |
+ } |
|
| 738 |
+ } |
|
| 739 |
+ |
|
| 740 |
+ /** |
|
| 741 |
+ * Send messages using SMTP. |
|
| 742 |
+ * @return void |
|
| 743 |
+ */ |
|
| 744 |
+ public function isSMTP() |
|
| 745 |
+ {
|
|
| 746 |
+ $this->Mailer = 'smtp'; |
|
| 747 |
+ } |
|
| 748 |
+ |
|
| 749 |
+ /** |
|
| 750 |
+ * Send messages using PHP's mail() function. |
|
| 751 |
+ * @return void |
|
| 752 |
+ */ |
|
| 753 |
+ public function isMail() |
|
| 754 |
+ {
|
|
| 755 |
+ $this->Mailer = 'mail'; |
|
| 756 |
+ } |
|
| 757 |
+ |
|
| 758 |
+ /** |
|
| 759 |
+ * Send messages using $Sendmail. |
|
| 760 |
+ * @return void |
|
| 761 |
+ */ |
|
| 762 |
+ public function isSendmail() |
|
| 763 |
+ {
|
|
| 764 |
+ $ini_sendmail_path = ini_get('sendmail_path');
|
|
| 765 |
+ |
|
| 766 |
+ if (!stristr($ini_sendmail_path, 'sendmail')) {
|
|
| 767 |
+ $this->Sendmail = '/usr/sbin/sendmail'; |
|
| 768 |
+ } else {
|
|
| 769 |
+ $this->Sendmail = $ini_sendmail_path; |
|
| 770 |
+ } |
|
| 771 |
+ $this->Mailer = 'sendmail'; |
|
| 772 |
+ } |
|
| 773 |
+ |
|
| 774 |
+ /** |
|
| 775 |
+ * Send messages using qmail. |
|
| 776 |
+ * @return void |
|
| 777 |
+ */ |
|
| 778 |
+ public function isQmail() |
|
| 779 |
+ {
|
|
| 780 |
+ $ini_sendmail_path = ini_get('sendmail_path');
|
|
| 781 |
+ |
|
| 782 |
+ if (!stristr($ini_sendmail_path, 'qmail')) {
|
|
| 783 |
+ $this->Sendmail = '/var/qmail/bin/qmail-inject'; |
|
| 784 |
+ } else {
|
|
| 785 |
+ $this->Sendmail = $ini_sendmail_path; |
|
| 786 |
+ } |
|
| 787 |
+ $this->Mailer = 'qmail'; |
|
| 788 |
+ } |
|
| 789 |
+ |
|
| 790 |
+ /** |
|
| 791 |
+ * Add a "To" address. |
|
| 792 |
+ * @param string $address The email address to send to |
|
| 793 |
+ * @param string $name |
|
| 794 |
+ * @return boolean true on success, false if address already used or invalid in some way |
|
| 795 |
+ */ |
|
| 796 |
+ public function addAddress($address, $name = '') |
|
| 797 |
+ {
|
|
| 798 |
+ return $this->addOrEnqueueAnAddress('to', $address, $name);
|
|
| 799 |
+ } |
|
| 800 |
+ |
|
| 801 |
+ /** |
|
| 802 |
+ * Add a "CC" address. |
|
| 803 |
+ * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. |
|
| 804 |
+ * @param string $address The email address to send to |
|
| 805 |
+ * @param string $name |
|
| 806 |
+ * @return boolean true on success, false if address already used or invalid in some way |
|
| 807 |
+ */ |
|
| 808 |
+ public function addCC($address, $name = '') |
|
| 809 |
+ {
|
|
| 810 |
+ return $this->addOrEnqueueAnAddress('cc', $address, $name);
|
|
| 811 |
+ } |
|
| 812 |
+ |
|
| 813 |
+ /** |
|
| 814 |
+ * Add a "BCC" address. |
|
| 815 |
+ * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. |
|
| 816 |
+ * @param string $address The email address to send to |
|
| 817 |
+ * @param string $name |
|
| 818 |
+ * @return boolean true on success, false if address already used or invalid in some way |
|
| 819 |
+ */ |
|
| 820 |
+ public function addBCC($address, $name = '') |
|
| 821 |
+ {
|
|
| 822 |
+ return $this->addOrEnqueueAnAddress('bcc', $address, $name);
|
|
| 823 |
+ } |
|
| 824 |
+ |
|
| 825 |
+ /** |
|
| 826 |
+ * Add a "Reply-To" address. |
|
| 827 |
+ * @param string $address The email address to reply to |
|
| 828 |
+ * @param string $name |
|
| 829 |
+ * @return boolean true on success, false if address already used or invalid in some way |
|
| 830 |
+ */ |
|
| 831 |
+ public function addReplyTo($address, $name = '') |
|
| 832 |
+ {
|
|
| 833 |
+ return $this->addOrEnqueueAnAddress('Reply-To', $address, $name);
|
|
| 834 |
+ } |
|
| 835 |
+ |
|
| 836 |
+ /** |
|
| 837 |
+ * Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer |
|
| 838 |
+ * can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still |
|
| 839 |
+ * be modified after calling this function), addition of such addresses is delayed until send(). |
|
| 840 |
+ * Addresses that have been added already return false, but do not throw exceptions. |
|
| 841 |
+ * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' |
|
| 842 |
+ * @param string $address The email address to send, resp. to reply to |
|
| 843 |
+ * @param string $name |
|
| 844 |
+ * @throws phpmailerException |
|
| 845 |
+ * @return boolean true on success, false if address already used or invalid in some way |
|
| 846 |
+ * @access protected |
|
| 847 |
+ */ |
|
| 848 |
+ protected function addOrEnqueueAnAddress($kind, $address, $name) |
|
| 849 |
+ {
|
|
| 850 |
+ $address = trim($address); |
|
| 851 |
+ $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
|
|
| 852 |
+ if (($pos = strrpos($address, '@')) === false) {
|
|
| 853 |
+ // At-sign is misssing. |
|
| 854 |
+ $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
|
|
| 855 |
+ $this->setError($error_message); |
|
| 856 |
+ $this->edebug($error_message); |
|
| 857 |
+ if ($this->exceptions) {
|
|
| 858 |
+ throw new phpmailerException($error_message); |
|
| 859 |
+ } |
|
| 860 |
+ return false; |
|
| 861 |
+ } |
|
| 862 |
+ $params = array($kind, $address, $name); |
|
| 863 |
+ // Enqueue addresses with IDN until we know the PHPMailer::$CharSet. |
|
| 864 |
+ if ($this->has8bitChars(substr($address, ++$pos)) and $this->idnSupported()) {
|
|
| 865 |
+ if ($kind != 'Reply-To') {
|
|
| 866 |
+ if (!array_key_exists($address, $this->RecipientsQueue)) {
|
|
| 867 |
+ $this->RecipientsQueue[$address] = $params; |
|
| 868 |
+ return true; |
|
| 869 |
+ } |
|
| 870 |
+ } else {
|
|
| 871 |
+ if (!array_key_exists($address, $this->ReplyToQueue)) {
|
|
| 872 |
+ $this->ReplyToQueue[$address] = $params; |
|
| 873 |
+ return true; |
|
| 874 |
+ } |
|
| 875 |
+ } |
|
| 876 |
+ return false; |
|
| 877 |
+ } |
|
| 878 |
+ // Immediately add standard addresses without IDN. |
|
| 879 |
+ return call_user_func_array(array($this, 'addAnAddress'), $params); |
|
| 880 |
+ } |
|
| 881 |
+ |
|
| 882 |
+ /** |
|
| 883 |
+ * Add an address to one of the recipient arrays or to the ReplyTo array. |
|
| 884 |
+ * Addresses that have been added already return false, but do not throw exceptions. |
|
| 885 |
+ * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' |
|
| 886 |
+ * @param string $address The email address to send, resp. to reply to |
|
| 887 |
+ * @param string $name |
|
| 888 |
+ * @throws phpmailerException |
|
| 889 |
+ * @return boolean true on success, false if address already used or invalid in some way |
|
| 890 |
+ * @access protected |
|
| 891 |
+ */ |
|
| 892 |
+ protected function addAnAddress($kind, $address, $name = '') |
|
| 893 |
+ {
|
|
| 894 |
+ if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
|
|
| 895 |
+ $error_message = $this->lang('Invalid recipient kind: ') . $kind;
|
|
| 896 |
+ $this->setError($error_message); |
|
| 897 |
+ $this->edebug($error_message); |
|
| 898 |
+ if ($this->exceptions) {
|
|
| 899 |
+ throw new phpmailerException($error_message); |
|
| 900 |
+ } |
|
| 901 |
+ return false; |
|
| 902 |
+ } |
|
| 903 |
+ if (!$this->validateAddress($address)) {
|
|
| 904 |
+ $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
|
|
| 905 |
+ $this->setError($error_message); |
|
| 906 |
+ $this->edebug($error_message); |
|
| 907 |
+ if ($this->exceptions) {
|
|
| 908 |
+ throw new phpmailerException($error_message); |
|
| 909 |
+ } |
|
| 910 |
+ return false; |
|
| 911 |
+ } |
|
| 912 |
+ if ($kind != 'Reply-To') {
|
|
| 913 |
+ if (!array_key_exists(strtolower($address), $this->all_recipients)) {
|
|
| 914 |
+ array_push($this->$kind, array($address, $name)); |
|
| 915 |
+ $this->all_recipients[strtolower($address)] = true; |
|
| 916 |
+ return true; |
|
| 917 |
+ } |
|
| 918 |
+ } else {
|
|
| 919 |
+ if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
|
|
| 920 |
+ $this->ReplyTo[strtolower($address)] = array($address, $name); |
|
| 921 |
+ return true; |
|
| 922 |
+ } |
|
| 923 |
+ } |
|
| 924 |
+ return false; |
|
| 925 |
+ } |
|
| 926 |
+ |
|
| 927 |
+ /** |
|
| 928 |
+ * Parse and validate a string containing one or more RFC822-style comma-separated email addresses |
|
| 929 |
+ * of the form "display name <address>" into an array of name/address pairs. |
|
| 930 |
+ * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. |
|
| 931 |
+ * Note that quotes in the name part are removed. |
|
| 932 |
+ * @param string $addrstr The address list string |
|
| 933 |
+ * @param bool $useimap Whether to use the IMAP extension to parse the list |
|
| 934 |
+ * @return array |
|
| 935 |
+ * @link http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation |
|
| 936 |
+ */ |
|
| 937 |
+ public function parseAddresses($addrstr, $useimap = true) |
|
| 938 |
+ {
|
|
| 939 |
+ $addresses = array(); |
|
| 940 |
+ if ($useimap and function_exists('imap_rfc822_parse_adrlist')) {
|
|
| 941 |
+ //Use this built-in parser if it's available |
|
| 942 |
+ $list = imap_rfc822_parse_adrlist($addrstr, ''); |
|
| 943 |
+ foreach ($list as $address) {
|
|
| 944 |
+ if ($address->host != '.SYNTAX-ERROR.') {
|
|
| 945 |
+ if ($this->validateAddress($address->mailbox . '@' . $address->host)) {
|
|
| 946 |
+ $addresses[] = array( |
|
| 947 |
+ 'name' => (property_exists($address, 'personal') ? $address->personal : ''), |
|
| 948 |
+ 'address' => $address->mailbox . '@' . $address->host |
|
| 949 |
+ ); |
|
| 950 |
+ } |
|
| 951 |
+ } |
|
| 952 |
+ } |
|
| 953 |
+ } else {
|
|
| 954 |
+ //Use this simpler parser |
|
| 955 |
+ $list = explode(',', $addrstr);
|
|
| 956 |
+ foreach ($list as $address) {
|
|
| 957 |
+ $address = trim($address); |
|
| 958 |
+ //Is there a separate name part? |
|
| 959 |
+ if (strpos($address, '<') === false) {
|
|
| 960 |
+ //No separate name, just use the whole thing |
|
| 961 |
+ if ($this->validateAddress($address)) {
|
|
| 962 |
+ $addresses[] = array( |
|
| 963 |
+ 'name' => '', |
|
| 964 |
+ 'address' => $address |
|
| 965 |
+ ); |
|
| 966 |
+ } |
|
| 967 |
+ } else {
|
|
| 968 |
+ list($name, $email) = explode('<', $address);
|
|
| 969 |
+ $email = trim(str_replace('>', '', $email));
|
|
| 970 |
+ if ($this->validateAddress($email)) {
|
|
| 971 |
+ $addresses[] = array( |
|
| 972 |
+ 'name' => trim(str_replace(array('"', "'"), '', $name)),
|
|
| 973 |
+ 'address' => $email |
|
| 974 |
+ ); |
|
| 975 |
+ } |
|
| 976 |
+ } |
|
| 977 |
+ } |
|
| 978 |
+ } |
|
| 979 |
+ return $addresses; |
|
| 980 |
+ } |
|
| 981 |
+ |
|
| 982 |
+ /** |
|
| 983 |
+ * Set the From and FromName properties. |
|
| 984 |
+ * @param string $address |
|
| 985 |
+ * @param string $name |
|
| 986 |
+ * @param boolean $auto Whether to also set the Sender address, defaults to true |
|
| 987 |
+ * @throws phpmailerException |
|
| 988 |
+ * @return boolean |
|
| 989 |
+ */ |
|
| 990 |
+ public function setFrom($address, $name = '', $auto = true) |
|
| 991 |
+ {
|
|
| 992 |
+ $address = trim($address); |
|
| 993 |
+ $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
|
|
| 994 |
+ // Don't validate now addresses with IDN. Will be done in send(). |
|
| 995 |
+ if (($pos = strrpos($address, '@')) === false or |
|
| 996 |
+ (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and |
|
| 997 |
+ !$this->validateAddress($address)) {
|
|
| 998 |
+ $error_message = $this->lang('invalid_address') . " (setFrom) $address";
|
|
| 999 |
+ $this->setError($error_message); |
|
| 1000 |
+ $this->edebug($error_message); |
|
| 1001 |
+ if ($this->exceptions) {
|
|
| 1002 |
+ throw new phpmailerException($error_message); |
|
| 1003 |
+ } |
|
| 1004 |
+ return false; |
|
| 1005 |
+ } |
|
| 1006 |
+ $this->From = $address; |
|
| 1007 |
+ $this->FromName = $name; |
|
| 1008 |
+ if ($auto) {
|
|
| 1009 |
+ if (empty($this->Sender)) {
|
|
| 1010 |
+ $this->Sender = $address; |
|
| 1011 |
+ } |
|
| 1012 |
+ } |
|
| 1013 |
+ return true; |
|
| 1014 |
+ } |
|
| 1015 |
+ |
|
| 1016 |
+ /** |
|
| 1017 |
+ * Return the Message-ID header of the last email. |
|
| 1018 |
+ * Technically this is the value from the last time the headers were created, |
|
| 1019 |
+ * but it's also the message ID of the last sent message except in |
|
| 1020 |
+ * pathological cases. |
|
| 1021 |
+ * @return string |
|
| 1022 |
+ */ |
|
| 1023 |
+ public function getLastMessageID() |
|
| 1024 |
+ {
|
|
| 1025 |
+ return $this->lastMessageID; |
|
| 1026 |
+ } |
|
| 1027 |
+ |
|
| 1028 |
+ /** |
|
| 1029 |
+ * Check that a string looks like an email address. |
|
| 1030 |
+ * @param string $address The email address to check |
|
| 1031 |
+ * @param string $patternselect A selector for the validation pattern to use : |
|
| 1032 |
+ * * `auto` Pick best pattern automatically; |
|
| 1033 |
+ * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; |
|
| 1034 |
+ * * `pcre` Use old PCRE implementation; |
|
| 1035 |
+ * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; |
|
| 1036 |
+ * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. |
|
| 1037 |
+ * * `noregex` Don't use a regex: super fast, really dumb. |
|
| 1038 |
+ * @return boolean |
|
| 1039 |
+ * @static |
|
| 1040 |
+ * @access public |
|
| 1041 |
+ */ |
|
| 1042 |
+ public static function validateAddress($address, $patternselect = 'auto') |
|
| 1043 |
+ {
|
|
| 1044 |
+ //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 |
|
| 1045 |
+ if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) {
|
|
| 1046 |
+ return false; |
|
| 1047 |
+ } |
|
| 1048 |
+ if (!$patternselect or $patternselect == 'auto') {
|
|
| 1049 |
+ //Check this constant first so it works when extension_loaded() is disabled by safe mode |
|
| 1050 |
+ //Constant was added in PHP 5.2.4 |
|
| 1051 |
+ if (defined('PCRE_VERSION')) {
|
|
| 1052 |
+ //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2 |
|
| 1053 |
+ if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
|
|
| 1054 |
+ $patternselect = 'pcre8'; |
|
| 1055 |
+ } else {
|
|
| 1056 |
+ $patternselect = 'pcre'; |
|
| 1057 |
+ } |
|
| 1058 |
+ } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
|
|
| 1059 |
+ //Fall back to older PCRE |
|
| 1060 |
+ $patternselect = 'pcre'; |
|
| 1061 |
+ } else {
|
|
| 1062 |
+ //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension |
|
| 1063 |
+ if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
|
|
| 1064 |
+ $patternselect = 'php'; |
|
| 1065 |
+ } else {
|
|
| 1066 |
+ $patternselect = 'noregex'; |
|
| 1067 |
+ } |
|
| 1068 |
+ } |
|
| 1069 |
+ } |
|
| 1070 |
+ switch ($patternselect) {
|
|
| 1071 |
+ case 'pcre8': |
|
| 1072 |
+ /** |
|
| 1073 |
+ * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. |
|
| 1074 |
+ * @link http://squiloople.com/2009/12/20/email-address-validation/ |
|
| 1075 |
+ * @copyright 2009-2010 Michael Rushton |
|
| 1076 |
+ * Feel free to use and redistribute this code. But please keep this copyright notice. |
|
| 1077 |
+ */ |
|
| 1078 |
+ return (boolean)preg_match( |
|
| 1079 |
+ '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
|
|
| 1080 |
+ '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . |
|
| 1081 |
+ '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . |
|
| 1082 |
+ '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . |
|
| 1083 |
+ '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
|
|
| 1084 |
+ '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
|
|
| 1085 |
+ '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
|
|
| 1086 |
+ '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
|
|
| 1087 |
+ '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
|
|
| 1088 |
+ $address |
|
| 1089 |
+ ); |
|
| 1090 |
+ case 'pcre': |
|
| 1091 |
+ //An older regex that doesn't need a recent PCRE |
|
| 1092 |
+ return (boolean)preg_match( |
|
| 1093 |
+ '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
|
|
| 1094 |
+ '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . |
|
| 1095 |
+ '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . |
|
| 1096 |
+ '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
|
|
| 1097 |
+ '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
|
|
| 1098 |
+ '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
|
|
| 1099 |
+ '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
|
|
| 1100 |
+ '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
|
|
| 1101 |
+ '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
|
|
| 1102 |
+ '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
|
|
| 1103 |
+ $address |
|
| 1104 |
+ ); |
|
| 1105 |
+ case 'html5': |
|
| 1106 |
+ /** |
|
| 1107 |
+ * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. |
|
| 1108 |
+ * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) |
|
| 1109 |
+ */ |
|
| 1110 |
+ return (boolean)preg_match( |
|
| 1111 |
+ '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
|
|
| 1112 |
+ '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
|
|
| 1113 |
+ $address |
|
| 1114 |
+ ); |
|
| 1115 |
+ case 'noregex': |
|
| 1116 |
+ //No PCRE! Do something _very_ approximate! |
|
| 1117 |
+ //Check the address is 3 chars or longer and contains an @ that's not the first or last char |
|
| 1118 |
+ return (strlen($address) >= 3 |
|
| 1119 |
+ and strpos($address, '@') >= 1 |
|
| 1120 |
+ and strpos($address, '@') != strlen($address) - 1); |
|
| 1121 |
+ case 'php': |
|
| 1122 |
+ default: |
|
| 1123 |
+ return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL); |
|
| 1124 |
+ } |
|
| 1125 |
+ } |
|
| 1126 |
+ |
|
| 1127 |
+ /** |
|
| 1128 |
+ * Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the |
|
| 1129 |
+ * "intl" and "mbstring" PHP extensions. |
|
| 1130 |
+ * @return bool "true" if required functions for IDN support are present |
|
| 1131 |
+ */ |
|
| 1132 |
+ public function idnSupported() |
|
| 1133 |
+ {
|
|
| 1134 |
+ // @TODO: Write our own "idn_to_ascii" function for PHP <= 5.2. |
|
| 1135 |
+ return function_exists('idn_to_ascii') and function_exists('mb_convert_encoding');
|
|
| 1136 |
+ } |
|
| 1137 |
+ |
|
| 1138 |
+ /** |
|
| 1139 |
+ * Converts IDN in given email address to its ASCII form, also known as punycode, if possible. |
|
| 1140 |
+ * Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet. |
|
| 1141 |
+ * This function silently returns unmodified address if: |
|
| 1142 |
+ * - No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form) |
|
| 1143 |
+ * - Conversion to punycode is impossible (e.g. required PHP functions are not available) |
|
| 1144 |
+ * or fails for any reason (e.g. domain has characters not allowed in an IDN) |
|
| 1145 |
+ * @see PHPMailer::$CharSet |
|
| 1146 |
+ * @param string $address The email address to convert |
|
| 1147 |
+ * @return string The encoded address in ASCII form |
|
| 1148 |
+ */ |
|
| 1149 |
+ public function punyencodeAddress($address) |
|
| 1150 |
+ {
|
|
| 1151 |
+ // Verify we have required functions, CharSet, and at-sign. |
|
| 1152 |
+ if ($this->idnSupported() and |
|
| 1153 |
+ !empty($this->CharSet) and |
|
| 1154 |
+ ($pos = strrpos($address, '@')) !== false) {
|
|
| 1155 |
+ $domain = substr($address, ++$pos); |
|
| 1156 |
+ // Verify CharSet string is a valid one, and domain properly encoded in this CharSet. |
|
| 1157 |
+ if ($this->has8bitChars($domain) and @mb_check_encoding($domain, $this->CharSet)) {
|
|
| 1158 |
+ $domain = mb_convert_encoding($domain, 'UTF-8', $this->CharSet); |
|
| 1159 |
+ if (($punycode = defined('INTL_IDNA_VARIANT_UTS46') ?
|
|
| 1160 |
+ idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46) : |
|
| 1161 |
+ idn_to_ascii($domain)) !== false) {
|
|
| 1162 |
+ return substr($address, 0, $pos) . $punycode; |
|
| 1163 |
+ } |
|
| 1164 |
+ } |
|
| 1165 |
+ } |
|
| 1166 |
+ return $address; |
|
| 1167 |
+ } |
|
| 1168 |
+ |
|
| 1169 |
+ /** |
|
| 1170 |
+ * Create a message and send it. |
|
| 1171 |
+ * Uses the sending method specified by $Mailer. |
|
| 1172 |
+ * @throws phpmailerException |
|
| 1173 |
+ * @return boolean false on error - See the ErrorInfo property for details of the error. |
|
| 1174 |
+ */ |
|
| 1175 |
+ public function send() |
|
| 1176 |
+ {
|
|
| 1177 |
+ try {
|
|
| 1178 |
+ if (!$this->preSend()) {
|
|
| 1179 |
+ return false; |
|
| 1180 |
+ } |
|
| 1181 |
+ return $this->postSend(); |
|
| 1182 |
+ } catch (phpmailerException $exc) {
|
|
| 1183 |
+ $this->mailHeader = ''; |
|
| 1184 |
+ $this->setError($exc->getMessage()); |
|
| 1185 |
+ if ($this->exceptions) {
|
|
| 1186 |
+ throw $exc; |
|
| 1187 |
+ } |
|
| 1188 |
+ return false; |
|
| 1189 |
+ } |
|
| 1190 |
+ } |
|
| 1191 |
+ |
|
| 1192 |
+ /** |
|
| 1193 |
+ * Prepare a message for sending. |
|
| 1194 |
+ * @throws phpmailerException |
|
| 1195 |
+ * @return boolean |
|
| 1196 |
+ */ |
|
| 1197 |
+ public function preSend() |
|
| 1198 |
+ {
|
|
| 1199 |
+ try {
|
|
| 1200 |
+ $this->error_count = 0; // Reset errors |
|
| 1201 |
+ $this->mailHeader = ''; |
|
| 1202 |
+ |
|
| 1203 |
+ // Dequeue recipient and Reply-To addresses with IDN |
|
| 1204 |
+ foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) {
|
|
| 1205 |
+ $params[1] = $this->punyencodeAddress($params[1]); |
|
| 1206 |
+ call_user_func_array(array($this, 'addAnAddress'), $params); |
|
| 1207 |
+ } |
|
| 1208 |
+ if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
|
|
| 1209 |
+ throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
|
|
| 1210 |
+ } |
|
| 1211 |
+ |
|
| 1212 |
+ // Validate From, Sender, and ConfirmReadingTo addresses |
|
| 1213 |
+ foreach (array('From', 'Sender', 'ConfirmReadingTo') as $address_kind) {
|
|
| 1214 |
+ $this->$address_kind = trim($this->$address_kind); |
|
| 1215 |
+ if (empty($this->$address_kind)) {
|
|
| 1216 |
+ continue; |
|
| 1217 |
+ } |
|
| 1218 |
+ $this->$address_kind = $this->punyencodeAddress($this->$address_kind); |
|
| 1219 |
+ if (!$this->validateAddress($this->$address_kind)) {
|
|
| 1220 |
+ $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind;
|
|
| 1221 |
+ $this->setError($error_message); |
|
| 1222 |
+ $this->edebug($error_message); |
|
| 1223 |
+ if ($this->exceptions) {
|
|
| 1224 |
+ throw new phpmailerException($error_message); |
|
| 1225 |
+ } |
|
| 1226 |
+ return false; |
|
| 1227 |
+ } |
|
| 1228 |
+ } |
|
| 1229 |
+ |
|
| 1230 |
+ // Set whether the message is multipart/alternative |
|
| 1231 |
+ if ($this->alternativeExists()) {
|
|
| 1232 |
+ $this->ContentType = 'multipart/alternative'; |
|
| 1233 |
+ } |
|
| 1234 |
+ |
|
| 1235 |
+ $this->setMessageType(); |
|
| 1236 |
+ // Refuse to send an empty message unless we are specifically allowing it |
|
| 1237 |
+ if (!$this->AllowEmpty and empty($this->Body)) {
|
|
| 1238 |
+ throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
|
|
| 1239 |
+ } |
|
| 1240 |
+ |
|
| 1241 |
+ // Create body before headers in case body makes changes to headers (e.g. altering transfer encoding) |
|
| 1242 |
+ $this->MIMEHeader = ''; |
|
| 1243 |
+ $this->MIMEBody = $this->createBody(); |
|
| 1244 |
+ // createBody may have added some headers, so retain them |
|
| 1245 |
+ $tempheaders = $this->MIMEHeader; |
|
| 1246 |
+ $this->MIMEHeader = $this->createHeader(); |
|
| 1247 |
+ $this->MIMEHeader .= $tempheaders; |
|
| 1248 |
+ |
|
| 1249 |
+ // To capture the complete message when using mail(), create |
|
| 1250 |
+ // an extra header list which createHeader() doesn't fold in |
|
| 1251 |
+ if ($this->Mailer == 'mail') {
|
|
| 1252 |
+ if (count($this->to) > 0) {
|
|
| 1253 |
+ $this->mailHeader .= $this->addrAppend('To', $this->to);
|
|
| 1254 |
+ } else {
|
|
| 1255 |
+ $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
|
|
| 1256 |
+ } |
|
| 1257 |
+ $this->mailHeader .= $this->headerLine( |
|
| 1258 |
+ 'Subject', |
|
| 1259 |
+ $this->encodeHeader($this->secureHeader(trim($this->Subject))) |
|
| 1260 |
+ ); |
|
| 1261 |
+ } |
|
| 1262 |
+ |
|
| 1263 |
+ // Sign with DKIM if enabled |
|
| 1264 |
+ if (!empty($this->DKIM_domain) |
|
| 1265 |
+ && !empty($this->DKIM_private) |
|
| 1266 |
+ && !empty($this->DKIM_selector) |
|
| 1267 |
+ && file_exists($this->DKIM_private)) {
|
|
| 1268 |
+ $header_dkim = $this->DKIM_Add( |
|
| 1269 |
+ $this->MIMEHeader . $this->mailHeader, |
|
| 1270 |
+ $this->encodeHeader($this->secureHeader($this->Subject)), |
|
| 1271 |
+ $this->MIMEBody |
|
| 1272 |
+ ); |
|
| 1273 |
+ $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF . |
|
| 1274 |
+ str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
|
|
| 1275 |
+ } |
|
| 1276 |
+ return true; |
|
| 1277 |
+ } catch (phpmailerException $exc) {
|
|
| 1278 |
+ $this->setError($exc->getMessage()); |
|
| 1279 |
+ if ($this->exceptions) {
|
|
| 1280 |
+ throw $exc; |
|
| 1281 |
+ } |
|
| 1282 |
+ return false; |
|
| 1283 |
+ } |
|
| 1284 |
+ } |
|
| 1285 |
+ |
|
| 1286 |
+ /** |
|
| 1287 |
+ * Actually send a message. |
|
| 1288 |
+ * Send the email via the selected mechanism |
|
| 1289 |
+ * @throws phpmailerException |
|
| 1290 |
+ * @return boolean |
|
| 1291 |
+ */ |
|
| 1292 |
+ public function postSend() |
|
| 1293 |
+ {
|
|
| 1294 |
+ try {
|
|
| 1295 |
+ // Choose the mailer and send through it |
|
| 1296 |
+ switch ($this->Mailer) {
|
|
| 1297 |
+ case 'sendmail': |
|
| 1298 |
+ case 'qmail': |
|
| 1299 |
+ return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); |
|
| 1300 |
+ case 'smtp': |
|
| 1301 |
+ return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); |
|
| 1302 |
+ case 'mail': |
|
| 1303 |
+ return $this->mailSend($this->MIMEHeader, $this->MIMEBody); |
|
| 1304 |
+ default: |
|
| 1305 |
+ $sendMethod = $this->Mailer.'Send'; |
|
| 1306 |
+ if (method_exists($this, $sendMethod)) {
|
|
| 1307 |
+ return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); |
|
| 1308 |
+ } |
|
| 1309 |
+ |
|
| 1310 |
+ return $this->mailSend($this->MIMEHeader, $this->MIMEBody); |
|
| 1311 |
+ } |
|
| 1312 |
+ } catch (phpmailerException $exc) {
|
|
| 1313 |
+ $this->setError($exc->getMessage()); |
|
| 1314 |
+ $this->edebug($exc->getMessage()); |
|
| 1315 |
+ if ($this->exceptions) {
|
|
| 1316 |
+ throw $exc; |
|
| 1317 |
+ } |
|
| 1318 |
+ } |
|
| 1319 |
+ return false; |
|
| 1320 |
+ } |
|
| 1321 |
+ |
|
| 1322 |
+ /** |
|
| 1323 |
+ * Send mail using the $Sendmail program. |
|
| 1324 |
+ * @param string $header The message headers |
|
| 1325 |
+ * @param string $body The message body |
|
| 1326 |
+ * @see PHPMailer::$Sendmail |
|
| 1327 |
+ * @throws phpmailerException |
|
| 1328 |
+ * @access protected |
|
| 1329 |
+ * @return boolean |
|
| 1330 |
+ */ |
|
| 1331 |
+ protected function sendmailSend($header, $body) |
|
| 1332 |
+ {
|
|
| 1333 |
+ if ($this->Sender != '') {
|
|
| 1334 |
+ if ($this->Mailer == 'qmail') {
|
|
| 1335 |
+ $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
|
|
| 1336 |
+ } else {
|
|
| 1337 |
+ $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
|
|
| 1338 |
+ } |
|
| 1339 |
+ } else {
|
|
| 1340 |
+ if ($this->Mailer == 'qmail') {
|
|
| 1341 |
+ $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
|
|
| 1342 |
+ } else {
|
|
| 1343 |
+ $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
|
|
| 1344 |
+ } |
|
| 1345 |
+ } |
|
| 1346 |
+ if ($this->SingleTo) {
|
|
| 1347 |
+ foreach ($this->SingleToArray as $toAddr) {
|
|
| 1348 |
+ if (!@$mail = popen($sendmail, 'w')) {
|
|
| 1349 |
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
|
| 1350 |
+ } |
|
| 1351 |
+ fputs($mail, 'To: ' . $toAddr . "\n"); |
|
| 1352 |
+ fputs($mail, $header); |
|
| 1353 |
+ fputs($mail, $body); |
|
| 1354 |
+ $result = pclose($mail); |
|
| 1355 |
+ $this->doCallback( |
|
| 1356 |
+ ($result == 0), |
|
| 1357 |
+ array($toAddr), |
|
| 1358 |
+ $this->cc, |
|
| 1359 |
+ $this->bcc, |
|
| 1360 |
+ $this->Subject, |
|
| 1361 |
+ $body, |
|
| 1362 |
+ $this->From |
|
| 1363 |
+ ); |
|
| 1364 |
+ if ($result != 0) {
|
|
| 1365 |
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
|
| 1366 |
+ } |
|
| 1367 |
+ } |
|
| 1368 |
+ } else {
|
|
| 1369 |
+ if (!@$mail = popen($sendmail, 'w')) {
|
|
| 1370 |
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
|
| 1371 |
+ } |
|
| 1372 |
+ fputs($mail, $header); |
|
| 1373 |
+ fputs($mail, $body); |
|
| 1374 |
+ $result = pclose($mail); |
|
| 1375 |
+ $this->doCallback( |
|
| 1376 |
+ ($result == 0), |
|
| 1377 |
+ $this->to, |
|
| 1378 |
+ $this->cc, |
|
| 1379 |
+ $this->bcc, |
|
| 1380 |
+ $this->Subject, |
|
| 1381 |
+ $body, |
|
| 1382 |
+ $this->From |
|
| 1383 |
+ ); |
|
| 1384 |
+ if ($result != 0) {
|
|
| 1385 |
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
|
| 1386 |
+ } |
|
| 1387 |
+ } |
|
| 1388 |
+ return true; |
|
| 1389 |
+ } |
|
| 1390 |
+ |
|
| 1391 |
+ /** |
|
| 1392 |
+ * Send mail using the PHP mail() function. |
|
| 1393 |
+ * @param string $header The message headers |
|
| 1394 |
+ * @param string $body The message body |
|
| 1395 |
+ * @link http://www.php.net/manual/en/book.mail.php |
|
| 1396 |
+ * @throws phpmailerException |
|
| 1397 |
+ * @access protected |
|
| 1398 |
+ * @return boolean |
|
| 1399 |
+ */ |
|
| 1400 |
+ protected function mailSend($header, $body) |
|
| 1401 |
+ {
|
|
| 1402 |
+ $toArr = array(); |
|
| 1403 |
+ foreach ($this->to as $toaddr) {
|
|
| 1404 |
+ $toArr[] = $this->addrFormat($toaddr); |
|
| 1405 |
+ } |
|
| 1406 |
+ $to = implode(', ', $toArr);
|
|
| 1407 |
+ |
|
| 1408 |
+ if (empty($this->Sender)) {
|
|
| 1409 |
+ $params = ' '; |
|
| 1410 |
+ } else {
|
|
| 1411 |
+ $params = sprintf('-f%s', $this->Sender);
|
|
| 1412 |
+ } |
|
| 1413 |
+ if ($this->Sender != '' and !ini_get('safe_mode')) {
|
|
| 1414 |
+ $old_from = ini_get('sendmail_from');
|
|
| 1415 |
+ ini_set('sendmail_from', $this->Sender);
|
|
| 1416 |
+ } |
|
| 1417 |
+ $result = false; |
|
| 1418 |
+ if ($this->SingleTo && count($toArr) > 1) {
|
|
| 1419 |
+ foreach ($toArr as $toAddr) {
|
|
| 1420 |
+ $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); |
|
| 1421 |
+ $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); |
|
| 1422 |
+ } |
|
| 1423 |
+ } else {
|
|
| 1424 |
+ $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params); |
|
| 1425 |
+ $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From); |
|
| 1426 |
+ } |
|
| 1427 |
+ if (isset($old_from)) {
|
|
| 1428 |
+ ini_set('sendmail_from', $old_from);
|
|
| 1429 |
+ } |
|
| 1430 |
+ if (!$result) {
|
|
| 1431 |
+ throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
|
|
| 1432 |
+ } |
|
| 1433 |
+ return true; |
|
| 1434 |
+ } |
|
| 1435 |
+ |
|
| 1436 |
+ /** |
|
| 1437 |
+ * Get an instance to use for SMTP operations. |
|
| 1438 |
+ * Override this function to load your own SMTP implementation |
|
| 1439 |
+ * @return SMTP |
|
| 1440 |
+ */ |
|
| 1441 |
+ public function getSMTPInstance() |
|
| 1442 |
+ {
|
|
| 1443 |
+ if (!is_object($this->smtp)) {
|
|
| 1444 |
+ $this->smtp = new SMTP; |
|
| 1445 |
+ } |
|
| 1446 |
+ return $this->smtp; |
|
| 1447 |
+ } |
|
| 1448 |
+ |
|
| 1449 |
+ /** |
|
| 1450 |
+ * Send mail via SMTP. |
|
| 1451 |
+ * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. |
|
| 1452 |
+ * Uses the PHPMailerSMTP class by default. |
|
| 1453 |
+ * @see PHPMailer::getSMTPInstance() to use a different class. |
|
| 1454 |
+ * @param string $header The message headers |
|
| 1455 |
+ * @param string $body The message body |
|
| 1456 |
+ * @throws phpmailerException |
|
| 1457 |
+ * @uses SMTP |
|
| 1458 |
+ * @access protected |
|
| 1459 |
+ * @return boolean |
|
| 1460 |
+ */ |
|
| 1461 |
+ protected function smtpSend($header, $body) |
|
| 1462 |
+ {
|
|
| 1463 |
+ $bad_rcpt = array(); |
|
| 1464 |
+ if (!$this->smtpConnect($this->SMTPOptions)) {
|
|
| 1465 |
+ throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
|
|
| 1466 |
+ } |
|
| 1467 |
+ if ('' == $this->Sender) {
|
|
| 1468 |
+ $smtp_from = $this->From; |
|
| 1469 |
+ } else {
|
|
| 1470 |
+ $smtp_from = $this->Sender; |
|
| 1471 |
+ } |
|
| 1472 |
+ if (!$this->smtp->mail($smtp_from)) {
|
|
| 1473 |
+ $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
|
|
| 1474 |
+ throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); |
|
| 1475 |
+ } |
|
| 1476 |
+ |
|
| 1477 |
+ // Attempt to send to all recipients |
|
| 1478 |
+ foreach (array($this->to, $this->cc, $this->bcc) as $togroup) {
|
|
| 1479 |
+ foreach ($togroup as $to) {
|
|
| 1480 |
+ if (!$this->smtp->recipient($to[0])) {
|
|
| 1481 |
+ $error = $this->smtp->getError(); |
|
| 1482 |
+ $bad_rcpt[] = array('to' => $to[0], 'error' => $error['detail']);
|
|
| 1483 |
+ $isSent = false; |
|
| 1484 |
+ } else {
|
|
| 1485 |
+ $isSent = true; |
|
| 1486 |
+ } |
|
| 1487 |
+ $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From); |
|
| 1488 |
+ } |
|
| 1489 |
+ } |
|
| 1490 |
+ |
|
| 1491 |
+ // Only send the DATA command if we have viable recipients |
|
| 1492 |
+ if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
|
|
| 1493 |
+ throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
|
|
| 1494 |
+ } |
|
| 1495 |
+ if ($this->SMTPKeepAlive) {
|
|
| 1496 |
+ $this->smtp->reset(); |
|
| 1497 |
+ } else {
|
|
| 1498 |
+ $this->smtp->quit(); |
|
| 1499 |
+ $this->smtp->close(); |
|
| 1500 |
+ } |
|
| 1501 |
+ //Create error message for any bad addresses |
|
| 1502 |
+ if (count($bad_rcpt) > 0) {
|
|
| 1503 |
+ $errstr = ''; |
|
| 1504 |
+ foreach ($bad_rcpt as $bad) {
|
|
| 1505 |
+ $errstr .= $bad['to'] . ': ' . $bad['error']; |
|
| 1506 |
+ } |
|
| 1507 |
+ throw new phpmailerException( |
|
| 1508 |
+ $this->lang('recipients_failed') . $errstr,
|
|
| 1509 |
+ self::STOP_CONTINUE |
|
| 1510 |
+ ); |
|
| 1511 |
+ } |
|
| 1512 |
+ return true; |
|
| 1513 |
+ } |
|
| 1514 |
+ |
|
| 1515 |
+ /** |
|
| 1516 |
+ * Initiate a connection to an SMTP server. |
|
| 1517 |
+ * Returns false if the operation failed. |
|
| 1518 |
+ * @param array $options An array of options compatible with stream_context_create() |
|
| 1519 |
+ * @uses SMTP |
|
| 1520 |
+ * @access public |
|
| 1521 |
+ * @throws phpmailerException |
|
| 1522 |
+ * @return boolean |
|
| 1523 |
+ */ |
|
| 1524 |
+ public function smtpConnect($options = array()) |
|
| 1525 |
+ {
|
|
| 1526 |
+ if (is_null($this->smtp)) {
|
|
| 1527 |
+ $this->smtp = $this->getSMTPInstance(); |
|
| 1528 |
+ } |
|
| 1529 |
+ |
|
| 1530 |
+ // Already connected? |
|
| 1531 |
+ if ($this->smtp->connected()) {
|
|
| 1532 |
+ return true; |
|
| 1533 |
+ } |
|
| 1534 |
+ |
|
| 1535 |
+ $this->smtp->setTimeout($this->Timeout); |
|
| 1536 |
+ $this->smtp->setDebugLevel($this->SMTPDebug); |
|
| 1537 |
+ $this->smtp->setDebugOutput($this->Debugoutput); |
|
| 1538 |
+ $this->smtp->setVerp($this->do_verp); |
|
| 1539 |
+ $hosts = explode(';', $this->Host);
|
|
| 1540 |
+ $lastexception = null; |
|
| 1541 |
+ |
|
| 1542 |
+ foreach ($hosts as $hostentry) {
|
|
| 1543 |
+ $hostinfo = array(); |
|
| 1544 |
+ if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
|
|
| 1545 |
+ // Not a valid host entry |
|
| 1546 |
+ continue; |
|
| 1547 |
+ } |
|
| 1548 |
+ // $hostinfo[2]: optional ssl or tls prefix |
|
| 1549 |
+ // $hostinfo[3]: the hostname |
|
| 1550 |
+ // $hostinfo[4]: optional port number |
|
| 1551 |
+ // The host string prefix can temporarily override the current setting for SMTPSecure |
|
| 1552 |
+ // If it's not specified, the default value is used |
|
| 1553 |
+ $prefix = ''; |
|
| 1554 |
+ $secure = $this->SMTPSecure; |
|
| 1555 |
+ $tls = ($this->SMTPSecure == 'tls'); |
|
| 1556 |
+ if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
|
|
| 1557 |
+ $prefix = 'ssl://'; |
|
| 1558 |
+ $tls = false; // Can't have SSL and TLS at the same time |
|
| 1559 |
+ $secure = 'ssl'; |
|
| 1560 |
+ } elseif ($hostinfo[2] == 'tls') {
|
|
| 1561 |
+ $tls = true; |
|
| 1562 |
+ // tls doesn't use a prefix |
|
| 1563 |
+ $secure = 'tls'; |
|
| 1564 |
+ } |
|
| 1565 |
+ //Do we need the OpenSSL extension? |
|
| 1566 |
+ $sslext = defined('OPENSSL_ALGO_SHA1');
|
|
| 1567 |
+ if ('tls' === $secure or 'ssl' === $secure) {
|
|
| 1568 |
+ //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled |
|
| 1569 |
+ if (!$sslext) {
|
|
| 1570 |
+ throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
|
|
| 1571 |
+ } |
|
| 1572 |
+ } |
|
| 1573 |
+ $host = $hostinfo[3]; |
|
| 1574 |
+ $port = $this->Port; |
|
| 1575 |
+ $tport = (integer)$hostinfo[4]; |
|
| 1576 |
+ if ($tport > 0 and $tport < 65536) {
|
|
| 1577 |
+ $port = $tport; |
|
| 1578 |
+ } |
|
| 1579 |
+ if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
|
|
| 1580 |
+ try {
|
|
| 1581 |
+ if ($this->Helo) {
|
|
| 1582 |
+ $hello = $this->Helo; |
|
| 1583 |
+ } else {
|
|
| 1584 |
+ $hello = $this->serverHostname(); |
|
| 1585 |
+ } |
|
| 1586 |
+ $this->smtp->hello($hello); |
|
| 1587 |
+ //Automatically enable TLS encryption if: |
|
| 1588 |
+ // * it's not disabled |
|
| 1589 |
+ // * we have openssl extension |
|
| 1590 |
+ // * we are not already using SSL |
|
| 1591 |
+ // * the server offers STARTTLS |
|
| 1592 |
+ if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
|
|
| 1593 |
+ $tls = true; |
|
| 1594 |
+ } |
|
| 1595 |
+ if ($tls) {
|
|
| 1596 |
+ if (!$this->smtp->startTLS()) {
|
|
| 1597 |
+ throw new phpmailerException($this->lang('connect_host'));
|
|
| 1598 |
+ } |
|
| 1599 |
+ // We must resend HELO after tls negotiation |
|
| 1600 |
+ $this->smtp->hello($hello); |
|
| 1601 |
+ } |
|
| 1602 |
+ if ($this->SMTPAuth) {
|
|
| 1603 |
+ if (!$this->smtp->authenticate( |
|
| 1604 |
+ $this->Username, |
|
| 1605 |
+ $this->Password, |
|
| 1606 |
+ $this->AuthType, |
|
| 1607 |
+ $this->Realm, |
|
| 1608 |
+ $this->Workstation |
|
| 1609 |
+ ) |
|
| 1610 |
+ ) {
|
|
| 1611 |
+ throw new phpmailerException($this->lang('authenticate'));
|
|
| 1612 |
+ } |
|
| 1613 |
+ } |
|
| 1614 |
+ return true; |
|
| 1615 |
+ } catch (phpmailerException $exc) {
|
|
| 1616 |
+ $lastexception = $exc; |
|
| 1617 |
+ $this->edebug($exc->getMessage()); |
|
| 1618 |
+ // We must have connected, but then failed TLS or Auth, so close connection nicely |
|
| 1619 |
+ $this->smtp->quit(); |
|
| 1620 |
+ } |
|
| 1621 |
+ } |
|
| 1622 |
+ } |
|
| 1623 |
+ // If we get here, all connection attempts have failed, so close connection hard |
|
| 1624 |
+ $this->smtp->close(); |
|
| 1625 |
+ // As we've caught all exceptions, just report whatever the last one was |
|
| 1626 |
+ if ($this->exceptions and !is_null($lastexception)) {
|
|
| 1627 |
+ throw $lastexception; |
|
| 1628 |
+ } |
|
| 1629 |
+ return false; |
|
| 1630 |
+ } |
|
| 1631 |
+ |
|
| 1632 |
+ /** |
|
| 1633 |
+ * Close the active SMTP session if one exists. |
|
| 1634 |
+ * @return void |
|
| 1635 |
+ */ |
|
| 1636 |
+ public function smtpClose() |
|
| 1637 |
+ {
|
|
| 1638 |
+ if (is_a($this->smtp, 'SMTP')) {
|
|
| 1639 |
+ if ($this->smtp->connected()) {
|
|
| 1640 |
+ $this->smtp->quit(); |
|
| 1641 |
+ $this->smtp->close(); |
|
| 1642 |
+ } |
|
| 1643 |
+ } |
|
| 1644 |
+ } |
|
| 1645 |
+ |
|
| 1646 |
+ /** |
|
| 1647 |
+ * Set the language for error messages. |
|
| 1648 |
+ * Returns false if it cannot load the language file. |
|
| 1649 |
+ * The default language is English. |
|
| 1650 |
+ * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") |
|
| 1651 |
+ * @param string $lang_path Path to the language file directory, with trailing separator (slash) |
|
| 1652 |
+ * @return boolean |
|
| 1653 |
+ * @access public |
|
| 1654 |
+ */ |
|
| 1655 |
+ public function setLanguage($langcode = 'en', $lang_path = '') |
|
| 1656 |
+ {
|
|
| 1657 |
+ // Define full set of translatable strings in English |
|
| 1658 |
+ $PHPMAILER_LANG = array( |
|
| 1659 |
+ 'authenticate' => 'SMTP Error: Could not authenticate.', |
|
| 1660 |
+ 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', |
|
| 1661 |
+ 'data_not_accepted' => 'SMTP Error: data not accepted.', |
|
| 1662 |
+ 'empty_message' => 'Message body empty', |
|
| 1663 |
+ 'encoding' => 'Unknown encoding: ', |
|
| 1664 |
+ 'execute' => 'Could not execute: ', |
|
| 1665 |
+ 'file_access' => 'Could not access file: ', |
|
| 1666 |
+ 'file_open' => 'File Error: Could not open file: ', |
|
| 1667 |
+ 'from_failed' => 'The following From address failed: ', |
|
| 1668 |
+ 'instantiate' => 'Could not instantiate mail function.', |
|
| 1669 |
+ 'invalid_address' => 'Invalid address: ', |
|
| 1670 |
+ 'mailer_not_supported' => ' mailer is not supported.', |
|
| 1671 |
+ 'provide_address' => 'You must provide at least one recipient email address.', |
|
| 1672 |
+ 'recipients_failed' => 'SMTP Error: The following recipients failed: ', |
|
| 1673 |
+ 'signing' => 'Signing Error: ', |
|
| 1674 |
+ 'smtp_connect_failed' => 'SMTP connect() failed.', |
|
| 1675 |
+ 'smtp_error' => 'SMTP server error: ', |
|
| 1676 |
+ 'variable_set' => 'Cannot set or reset variable: ', |
|
| 1677 |
+ 'extension_missing' => 'Extension missing: ' |
|
| 1678 |
+ ); |
|
| 1679 |
+ if (empty($lang_path)) {
|
|
| 1680 |
+ // Calculate an absolute path so it can work if CWD is not here |
|
| 1681 |
+ $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR; |
|
| 1682 |
+ } |
|
| 1683 |
+ $foundlang = true; |
|
| 1684 |
+ $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php'; |
|
| 1685 |
+ // There is no English translation file |
|
| 1686 |
+ if ($langcode != 'en') {
|
|
| 1687 |
+ // Make sure language file path is readable |
|
| 1688 |
+ if (!is_readable($lang_file)) {
|
|
| 1689 |
+ $foundlang = false; |
|
| 1690 |
+ } else {
|
|
| 1691 |
+ // Overwrite language-specific strings. |
|
| 1692 |
+ // This way we'll never have missing translation keys. |
|
| 1693 |
+ $foundlang = include $lang_file; |
|
| 1694 |
+ } |
|
| 1695 |
+ } |
|
| 1696 |
+ $this->language = $PHPMAILER_LANG; |
|
| 1697 |
+ return (boolean)$foundlang; // Returns false if language not found |
|
| 1698 |
+ } |
|
| 1699 |
+ |
|
| 1700 |
+ /** |
|
| 1701 |
+ * Get the array of strings for the current language. |
|
| 1702 |
+ * @return array |
|
| 1703 |
+ */ |
|
| 1704 |
+ public function getTranslations() |
|
| 1705 |
+ {
|
|
| 1706 |
+ return $this->language; |
|
| 1707 |
+ } |
|
| 1708 |
+ |
|
| 1709 |
+ /** |
|
| 1710 |
+ * Create recipient headers. |
|
| 1711 |
+ * @access public |
|
| 1712 |
+ * @param string $type |
|
| 1713 |
+ * @param array $addr An array of recipient, |
|
| 1714 |
+ * where each recipient is a 2-element indexed array with element 0 containing an address |
|
| 1715 |
+ * and element 1 containing a name, like: |
|
| 1716 |
+ * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
|
|
| 1717 |
+ * @return string |
|
| 1718 |
+ */ |
|
| 1719 |
+ public function addrAppend($type, $addr) |
|
| 1720 |
+ {
|
|
| 1721 |
+ $addresses = array(); |
|
| 1722 |
+ foreach ($addr as $address) {
|
|
| 1723 |
+ $addresses[] = $this->addrFormat($address); |
|
| 1724 |
+ } |
|
| 1725 |
+ return $type . ': ' . implode(', ', $addresses) . $this->LE;
|
|
| 1726 |
+ } |
|
| 1727 |
+ |
|
| 1728 |
+ /** |
|
| 1729 |
+ * Format an address for use in a message header. |
|
| 1730 |
+ * @access public |
|
| 1731 |
+ * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name |
|
| 1732 |
+ * like array('joe@example.com', 'Joe User')
|
|
| 1733 |
+ * @return string |
|
| 1734 |
+ */ |
|
| 1735 |
+ public function addrFormat($addr) |
|
| 1736 |
+ {
|
|
| 1737 |
+ if (empty($addr[1])) { // No name provided
|
|
| 1738 |
+ return $this->secureHeader($addr[0]); |
|
| 1739 |
+ } else {
|
|
| 1740 |
+ return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader( |
|
| 1741 |
+ $addr[0] |
|
| 1742 |
+ ) . '>'; |
|
| 1743 |
+ } |
|
| 1744 |
+ } |
|
| 1745 |
+ |
|
| 1746 |
+ /** |
|
| 1747 |
+ * Word-wrap message. |
|
| 1748 |
+ * For use with mailers that do not automatically perform wrapping |
|
| 1749 |
+ * and for quoted-printable encoded messages. |
|
| 1750 |
+ * Original written by philippe. |
|
| 1751 |
+ * @param string $message The message to wrap |
|
| 1752 |
+ * @param integer $length The line length to wrap to |
|
| 1753 |
+ * @param boolean $qp_mode Whether to run in Quoted-Printable mode |
|
| 1754 |
+ * @access public |
|
| 1755 |
+ * @return string |
|
| 1756 |
+ */ |
|
| 1757 |
+ public function wrapText($message, $length, $qp_mode = false) |
|
| 1758 |
+ {
|
|
| 1759 |
+ if ($qp_mode) {
|
|
| 1760 |
+ $soft_break = sprintf(' =%s', $this->LE);
|
|
| 1761 |
+ } else {
|
|
| 1762 |
+ $soft_break = $this->LE; |
|
| 1763 |
+ } |
|
| 1764 |
+ // If utf-8 encoding is used, we will need to make sure we don't |
|
| 1765 |
+ // split multibyte characters when we wrap |
|
| 1766 |
+ $is_utf8 = (strtolower($this->CharSet) == 'utf-8'); |
|
| 1767 |
+ $lelen = strlen($this->LE); |
|
| 1768 |
+ $crlflen = strlen(self::CRLF); |
|
| 1769 |
+ |
|
| 1770 |
+ $message = $this->fixEOL($message); |
|
| 1771 |
+ //Remove a trailing line break |
|
| 1772 |
+ if (substr($message, -$lelen) == $this->LE) {
|
|
| 1773 |
+ $message = substr($message, 0, -$lelen); |
|
| 1774 |
+ } |
|
| 1775 |
+ |
|
| 1776 |
+ //Split message into lines |
|
| 1777 |
+ $lines = explode($this->LE, $message); |
|
| 1778 |
+ //Message will be rebuilt in here |
|
| 1779 |
+ $message = ''; |
|
| 1780 |
+ foreach ($lines as $line) {
|
|
| 1781 |
+ $words = explode(' ', $line);
|
|
| 1782 |
+ $buf = ''; |
|
| 1783 |
+ $firstword = true; |
|
| 1784 |
+ foreach ($words as $word) {
|
|
| 1785 |
+ if ($qp_mode and (strlen($word) > $length)) {
|
|
| 1786 |
+ $space_left = $length - strlen($buf) - $crlflen; |
|
| 1787 |
+ if (!$firstword) {
|
|
| 1788 |
+ if ($space_left > 20) {
|
|
| 1789 |
+ $len = $space_left; |
|
| 1790 |
+ if ($is_utf8) {
|
|
| 1791 |
+ $len = $this->utf8CharBoundary($word, $len); |
|
| 1792 |
+ } elseif (substr($word, $len - 1, 1) == '=') {
|
|
| 1793 |
+ $len--; |
|
| 1794 |
+ } elseif (substr($word, $len - 2, 1) == '=') {
|
|
| 1795 |
+ $len -= 2; |
|
| 1796 |
+ } |
|
| 1797 |
+ $part = substr($word, 0, $len); |
|
| 1798 |
+ $word = substr($word, $len); |
|
| 1799 |
+ $buf .= ' ' . $part; |
|
| 1800 |
+ $message .= $buf . sprintf('=%s', self::CRLF);
|
|
| 1801 |
+ } else {
|
|
| 1802 |
+ $message .= $buf . $soft_break; |
|
| 1803 |
+ } |
|
| 1804 |
+ $buf = ''; |
|
| 1805 |
+ } |
|
| 1806 |
+ while (strlen($word) > 0) {
|
|
| 1807 |
+ if ($length <= 0) {
|
|
| 1808 |
+ break; |
|
| 1809 |
+ } |
|
| 1810 |
+ $len = $length; |
|
| 1811 |
+ if ($is_utf8) {
|
|
| 1812 |
+ $len = $this->utf8CharBoundary($word, $len); |
|
| 1813 |
+ } elseif (substr($word, $len - 1, 1) == '=') {
|
|
| 1814 |
+ $len--; |
|
| 1815 |
+ } elseif (substr($word, $len - 2, 1) == '=') {
|
|
| 1816 |
+ $len -= 2; |
|
| 1817 |
+ } |
|
| 1818 |
+ $part = substr($word, 0, $len); |
|
| 1819 |
+ $word = substr($word, $len); |
|
| 1820 |
+ |
|
| 1821 |
+ if (strlen($word) > 0) {
|
|
| 1822 |
+ $message .= $part . sprintf('=%s', self::CRLF);
|
|
| 1823 |
+ } else {
|
|
| 1824 |
+ $buf = $part; |
|
| 1825 |
+ } |
|
| 1826 |
+ } |
|
| 1827 |
+ } else {
|
|
| 1828 |
+ $buf_o = $buf; |
|
| 1829 |
+ if (!$firstword) {
|
|
| 1830 |
+ $buf .= ' '; |
|
| 1831 |
+ } |
|
| 1832 |
+ $buf .= $word; |
|
| 1833 |
+ |
|
| 1834 |
+ if (strlen($buf) > $length and $buf_o != '') {
|
|
| 1835 |
+ $message .= $buf_o . $soft_break; |
|
| 1836 |
+ $buf = $word; |
|
| 1837 |
+ } |
|
| 1838 |
+ } |
|
| 1839 |
+ $firstword = false; |
|
| 1840 |
+ } |
|
| 1841 |
+ $message .= $buf . self::CRLF; |
|
| 1842 |
+ } |
|
| 1843 |
+ |
|
| 1844 |
+ return $message; |
|
| 1845 |
+ } |
|
| 1846 |
+ |
|
| 1847 |
+ /** |
|
| 1848 |
+ * Find the last character boundary prior to $maxLength in a utf-8 |
|
| 1849 |
+ * quoted-printable encoded string. |
|
| 1850 |
+ * Original written by Colin Brown. |
|
| 1851 |
+ * @access public |
|
| 1852 |
+ * @param string $encodedText utf-8 QP text |
|
| 1853 |
+ * @param integer $maxLength Find the last character boundary prior to this length |
|
| 1854 |
+ * @return integer |
|
| 1855 |
+ */ |
|
| 1856 |
+ public function utf8CharBoundary($encodedText, $maxLength) |
|
| 1857 |
+ {
|
|
| 1858 |
+ $foundSplitPos = false; |
|
| 1859 |
+ $lookBack = 3; |
|
| 1860 |
+ while (!$foundSplitPos) {
|
|
| 1861 |
+ $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); |
|
| 1862 |
+ $encodedCharPos = strpos($lastChunk, '='); |
|
| 1863 |
+ if (false !== $encodedCharPos) {
|
|
| 1864 |
+ // Found start of encoded character byte within $lookBack block. |
|
| 1865 |
+ // Check the encoded byte value (the 2 chars after the '=') |
|
| 1866 |
+ $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); |
|
| 1867 |
+ $dec = hexdec($hex); |
|
| 1868 |
+ if ($dec < 128) {
|
|
| 1869 |
+ // Single byte character. |
|
| 1870 |
+ // If the encoded char was found at pos 0, it will fit |
|
| 1871 |
+ // otherwise reduce maxLength to start of the encoded char |
|
| 1872 |
+ if ($encodedCharPos > 0) {
|
|
| 1873 |
+ $maxLength = $maxLength - ($lookBack - $encodedCharPos); |
|
| 1874 |
+ } |
|
| 1875 |
+ $foundSplitPos = true; |
|
| 1876 |
+ } elseif ($dec >= 192) {
|
|
| 1877 |
+ // First byte of a multi byte character |
|
| 1878 |
+ // Reduce maxLength to split at start of character |
|
| 1879 |
+ $maxLength = $maxLength - ($lookBack - $encodedCharPos); |
|
| 1880 |
+ $foundSplitPos = true; |
|
| 1881 |
+ } elseif ($dec < 192) {
|
|
| 1882 |
+ // Middle byte of a multi byte character, look further back |
|
| 1883 |
+ $lookBack += 3; |
|
| 1884 |
+ } |
|
| 1885 |
+ } else {
|
|
| 1886 |
+ // No encoded character found |
|
| 1887 |
+ $foundSplitPos = true; |
|
| 1888 |
+ } |
|
| 1889 |
+ } |
|
| 1890 |
+ return $maxLength; |
|
| 1891 |
+ } |
|
| 1892 |
+ |
|
| 1893 |
+ /** |
|
| 1894 |
+ * Apply word wrapping to the message body. |
|
| 1895 |
+ * Wraps the message body to the number of chars set in the WordWrap property. |
|
| 1896 |
+ * You should only do this to plain-text bodies as wrapping HTML tags may break them. |
|
| 1897 |
+ * This is called automatically by createBody(), so you don't need to call it yourself. |
|
| 1898 |
+ * @access public |
|
| 1899 |
+ * @return void |
|
| 1900 |
+ */ |
|
| 1901 |
+ public function setWordWrap() |
|
| 1902 |
+ {
|
|
| 1903 |
+ if ($this->WordWrap < 1) {
|
|
| 1904 |
+ return; |
|
| 1905 |
+ } |
|
| 1906 |
+ |
|
| 1907 |
+ switch ($this->message_type) {
|
|
| 1908 |
+ case 'alt': |
|
| 1909 |
+ case 'alt_inline': |
|
| 1910 |
+ case 'alt_attach': |
|
| 1911 |
+ case 'alt_inline_attach': |
|
| 1912 |
+ $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap); |
|
| 1913 |
+ break; |
|
| 1914 |
+ default: |
|
| 1915 |
+ $this->Body = $this->wrapText($this->Body, $this->WordWrap); |
|
| 1916 |
+ break; |
|
| 1917 |
+ } |
|
| 1918 |
+ } |
|
| 1919 |
+ |
|
| 1920 |
+ /** |
|
| 1921 |
+ * Assemble message headers. |
|
| 1922 |
+ * @access public |
|
| 1923 |
+ * @return string The assembled headers |
|
| 1924 |
+ */ |
|
| 1925 |
+ public function createHeader() |
|
| 1926 |
+ {
|
|
| 1927 |
+ $result = ''; |
|
| 1928 |
+ |
|
| 1929 |
+ if ($this->MessageDate == '') {
|
|
| 1930 |
+ $this->MessageDate = self::rfcDate(); |
|
| 1931 |
+ } |
|
| 1932 |
+ $result .= $this->headerLine('Date', $this->MessageDate);
|
|
| 1933 |
+ |
|
| 1934 |
+ // To be created automatically by mail() |
|
| 1935 |
+ if ($this->SingleTo) {
|
|
| 1936 |
+ if ($this->Mailer != 'mail') {
|
|
| 1937 |
+ foreach ($this->to as $toaddr) {
|
|
| 1938 |
+ $this->SingleToArray[] = $this->addrFormat($toaddr); |
|
| 1939 |
+ } |
|
| 1940 |
+ } |
|
| 1941 |
+ } else {
|
|
| 1942 |
+ if (count($this->to) > 0) {
|
|
| 1943 |
+ if ($this->Mailer != 'mail') {
|
|
| 1944 |
+ $result .= $this->addrAppend('To', $this->to);
|
|
| 1945 |
+ } |
|
| 1946 |
+ } elseif (count($this->cc) == 0) {
|
|
| 1947 |
+ $result .= $this->headerLine('To', 'undisclosed-recipients:;');
|
|
| 1948 |
+ } |
|
| 1949 |
+ } |
|
| 1950 |
+ |
|
| 1951 |
+ $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
|
|
| 1952 |
+ |
|
| 1953 |
+ // sendmail and mail() extract Cc from the header before sending |
|
| 1954 |
+ if (count($this->cc) > 0) {
|
|
| 1955 |
+ $result .= $this->addrAppend('Cc', $this->cc);
|
|
| 1956 |
+ } |
|
| 1957 |
+ |
|
| 1958 |
+ // sendmail and mail() extract Bcc from the header before sending |
|
| 1959 |
+ if (( |
|
| 1960 |
+ $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail' |
|
| 1961 |
+ ) |
|
| 1962 |
+ and count($this->bcc) > 0 |
|
| 1963 |
+ ) {
|
|
| 1964 |
+ $result .= $this->addrAppend('Bcc', $this->bcc);
|
|
| 1965 |
+ } |
|
| 1966 |
+ |
|
| 1967 |
+ if (count($this->ReplyTo) > 0) {
|
|
| 1968 |
+ $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
|
|
| 1969 |
+ } |
|
| 1970 |
+ |
|
| 1971 |
+ // mail() sets the subject itself |
|
| 1972 |
+ if ($this->Mailer != 'mail') {
|
|
| 1973 |
+ $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
|
|
| 1974 |
+ } |
|
| 1975 |
+ |
|
| 1976 |
+ if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) {
|
|
| 1977 |
+ $this->lastMessageID = $this->MessageID; |
|
| 1978 |
+ } else {
|
|
| 1979 |
+ $this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname());
|
|
| 1980 |
+ } |
|
| 1981 |
+ $result .= $this->headerLine('Message-ID', $this->lastMessageID);
|
|
| 1982 |
+ if (!is_null($this->Priority)) {
|
|
| 1983 |
+ $result .= $this->headerLine('X-Priority', $this->Priority);
|
|
| 1984 |
+ } |
|
| 1985 |
+ if ($this->XMailer == '') {
|
|
| 1986 |
+ $result .= $this->headerLine( |
|
| 1987 |
+ 'X-Mailer', |
|
| 1988 |
+ 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer)' |
|
| 1989 |
+ ); |
|
| 1990 |
+ } else {
|
|
| 1991 |
+ $myXmailer = trim($this->XMailer); |
|
| 1992 |
+ if ($myXmailer) {
|
|
| 1993 |
+ $result .= $this->headerLine('X-Mailer', $myXmailer);
|
|
| 1994 |
+ } |
|
| 1995 |
+ } |
|
| 1996 |
+ |
|
| 1997 |
+ if ($this->ConfirmReadingTo != '') {
|
|
| 1998 |
+ $result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
|
|
| 1999 |
+ } |
|
| 2000 |
+ |
|
| 2001 |
+ // Add custom headers |
|
| 2002 |
+ foreach ($this->CustomHeader as $header) {
|
|
| 2003 |
+ $result .= $this->headerLine( |
|
| 2004 |
+ trim($header[0]), |
|
| 2005 |
+ $this->encodeHeader(trim($header[1])) |
|
| 2006 |
+ ); |
|
| 2007 |
+ } |
|
| 2008 |
+ if (!$this->sign_key_file) {
|
|
| 2009 |
+ $result .= $this->headerLine('MIME-Version', '1.0');
|
|
| 2010 |
+ $result .= $this->getMailMIME(); |
|
| 2011 |
+ } |
|
| 2012 |
+ |
|
| 2013 |
+ return $result; |
|
| 2014 |
+ } |
|
| 2015 |
+ |
|
| 2016 |
+ /** |
|
| 2017 |
+ * Get the message MIME type headers. |
|
| 2018 |
+ * @access public |
|
| 2019 |
+ * @return string |
|
| 2020 |
+ */ |
|
| 2021 |
+ public function getMailMIME() |
|
| 2022 |
+ {
|
|
| 2023 |
+ $result = ''; |
|
| 2024 |
+ $ismultipart = true; |
|
| 2025 |
+ switch ($this->message_type) {
|
|
| 2026 |
+ case 'inline': |
|
| 2027 |
+ $result .= $this->headerLine('Content-Type', 'multipart/related;');
|
|
| 2028 |
+ $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
|
|
| 2029 |
+ break; |
|
| 2030 |
+ case 'attach': |
|
| 2031 |
+ case 'inline_attach': |
|
| 2032 |
+ case 'alt_attach': |
|
| 2033 |
+ case 'alt_inline_attach': |
|
| 2034 |
+ $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
|
|
| 2035 |
+ $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
|
|
| 2036 |
+ break; |
|
| 2037 |
+ case 'alt': |
|
| 2038 |
+ case 'alt_inline': |
|
| 2039 |
+ $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
|
|
| 2040 |
+ $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
|
|
| 2041 |
+ break; |
|
| 2042 |
+ default: |
|
| 2043 |
+ // Catches case 'plain': and case '': |
|
| 2044 |
+ $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
|
|
| 2045 |
+ $ismultipart = false; |
|
| 2046 |
+ break; |
|
| 2047 |
+ } |
|
| 2048 |
+ // RFC1341 part 5 says 7bit is assumed if not specified |
|
| 2049 |
+ if ($this->Encoding != '7bit') {
|
|
| 2050 |
+ // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE |
|
| 2051 |
+ if ($ismultipart) {
|
|
| 2052 |
+ if ($this->Encoding == '8bit') {
|
|
| 2053 |
+ $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
|
|
| 2054 |
+ } |
|
| 2055 |
+ // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible |
|
| 2056 |
+ } else {
|
|
| 2057 |
+ $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
|
|
| 2058 |
+ } |
|
| 2059 |
+ } |
|
| 2060 |
+ |
|
| 2061 |
+ if ($this->Mailer != 'mail') {
|
|
| 2062 |
+ $result .= $this->LE; |
|
| 2063 |
+ } |
|
| 2064 |
+ |
|
| 2065 |
+ return $result; |
|
| 2066 |
+ } |
|
| 2067 |
+ |
|
| 2068 |
+ /** |
|
| 2069 |
+ * Returns the whole MIME message. |
|
| 2070 |
+ * Includes complete headers and body. |
|
| 2071 |
+ * Only valid post preSend(). |
|
| 2072 |
+ * @see PHPMailer::preSend() |
|
| 2073 |
+ * @access public |
|
| 2074 |
+ * @return string |
|
| 2075 |
+ */ |
|
| 2076 |
+ public function getSentMIMEMessage() |
|
| 2077 |
+ {
|
|
| 2078 |
+ return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody; |
|
| 2079 |
+ } |
|
| 2080 |
+ |
|
| 2081 |
+ /** |
|
| 2082 |
+ * Assemble the message body. |
|
| 2083 |
+ * Returns an empty string on failure. |
|
| 2084 |
+ * @access public |
|
| 2085 |
+ * @throws phpmailerException |
|
| 2086 |
+ * @return string The assembled message body |
|
| 2087 |
+ */ |
|
| 2088 |
+ public function createBody() |
|
| 2089 |
+ {
|
|
| 2090 |
+ $body = ''; |
|
| 2091 |
+ //Create unique IDs and preset boundaries |
|
| 2092 |
+ $this->uniqueid = md5(uniqid(time())); |
|
| 2093 |
+ $this->boundary[1] = 'b1_' . $this->uniqueid; |
|
| 2094 |
+ $this->boundary[2] = 'b2_' . $this->uniqueid; |
|
| 2095 |
+ $this->boundary[3] = 'b3_' . $this->uniqueid; |
|
| 2096 |
+ |
|
| 2097 |
+ if ($this->sign_key_file) {
|
|
| 2098 |
+ $body .= $this->getMailMIME() . $this->LE; |
|
| 2099 |
+ } |
|
| 2100 |
+ |
|
| 2101 |
+ $this->setWordWrap(); |
|
| 2102 |
+ |
|
| 2103 |
+ $bodyEncoding = $this->Encoding; |
|
| 2104 |
+ $bodyCharSet = $this->CharSet; |
|
| 2105 |
+ //Can we do a 7-bit downgrade? |
|
| 2106 |
+ if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
|
|
| 2107 |
+ $bodyEncoding = '7bit'; |
|
| 2108 |
+ $bodyCharSet = 'us-ascii'; |
|
| 2109 |
+ } |
|
| 2110 |
+ //If lines are too long, and we're not already using an encoding that will shorten them, |
|
| 2111 |
+ //change to quoted-printable transfer encoding |
|
| 2112 |
+ if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
|
|
| 2113 |
+ $this->Encoding = 'quoted-printable'; |
|
| 2114 |
+ $bodyEncoding = 'quoted-printable'; |
|
| 2115 |
+ } |
|
| 2116 |
+ |
|
| 2117 |
+ $altBodyEncoding = $this->Encoding; |
|
| 2118 |
+ $altBodyCharSet = $this->CharSet; |
|
| 2119 |
+ //Can we do a 7-bit downgrade? |
|
| 2120 |
+ if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
|
|
| 2121 |
+ $altBodyEncoding = '7bit'; |
|
| 2122 |
+ $altBodyCharSet = 'us-ascii'; |
|
| 2123 |
+ } |
|
| 2124 |
+ //If lines are too long, and we're not already using an encoding that will shorten them, |
|
| 2125 |
+ //change to quoted-printable transfer encoding |
|
| 2126 |
+ if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) {
|
|
| 2127 |
+ $altBodyEncoding = 'quoted-printable'; |
|
| 2128 |
+ } |
|
| 2129 |
+ //Use this as a preamble in all multipart message types |
|
| 2130 |
+ $mimepre = "This is a multi-part message in MIME format." . $this->LE . $this->LE; |
|
| 2131 |
+ switch ($this->message_type) {
|
|
| 2132 |
+ case 'inline': |
|
| 2133 |
+ $body .= $mimepre; |
|
| 2134 |
+ $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); |
|
| 2135 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2136 |
+ $body .= $this->LE . $this->LE; |
|
| 2137 |
+ $body .= $this->attachAll('inline', $this->boundary[1]);
|
|
| 2138 |
+ break; |
|
| 2139 |
+ case 'attach': |
|
| 2140 |
+ $body .= $mimepre; |
|
| 2141 |
+ $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); |
|
| 2142 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2143 |
+ $body .= $this->LE . $this->LE; |
|
| 2144 |
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
|
|
| 2145 |
+ break; |
|
| 2146 |
+ case 'inline_attach': |
|
| 2147 |
+ $body .= $mimepre; |
|
| 2148 |
+ $body .= $this->textLine('--' . $this->boundary[1]);
|
|
| 2149 |
+ $body .= $this->headerLine('Content-Type', 'multipart/related;');
|
|
| 2150 |
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
|
| 2151 |
+ $body .= $this->LE; |
|
| 2152 |
+ $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding); |
|
| 2153 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2154 |
+ $body .= $this->LE . $this->LE; |
|
| 2155 |
+ $body .= $this->attachAll('inline', $this->boundary[2]);
|
|
| 2156 |
+ $body .= $this->LE; |
|
| 2157 |
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
|
|
| 2158 |
+ break; |
|
| 2159 |
+ case 'alt': |
|
| 2160 |
+ $body .= $mimepre; |
|
| 2161 |
+ $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
| 2162 |
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
| 2163 |
+ $body .= $this->LE . $this->LE; |
|
| 2164 |
+ $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding); |
|
| 2165 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2166 |
+ $body .= $this->LE . $this->LE; |
|
| 2167 |
+ if (!empty($this->Ical)) {
|
|
| 2168 |
+ $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', ''); |
|
| 2169 |
+ $body .= $this->encodeString($this->Ical, $this->Encoding); |
|
| 2170 |
+ $body .= $this->LE . $this->LE; |
|
| 2171 |
+ } |
|
| 2172 |
+ $body .= $this->endBoundary($this->boundary[1]); |
|
| 2173 |
+ break; |
|
| 2174 |
+ case 'alt_inline': |
|
| 2175 |
+ $body .= $mimepre; |
|
| 2176 |
+ $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
| 2177 |
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
| 2178 |
+ $body .= $this->LE . $this->LE; |
|
| 2179 |
+ $body .= $this->textLine('--' . $this->boundary[1]);
|
|
| 2180 |
+ $body .= $this->headerLine('Content-Type', 'multipart/related;');
|
|
| 2181 |
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
|
| 2182 |
+ $body .= $this->LE; |
|
| 2183 |
+ $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); |
|
| 2184 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2185 |
+ $body .= $this->LE . $this->LE; |
|
| 2186 |
+ $body .= $this->attachAll('inline', $this->boundary[2]);
|
|
| 2187 |
+ $body .= $this->LE; |
|
| 2188 |
+ $body .= $this->endBoundary($this->boundary[1]); |
|
| 2189 |
+ break; |
|
| 2190 |
+ case 'alt_attach': |
|
| 2191 |
+ $body .= $mimepre; |
|
| 2192 |
+ $body .= $this->textLine('--' . $this->boundary[1]);
|
|
| 2193 |
+ $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
|
|
| 2194 |
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
|
| 2195 |
+ $body .= $this->LE; |
|
| 2196 |
+ $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
| 2197 |
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
| 2198 |
+ $body .= $this->LE . $this->LE; |
|
| 2199 |
+ $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); |
|
| 2200 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2201 |
+ $body .= $this->LE . $this->LE; |
|
| 2202 |
+ $body .= $this->endBoundary($this->boundary[2]); |
|
| 2203 |
+ $body .= $this->LE; |
|
| 2204 |
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
|
|
| 2205 |
+ break; |
|
| 2206 |
+ case 'alt_inline_attach': |
|
| 2207 |
+ $body .= $mimepre; |
|
| 2208 |
+ $body .= $this->textLine('--' . $this->boundary[1]);
|
|
| 2209 |
+ $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
|
|
| 2210 |
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
|
| 2211 |
+ $body .= $this->LE; |
|
| 2212 |
+ $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
|
| 2213 |
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
|
| 2214 |
+ $body .= $this->LE . $this->LE; |
|
| 2215 |
+ $body .= $this->textLine('--' . $this->boundary[2]);
|
|
| 2216 |
+ $body .= $this->headerLine('Content-Type', 'multipart/related;');
|
|
| 2217 |
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
|
|
| 2218 |
+ $body .= $this->LE; |
|
| 2219 |
+ $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding); |
|
| 2220 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2221 |
+ $body .= $this->LE . $this->LE; |
|
| 2222 |
+ $body .= $this->attachAll('inline', $this->boundary[3]);
|
|
| 2223 |
+ $body .= $this->LE; |
|
| 2224 |
+ $body .= $this->endBoundary($this->boundary[2]); |
|
| 2225 |
+ $body .= $this->LE; |
|
| 2226 |
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
|
|
| 2227 |
+ break; |
|
| 2228 |
+ default: |
|
| 2229 |
+ // catch case 'plain' and case '' |
|
| 2230 |
+ $body .= $this->encodeString($this->Body, $bodyEncoding); |
|
| 2231 |
+ break; |
|
| 2232 |
+ } |
|
| 2233 |
+ |
|
| 2234 |
+ if ($this->isError()) {
|
|
| 2235 |
+ $body = ''; |
|
| 2236 |
+ } elseif ($this->sign_key_file) {
|
|
| 2237 |
+ try {
|
|
| 2238 |
+ if (!defined('PKCS7_TEXT')) {
|
|
| 2239 |
+ throw new phpmailerException($this->lang('extension_missing') . 'openssl');
|
|
| 2240 |
+ } |
|
| 2241 |
+ // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1 |
|
| 2242 |
+ $file = tempnam(sys_get_temp_dir(), 'mail'); |
|
| 2243 |
+ if (false === file_put_contents($file, $body)) {
|
|
| 2244 |
+ throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
|
|
| 2245 |
+ } |
|
| 2246 |
+ $signed = tempnam(sys_get_temp_dir(), 'signed'); |
|
| 2247 |
+ //Workaround for PHP bug https://bugs.php.net/bug.php?id=69197 |
|
| 2248 |
+ if (empty($this->sign_extracerts_file)) {
|
|
| 2249 |
+ $sign = @openssl_pkcs7_sign( |
|
| 2250 |
+ $file, |
|
| 2251 |
+ $signed, |
|
| 2252 |
+ 'file://' . realpath($this->sign_cert_file), |
|
| 2253 |
+ array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
|
|
| 2254 |
+ null |
|
| 2255 |
+ ); |
|
| 2256 |
+ } else {
|
|
| 2257 |
+ $sign = @openssl_pkcs7_sign( |
|
| 2258 |
+ $file, |
|
| 2259 |
+ $signed, |
|
| 2260 |
+ 'file://' . realpath($this->sign_cert_file), |
|
| 2261 |
+ array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
|
|
| 2262 |
+ null, |
|
| 2263 |
+ PKCS7_DETACHED, |
|
| 2264 |
+ $this->sign_extracerts_file |
|
| 2265 |
+ ); |
|
| 2266 |
+ } |
|
| 2267 |
+ if ($sign) {
|
|
| 2268 |
+ @unlink($file); |
|
| 2269 |
+ $body = file_get_contents($signed); |
|
| 2270 |
+ @unlink($signed); |
|
| 2271 |
+ //The message returned by openssl contains both headers and body, so need to split them up |
|
| 2272 |
+ $parts = explode("\n\n", $body, 2);
|
|
| 2273 |
+ $this->MIMEHeader .= $parts[0] . $this->LE . $this->LE; |
|
| 2274 |
+ $body = $parts[1]; |
|
| 2275 |
+ } else {
|
|
| 2276 |
+ @unlink($file); |
|
| 2277 |
+ @unlink($signed); |
|
| 2278 |
+ throw new phpmailerException($this->lang('signing') . openssl_error_string());
|
|
| 2279 |
+ } |
|
| 2280 |
+ } catch (phpmailerException $exc) {
|
|
| 2281 |
+ $body = ''; |
|
| 2282 |
+ if ($this->exceptions) {
|
|
| 2283 |
+ throw $exc; |
|
| 2284 |
+ } |
|
| 2285 |
+ } |
|
| 2286 |
+ } |
|
| 2287 |
+ return $body; |
|
| 2288 |
+ } |
|
| 2289 |
+ |
|
| 2290 |
+ /** |
|
| 2291 |
+ * Return the start of a message boundary. |
|
| 2292 |
+ * @access protected |
|
| 2293 |
+ * @param string $boundary |
|
| 2294 |
+ * @param string $charSet |
|
| 2295 |
+ * @param string $contentType |
|
| 2296 |
+ * @param string $encoding |
|
| 2297 |
+ * @return string |
|
| 2298 |
+ */ |
|
| 2299 |
+ protected function getBoundary($boundary, $charSet, $contentType, $encoding) |
|
| 2300 |
+ {
|
|
| 2301 |
+ $result = ''; |
|
| 2302 |
+ if ($charSet == '') {
|
|
| 2303 |
+ $charSet = $this->CharSet; |
|
| 2304 |
+ } |
|
| 2305 |
+ if ($contentType == '') {
|
|
| 2306 |
+ $contentType = $this->ContentType; |
|
| 2307 |
+ } |
|
| 2308 |
+ if ($encoding == '') {
|
|
| 2309 |
+ $encoding = $this->Encoding; |
|
| 2310 |
+ } |
|
| 2311 |
+ $result .= $this->textLine('--' . $boundary);
|
|
| 2312 |
+ $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
|
|
| 2313 |
+ $result .= $this->LE; |
|
| 2314 |
+ // RFC1341 part 5 says 7bit is assumed if not specified |
|
| 2315 |
+ if ($encoding != '7bit') {
|
|
| 2316 |
+ $result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
|
|
| 2317 |
+ } |
|
| 2318 |
+ $result .= $this->LE; |
|
| 2319 |
+ |
|
| 2320 |
+ return $result; |
|
| 2321 |
+ } |
|
| 2322 |
+ |
|
| 2323 |
+ /** |
|
| 2324 |
+ * Return the end of a message boundary. |
|
| 2325 |
+ * @access protected |
|
| 2326 |
+ * @param string $boundary |
|
| 2327 |
+ * @return string |
|
| 2328 |
+ */ |
|
| 2329 |
+ protected function endBoundary($boundary) |
|
| 2330 |
+ {
|
|
| 2331 |
+ return $this->LE . '--' . $boundary . '--' . $this->LE; |
|
| 2332 |
+ } |
|
| 2333 |
+ |
|
| 2334 |
+ /** |
|
| 2335 |
+ * Set the message type. |
|
| 2336 |
+ * PHPMailer only supports some preset message types, |
|
| 2337 |
+ * not arbitrary MIME structures. |
|
| 2338 |
+ * @access protected |
|
| 2339 |
+ * @return void |
|
| 2340 |
+ */ |
|
| 2341 |
+ protected function setMessageType() |
|
| 2342 |
+ {
|
|
| 2343 |
+ $type = array(); |
|
| 2344 |
+ if ($this->alternativeExists()) {
|
|
| 2345 |
+ $type[] = 'alt'; |
|
| 2346 |
+ } |
|
| 2347 |
+ if ($this->inlineImageExists()) {
|
|
| 2348 |
+ $type[] = 'inline'; |
|
| 2349 |
+ } |
|
| 2350 |
+ if ($this->attachmentExists()) {
|
|
| 2351 |
+ $type[] = 'attach'; |
|
| 2352 |
+ } |
|
| 2353 |
+ $this->message_type = implode('_', $type);
|
|
| 2354 |
+ if ($this->message_type == '') {
|
|
| 2355 |
+ $this->message_type = 'plain'; |
|
| 2356 |
+ } |
|
| 2357 |
+ } |
|
| 2358 |
+ |
|
| 2359 |
+ /** |
|
| 2360 |
+ * Format a header line. |
|
| 2361 |
+ * @access public |
|
| 2362 |
+ * @param string $name |
|
| 2363 |
+ * @param string $value |
|
| 2364 |
+ * @return string |
|
| 2365 |
+ */ |
|
| 2366 |
+ public function headerLine($name, $value) |
|
| 2367 |
+ {
|
|
| 2368 |
+ return $name . ': ' . $value . $this->LE; |
|
| 2369 |
+ } |
|
| 2370 |
+ |
|
| 2371 |
+ /** |
|
| 2372 |
+ * Return a formatted mail line. |
|
| 2373 |
+ * @access public |
|
| 2374 |
+ * @param string $value |
|
| 2375 |
+ * @return string |
|
| 2376 |
+ */ |
|
| 2377 |
+ public function textLine($value) |
|
| 2378 |
+ {
|
|
| 2379 |
+ return $value . $this->LE; |
|
| 2380 |
+ } |
|
| 2381 |
+ |
|
| 2382 |
+ /** |
|
| 2383 |
+ * Add an attachment from a path on the filesystem. |
|
| 2384 |
+ * Returns false if the file could not be found or read. |
|
| 2385 |
+ * @param string $path Path to the attachment. |
|
| 2386 |
+ * @param string $name Overrides the attachment name. |
|
| 2387 |
+ * @param string $encoding File encoding (see $Encoding). |
|
| 2388 |
+ * @param string $type File extension (MIME) type. |
|
| 2389 |
+ * @param string $disposition Disposition to use |
|
| 2390 |
+ * @throws phpmailerException |
|
| 2391 |
+ * @return boolean |
|
| 2392 |
+ */ |
|
| 2393 |
+ public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') |
|
| 2394 |
+ {
|
|
| 2395 |
+ try {
|
|
| 2396 |
+ if (!@is_file($path)) {
|
|
| 2397 |
+ throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
|
|
| 2398 |
+ } |
|
| 2399 |
+ |
|
| 2400 |
+ // If a MIME type is not specified, try to work it out from the file name |
|
| 2401 |
+ if ($type == '') {
|
|
| 2402 |
+ $type = self::filenameToType($path); |
|
| 2403 |
+ } |
|
| 2404 |
+ |
|
| 2405 |
+ $filename = basename($path); |
|
| 2406 |
+ if ($name == '') {
|
|
| 2407 |
+ $name = $filename; |
|
| 2408 |
+ } |
|
| 2409 |
+ |
|
| 2410 |
+ $this->attachment[] = array( |
|
| 2411 |
+ 0 => $path, |
|
| 2412 |
+ 1 => $filename, |
|
| 2413 |
+ 2 => $name, |
|
| 2414 |
+ 3 => $encoding, |
|
| 2415 |
+ 4 => $type, |
|
| 2416 |
+ 5 => false, // isStringAttachment |
|
| 2417 |
+ 6 => $disposition, |
|
| 2418 |
+ 7 => 0 |
|
| 2419 |
+ ); |
|
| 2420 |
+ |
|
| 2421 |
+ } catch (phpmailerException $exc) {
|
|
| 2422 |
+ $this->setError($exc->getMessage()); |
|
| 2423 |
+ $this->edebug($exc->getMessage()); |
|
| 2424 |
+ if ($this->exceptions) {
|
|
| 2425 |
+ throw $exc; |
|
| 2426 |
+ } |
|
| 2427 |
+ return false; |
|
| 2428 |
+ } |
|
| 2429 |
+ return true; |
|
| 2430 |
+ } |
|
| 2431 |
+ |
|
| 2432 |
+ /** |
|
| 2433 |
+ * Return the array of attachments. |
|
| 2434 |
+ * @return array |
|
| 2435 |
+ */ |
|
| 2436 |
+ public function getAttachments() |
|
| 2437 |
+ {
|
|
| 2438 |
+ return $this->attachment; |
|
| 2439 |
+ } |
|
| 2440 |
+ |
|
| 2441 |
+ /** |
|
| 2442 |
+ * Attach all file, string, and binary attachments to the message. |
|
| 2443 |
+ * Returns an empty string on failure. |
|
| 2444 |
+ * @access protected |
|
| 2445 |
+ * @param string $disposition_type |
|
| 2446 |
+ * @param string $boundary |
|
| 2447 |
+ * @return string |
|
| 2448 |
+ */ |
|
| 2449 |
+ protected function attachAll($disposition_type, $boundary) |
|
| 2450 |
+ {
|
|
| 2451 |
+ // Return text of body |
|
| 2452 |
+ $mime = array(); |
|
| 2453 |
+ $cidUniq = array(); |
|
| 2454 |
+ $incl = array(); |
|
| 2455 |
+ |
|
| 2456 |
+ // Add all attachments |
|
| 2457 |
+ foreach ($this->attachment as $attachment) {
|
|
| 2458 |
+ // Check if it is a valid disposition_filter |
|
| 2459 |
+ if ($attachment[6] == $disposition_type) {
|
|
| 2460 |
+ // Check for string attachment |
|
| 2461 |
+ $string = ''; |
|
| 2462 |
+ $path = ''; |
|
| 2463 |
+ $bString = $attachment[5]; |
|
| 2464 |
+ if ($bString) {
|
|
| 2465 |
+ $string = $attachment[0]; |
|
| 2466 |
+ } else {
|
|
| 2467 |
+ $path = $attachment[0]; |
|
| 2468 |
+ } |
|
| 2469 |
+ |
|
| 2470 |
+ $inclhash = md5(serialize($attachment)); |
|
| 2471 |
+ if (in_array($inclhash, $incl)) {
|
|
| 2472 |
+ continue; |
|
| 2473 |
+ } |
|
| 2474 |
+ $incl[] = $inclhash; |
|
| 2475 |
+ $name = $attachment[2]; |
|
| 2476 |
+ $encoding = $attachment[3]; |
|
| 2477 |
+ $type = $attachment[4]; |
|
| 2478 |
+ $disposition = $attachment[6]; |
|
| 2479 |
+ $cid = $attachment[7]; |
|
| 2480 |
+ if ($disposition == 'inline' && array_key_exists($cid, $cidUniq)) {
|
|
| 2481 |
+ continue; |
|
| 2482 |
+ } |
|
| 2483 |
+ $cidUniq[$cid] = true; |
|
| 2484 |
+ |
|
| 2485 |
+ $mime[] = sprintf('--%s%s', $boundary, $this->LE);
|
|
| 2486 |
+ //Only include a filename property if we have one |
|
| 2487 |
+ if (!empty($name)) {
|
|
| 2488 |
+ $mime[] = sprintf( |
|
| 2489 |
+ 'Content-Type: %s; name="%s"%s', |
|
| 2490 |
+ $type, |
|
| 2491 |
+ $this->encodeHeader($this->secureHeader($name)), |
|
| 2492 |
+ $this->LE |
|
| 2493 |
+ ); |
|
| 2494 |
+ } else {
|
|
| 2495 |
+ $mime[] = sprintf( |
|
| 2496 |
+ 'Content-Type: %s%s', |
|
| 2497 |
+ $type, |
|
| 2498 |
+ $this->LE |
|
| 2499 |
+ ); |
|
| 2500 |
+ } |
|
| 2501 |
+ // RFC1341 part 5 says 7bit is assumed if not specified |
|
| 2502 |
+ if ($encoding != '7bit') {
|
|
| 2503 |
+ $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
|
|
| 2504 |
+ } |
|
| 2505 |
+ |
|
| 2506 |
+ if ($disposition == 'inline') {
|
|
| 2507 |
+ $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
|
|
| 2508 |
+ } |
|
| 2509 |
+ |
|
| 2510 |
+ // If a filename contains any of these chars, it should be quoted, |
|
| 2511 |
+ // but not otherwise: RFC2183 & RFC2045 5.1 |
|
| 2512 |
+ // Fixes a warning in IETF's msglint MIME checker |
|
| 2513 |
+ // Allow for bypassing the Content-Disposition header totally |
|
| 2514 |
+ if (!(empty($disposition))) {
|
|
| 2515 |
+ $encoded_name = $this->encodeHeader($this->secureHeader($name)); |
|
| 2516 |
+ if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
|
|
| 2517 |
+ $mime[] = sprintf( |
|
| 2518 |
+ 'Content-Disposition: %s; filename="%s"%s', |
|
| 2519 |
+ $disposition, |
|
| 2520 |
+ $encoded_name, |
|
| 2521 |
+ $this->LE . $this->LE |
|
| 2522 |
+ ); |
|
| 2523 |
+ } else {
|
|
| 2524 |
+ if (!empty($encoded_name)) {
|
|
| 2525 |
+ $mime[] = sprintf( |
|
| 2526 |
+ 'Content-Disposition: %s; filename=%s%s', |
|
| 2527 |
+ $disposition, |
|
| 2528 |
+ $encoded_name, |
|
| 2529 |
+ $this->LE . $this->LE |
|
| 2530 |
+ ); |
|
| 2531 |
+ } else {
|
|
| 2532 |
+ $mime[] = sprintf( |
|
| 2533 |
+ 'Content-Disposition: %s%s', |
|
| 2534 |
+ $disposition, |
|
| 2535 |
+ $this->LE . $this->LE |
|
| 2536 |
+ ); |
|
| 2537 |
+ } |
|
| 2538 |
+ } |
|
| 2539 |
+ } else {
|
|
| 2540 |
+ $mime[] = $this->LE; |
|
| 2541 |
+ } |
|
| 2542 |
+ |
|
| 2543 |
+ // Encode as string attachment |
|
| 2544 |
+ if ($bString) {
|
|
| 2545 |
+ $mime[] = $this->encodeString($string, $encoding); |
|
| 2546 |
+ if ($this->isError()) {
|
|
| 2547 |
+ return ''; |
|
| 2548 |
+ } |
|
| 2549 |
+ $mime[] = $this->LE . $this->LE; |
|
| 2550 |
+ } else {
|
|
| 2551 |
+ $mime[] = $this->encodeFile($path, $encoding); |
|
| 2552 |
+ if ($this->isError()) {
|
|
| 2553 |
+ return ''; |
|
| 2554 |
+ } |
|
| 2555 |
+ $mime[] = $this->LE . $this->LE; |
|
| 2556 |
+ } |
|
| 2557 |
+ } |
|
| 2558 |
+ } |
|
| 2559 |
+ |
|
| 2560 |
+ $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
|
|
| 2561 |
+ |
|
| 2562 |
+ return implode('', $mime);
|
|
| 2563 |
+ } |
|
| 2564 |
+ |
|
| 2565 |
+ /** |
|
| 2566 |
+ * Encode a file attachment in requested format. |
|
| 2567 |
+ * Returns an empty string on failure. |
|
| 2568 |
+ * @param string $path The full path to the file |
|
| 2569 |
+ * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
|
| 2570 |
+ * @throws phpmailerException |
|
| 2571 |
+ * @access protected |
|
| 2572 |
+ * @return string |
|
| 2573 |
+ */ |
|
| 2574 |
+ protected function encodeFile($path, $encoding = 'base64') |
|
| 2575 |
+ {
|
|
| 2576 |
+ try {
|
|
| 2577 |
+ if (!is_readable($path)) {
|
|
| 2578 |
+ throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
|
|
| 2579 |
+ } |
|
| 2580 |
+ $magic_quotes = get_magic_quotes_runtime(); |
|
| 2581 |
+ if ($magic_quotes) {
|
|
| 2582 |
+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
|
| 2583 |
+ set_magic_quotes_runtime(false); |
|
| 2584 |
+ } else {
|
|
| 2585 |
+ //Doesn't exist in PHP 5.4, but we don't need to check because |
|
| 2586 |
+ //get_magic_quotes_runtime always returns false in 5.4+ |
|
| 2587 |
+ //so it will never get here |
|
| 2588 |
+ ini_set('magic_quotes_runtime', false);
|
|
| 2589 |
+ } |
|
| 2590 |
+ } |
|
| 2591 |
+ $file_buffer = file_get_contents($path); |
|
| 2592 |
+ $file_buffer = $this->encodeString($file_buffer, $encoding); |
|
| 2593 |
+ if ($magic_quotes) {
|
|
| 2594 |
+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
|
| 2595 |
+ set_magic_quotes_runtime($magic_quotes); |
|
| 2596 |
+ } else {
|
|
| 2597 |
+ ini_set('magic_quotes_runtime', $magic_quotes);
|
|
| 2598 |
+ } |
|
| 2599 |
+ } |
|
| 2600 |
+ return $file_buffer; |
|
| 2601 |
+ } catch (Exception $exc) {
|
|
| 2602 |
+ $this->setError($exc->getMessage()); |
|
| 2603 |
+ return ''; |
|
| 2604 |
+ } |
|
| 2605 |
+ } |
|
| 2606 |
+ |
|
| 2607 |
+ /** |
|
| 2608 |
+ * Encode a string in requested format. |
|
| 2609 |
+ * Returns an empty string on failure. |
|
| 2610 |
+ * @param string $str The text to encode |
|
| 2611 |
+ * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
|
| 2612 |
+ * @access public |
|
| 2613 |
+ * @return string |
|
| 2614 |
+ */ |
|
| 2615 |
+ public function encodeString($str, $encoding = 'base64') |
|
| 2616 |
+ {
|
|
| 2617 |
+ $encoded = ''; |
|
| 2618 |
+ switch (strtolower($encoding)) {
|
|
| 2619 |
+ case 'base64': |
|
| 2620 |
+ $encoded = chunk_split(base64_encode($str), 76, $this->LE); |
|
| 2621 |
+ break; |
|
| 2622 |
+ case '7bit': |
|
| 2623 |
+ case '8bit': |
|
| 2624 |
+ $encoded = $this->fixEOL($str); |
|
| 2625 |
+ // Make sure it ends with a line break |
|
| 2626 |
+ if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
|
|
| 2627 |
+ $encoded .= $this->LE; |
|
| 2628 |
+ } |
|
| 2629 |
+ break; |
|
| 2630 |
+ case 'binary': |
|
| 2631 |
+ $encoded = $str; |
|
| 2632 |
+ break; |
|
| 2633 |
+ case 'quoted-printable': |
|
| 2634 |
+ $encoded = $this->encodeQP($str); |
|
| 2635 |
+ break; |
|
| 2636 |
+ default: |
|
| 2637 |
+ $this->setError($this->lang('encoding') . $encoding);
|
|
| 2638 |
+ break; |
|
| 2639 |
+ } |
|
| 2640 |
+ return $encoded; |
|
| 2641 |
+ } |
|
| 2642 |
+ |
|
| 2643 |
+ /** |
|
| 2644 |
+ * Encode a header string optimally. |
|
| 2645 |
+ * Picks shortest of Q, B, quoted-printable or none. |
|
| 2646 |
+ * @access public |
|
| 2647 |
+ * @param string $str |
|
| 2648 |
+ * @param string $position |
|
| 2649 |
+ * @return string |
|
| 2650 |
+ */ |
|
| 2651 |
+ public function encodeHeader($str, $position = 'text') |
|
| 2652 |
+ {
|
|
| 2653 |
+ $matchcount = 0; |
|
| 2654 |
+ switch (strtolower($position)) {
|
|
| 2655 |
+ case 'phrase': |
|
| 2656 |
+ if (!preg_match('/[\200-\377]/', $str)) {
|
|
| 2657 |
+ // Can't use addslashes as we don't know the value of magic_quotes_sybase |
|
| 2658 |
+ $encoded = addcslashes($str, "\0..\37\177\\\""); |
|
| 2659 |
+ if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
|
|
| 2660 |
+ return ($encoded); |
|
| 2661 |
+ } else {
|
|
| 2662 |
+ return ("\"$encoded\"");
|
|
| 2663 |
+ } |
|
| 2664 |
+ } |
|
| 2665 |
+ $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
|
|
| 2666 |
+ break; |
|
| 2667 |
+ /** @noinspection PhpMissingBreakStatementInspection */ |
|
| 2668 |
+ case 'comment': |
|
| 2669 |
+ $matchcount = preg_match_all('/[()"]/', $str, $matches);
|
|
| 2670 |
+ // Intentional fall-through |
|
| 2671 |
+ case 'text': |
|
| 2672 |
+ default: |
|
| 2673 |
+ $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
|
|
| 2674 |
+ break; |
|
| 2675 |
+ } |
|
| 2676 |
+ |
|
| 2677 |
+ //There are no chars that need encoding |
|
| 2678 |
+ if ($matchcount == 0) {
|
|
| 2679 |
+ return ($str); |
|
| 2680 |
+ } |
|
| 2681 |
+ |
|
| 2682 |
+ $maxlen = 75 - 7 - strlen($this->CharSet); |
|
| 2683 |
+ // Try to select the encoding which should produce the shortest output |
|
| 2684 |
+ if ($matchcount > strlen($str) / 3) {
|
|
| 2685 |
+ // More than a third of the content will need encoding, so B encoding will be most efficient |
|
| 2686 |
+ $encoding = 'B'; |
|
| 2687 |
+ if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
|
|
| 2688 |
+ // Use a custom function which correctly encodes and wraps long |
|
| 2689 |
+ // multibyte strings without breaking lines within a character |
|
| 2690 |
+ $encoded = $this->base64EncodeWrapMB($str, "\n"); |
|
| 2691 |
+ } else {
|
|
| 2692 |
+ $encoded = base64_encode($str); |
|
| 2693 |
+ $maxlen -= $maxlen % 4; |
|
| 2694 |
+ $encoded = trim(chunk_split($encoded, $maxlen, "\n")); |
|
| 2695 |
+ } |
|
| 2696 |
+ } else {
|
|
| 2697 |
+ $encoding = 'Q'; |
|
| 2698 |
+ $encoded = $this->encodeQ($str, $position); |
|
| 2699 |
+ $encoded = $this->wrapText($encoded, $maxlen, true); |
|
| 2700 |
+ $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
|
|
| 2701 |
+ } |
|
| 2702 |
+ |
|
| 2703 |
+ $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
|
|
| 2704 |
+ $encoded = trim(str_replace("\n", $this->LE, $encoded));
|
|
| 2705 |
+ |
|
| 2706 |
+ return $encoded; |
|
| 2707 |
+ } |
|
| 2708 |
+ |
|
| 2709 |
+ /** |
|
| 2710 |
+ * Check if a string contains multi-byte characters. |
|
| 2711 |
+ * @access public |
|
| 2712 |
+ * @param string $str multi-byte text to wrap encode |
|
| 2713 |
+ * @return boolean |
|
| 2714 |
+ */ |
|
| 2715 |
+ public function hasMultiBytes($str) |
|
| 2716 |
+ {
|
|
| 2717 |
+ if (function_exists('mb_strlen')) {
|
|
| 2718 |
+ return (strlen($str) > mb_strlen($str, $this->CharSet)); |
|
| 2719 |
+ } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
|
|
| 2720 |
+ return false; |
|
| 2721 |
+ } |
|
| 2722 |
+ } |
|
| 2723 |
+ |
|
| 2724 |
+ /** |
|
| 2725 |
+ * Does a string contain any 8-bit chars (in any charset)? |
|
| 2726 |
+ * @param string $text |
|
| 2727 |
+ * @return boolean |
|
| 2728 |
+ */ |
|
| 2729 |
+ public function has8bitChars($text) |
|
| 2730 |
+ {
|
|
| 2731 |
+ return (boolean)preg_match('/[\x80-\xFF]/', $text);
|
|
| 2732 |
+ } |
|
| 2733 |
+ |
|
| 2734 |
+ /** |
|
| 2735 |
+ * Encode and wrap long multibyte strings for mail headers |
|
| 2736 |
+ * without breaking lines within a character. |
|
| 2737 |
+ * Adapted from a function by paravoid |
|
| 2738 |
+ * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283 |
|
| 2739 |
+ * @access public |
|
| 2740 |
+ * @param string $str multi-byte text to wrap encode |
|
| 2741 |
+ * @param string $linebreak string to use as linefeed/end-of-line |
|
| 2742 |
+ * @return string |
|
| 2743 |
+ */ |
|
| 2744 |
+ public function base64EncodeWrapMB($str, $linebreak = null) |
|
| 2745 |
+ {
|
|
| 2746 |
+ $start = '=?' . $this->CharSet . '?B?'; |
|
| 2747 |
+ $end = '?='; |
|
| 2748 |
+ $encoded = ''; |
|
| 2749 |
+ if ($linebreak === null) {
|
|
| 2750 |
+ $linebreak = $this->LE; |
|
| 2751 |
+ } |
|
| 2752 |
+ |
|
| 2753 |
+ $mb_length = mb_strlen($str, $this->CharSet); |
|
| 2754 |
+ // Each line must have length <= 75, including $start and $end |
|
| 2755 |
+ $length = 75 - strlen($start) - strlen($end); |
|
| 2756 |
+ // Average multi-byte ratio |
|
| 2757 |
+ $ratio = $mb_length / strlen($str); |
|
| 2758 |
+ // Base64 has a 4:3 ratio |
|
| 2759 |
+ $avgLength = floor($length * $ratio * .75); |
|
| 2760 |
+ |
|
| 2761 |
+ for ($i = 0; $i < $mb_length; $i += $offset) {
|
|
| 2762 |
+ $lookBack = 0; |
|
| 2763 |
+ do {
|
|
| 2764 |
+ $offset = $avgLength - $lookBack; |
|
| 2765 |
+ $chunk = mb_substr($str, $i, $offset, $this->CharSet); |
|
| 2766 |
+ $chunk = base64_encode($chunk); |
|
| 2767 |
+ $lookBack++; |
|
| 2768 |
+ } while (strlen($chunk) > $length); |
|
| 2769 |
+ $encoded .= $chunk . $linebreak; |
|
| 2770 |
+ } |
|
| 2771 |
+ |
|
| 2772 |
+ // Chomp the last linefeed |
|
| 2773 |
+ $encoded = substr($encoded, 0, -strlen($linebreak)); |
|
| 2774 |
+ return $encoded; |
|
| 2775 |
+ } |
|
| 2776 |
+ |
|
| 2777 |
+ /** |
|
| 2778 |
+ * Encode a string in quoted-printable format. |
|
| 2779 |
+ * According to RFC2045 section 6.7. |
|
| 2780 |
+ * @access public |
|
| 2781 |
+ * @param string $string The text to encode |
|
| 2782 |
+ * @param integer $line_max Number of chars allowed on a line before wrapping |
|
| 2783 |
+ * @return string |
|
| 2784 |
+ * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment |
|
| 2785 |
+ */ |
|
| 2786 |
+ public function encodeQP($string, $line_max = 76) |
|
| 2787 |
+ {
|
|
| 2788 |
+ // Use native function if it's available (>= PHP5.3) |
|
| 2789 |
+ if (function_exists('quoted_printable_encode')) {
|
|
| 2790 |
+ return quoted_printable_encode($string); |
|
| 2791 |
+ } |
|
| 2792 |
+ // Fall back to a pure PHP implementation |
|
| 2793 |
+ $string = str_replace( |
|
| 2794 |
+ array('%20', '%0D%0A.', '%0D%0A', '%'),
|
|
| 2795 |
+ array(' ', "\r\n=2E", "\r\n", '='),
|
|
| 2796 |
+ rawurlencode($string) |
|
| 2797 |
+ ); |
|
| 2798 |
+ return preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
|
|
| 2799 |
+ } |
|
| 2800 |
+ |
|
| 2801 |
+ /** |
|
| 2802 |
+ * Backward compatibility wrapper for an old QP encoding function that was removed. |
|
| 2803 |
+ * @see PHPMailer::encodeQP() |
|
| 2804 |
+ * @access public |
|
| 2805 |
+ * @param string $string |
|
| 2806 |
+ * @param integer $line_max |
|
| 2807 |
+ * @param boolean $space_conv |
|
| 2808 |
+ * @return string |
|
| 2809 |
+ * @deprecated Use encodeQP instead. |
|
| 2810 |
+ */ |
|
| 2811 |
+ public function encodeQPphp( |
|
| 2812 |
+ $string, |
|
| 2813 |
+ $line_max = 76, |
|
| 2814 |
+ /** @noinspection PhpUnusedParameterInspection */ $space_conv = false |
|
| 2815 |
+ ) {
|
|
| 2816 |
+ return $this->encodeQP($string, $line_max); |
|
| 2817 |
+ } |
|
| 2818 |
+ |
|
| 2819 |
+ /** |
|
| 2820 |
+ * Encode a string using Q encoding. |
|
| 2821 |
+ * @link http://tools.ietf.org/html/rfc2047 |
|
| 2822 |
+ * @param string $str the text to encode |
|
| 2823 |
+ * @param string $position Where the text is going to be used, see the RFC for what that means |
|
| 2824 |
+ * @access public |
|
| 2825 |
+ * @return string |
|
| 2826 |
+ */ |
|
| 2827 |
+ public function encodeQ($str, $position = 'text') |
|
| 2828 |
+ {
|
|
| 2829 |
+ // There should not be any EOL in the string |
|
| 2830 |
+ $pattern = ''; |
|
| 2831 |
+ $encoded = str_replace(array("\r", "\n"), '', $str);
|
|
| 2832 |
+ switch (strtolower($position)) {
|
|
| 2833 |
+ case 'phrase': |
|
| 2834 |
+ // RFC 2047 section 5.3 |
|
| 2835 |
+ $pattern = '^A-Za-z0-9!*+\/ -'; |
|
| 2836 |
+ break; |
|
| 2837 |
+ /** @noinspection PhpMissingBreakStatementInspection */ |
|
| 2838 |
+ case 'comment': |
|
| 2839 |
+ // RFC 2047 section 5.2 |
|
| 2840 |
+ $pattern = '\(\)"'; |
|
| 2841 |
+ // intentional fall-through |
|
| 2842 |
+ // for this reason we build the $pattern without including delimiters and [] |
|
| 2843 |
+ case 'text': |
|
| 2844 |
+ default: |
|
| 2845 |
+ // RFC 2047 section 5.1 |
|
| 2846 |
+ // Replace every high ascii, control, =, ? and _ characters |
|
| 2847 |
+ $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; |
|
| 2848 |
+ break; |
|
| 2849 |
+ } |
|
| 2850 |
+ $matches = array(); |
|
| 2851 |
+ if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
|
|
| 2852 |
+ // If the string contains an '=', make sure it's the first thing we replace |
|
| 2853 |
+ // so as to avoid double-encoding |
|
| 2854 |
+ $eqkey = array_search('=', $matches[0]);
|
|
| 2855 |
+ if (false !== $eqkey) {
|
|
| 2856 |
+ unset($matches[0][$eqkey]); |
|
| 2857 |
+ array_unshift($matches[0], '='); |
|
| 2858 |
+ } |
|
| 2859 |
+ foreach (array_unique($matches[0]) as $char) {
|
|
| 2860 |
+ $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
|
|
| 2861 |
+ } |
|
| 2862 |
+ } |
|
| 2863 |
+ // Replace every spaces to _ (more readable than =20) |
|
| 2864 |
+ return str_replace(' ', '_', $encoded);
|
|
| 2865 |
+ } |
|
| 2866 |
+ |
|
| 2867 |
+ /** |
|
| 2868 |
+ * Add a string or binary attachment (non-filesystem). |
|
| 2869 |
+ * This method can be used to attach ascii or binary data, |
|
| 2870 |
+ * such as a BLOB record from a database. |
|
| 2871 |
+ * @param string $string String attachment data. |
|
| 2872 |
+ * @param string $filename Name of the attachment. |
|
| 2873 |
+ * @param string $encoding File encoding (see $Encoding). |
|
| 2874 |
+ * @param string $type File extension (MIME) type. |
|
| 2875 |
+ * @param string $disposition Disposition to use |
|
| 2876 |
+ * @return void |
|
| 2877 |
+ */ |
|
| 2878 |
+ public function addStringAttachment( |
|
| 2879 |
+ $string, |
|
| 2880 |
+ $filename, |
|
| 2881 |
+ $encoding = 'base64', |
|
| 2882 |
+ $type = '', |
|
| 2883 |
+ $disposition = 'attachment' |
|
| 2884 |
+ ) {
|
|
| 2885 |
+ // If a MIME type is not specified, try to work it out from the file name |
|
| 2886 |
+ if ($type == '') {
|
|
| 2887 |
+ $type = self::filenameToType($filename); |
|
| 2888 |
+ } |
|
| 2889 |
+ // Append to $attachment array |
|
| 2890 |
+ $this->attachment[] = array( |
|
| 2891 |
+ 0 => $string, |
|
| 2892 |
+ 1 => $filename, |
|
| 2893 |
+ 2 => basename($filename), |
|
| 2894 |
+ 3 => $encoding, |
|
| 2895 |
+ 4 => $type, |
|
| 2896 |
+ 5 => true, // isStringAttachment |
|
| 2897 |
+ 6 => $disposition, |
|
| 2898 |
+ 7 => 0 |
|
| 2899 |
+ ); |
|
| 2900 |
+ } |
|
| 2901 |
+ |
|
| 2902 |
+ /** |
|
| 2903 |
+ * Add an embedded (inline) attachment from a file. |
|
| 2904 |
+ * This can include images, sounds, and just about any other document type. |
|
| 2905 |
+ * These differ from 'regular' attachments in that they are intended to be |
|
| 2906 |
+ * displayed inline with the message, not just attached for download. |
|
| 2907 |
+ * This is used in HTML messages that embed the images |
|
| 2908 |
+ * the HTML refers to using the $cid value. |
|
| 2909 |
+ * @param string $path Path to the attachment. |
|
| 2910 |
+ * @param string $cid Content ID of the attachment; Use this to reference |
|
| 2911 |
+ * the content when using an embedded image in HTML. |
|
| 2912 |
+ * @param string $name Overrides the attachment name. |
|
| 2913 |
+ * @param string $encoding File encoding (see $Encoding). |
|
| 2914 |
+ * @param string $type File MIME type. |
|
| 2915 |
+ * @param string $disposition Disposition to use |
|
| 2916 |
+ * @return boolean True on successfully adding an attachment |
|
| 2917 |
+ */ |
|
| 2918 |
+ public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline') |
|
| 2919 |
+ {
|
|
| 2920 |
+ if (!@is_file($path)) {
|
|
| 2921 |
+ $this->setError($this->lang('file_access') . $path);
|
|
| 2922 |
+ return false; |
|
| 2923 |
+ } |
|
| 2924 |
+ |
|
| 2925 |
+ // If a MIME type is not specified, try to work it out from the file name |
|
| 2926 |
+ if ($type == '') {
|
|
| 2927 |
+ $type = self::filenameToType($path); |
|
| 2928 |
+ } |
|
| 2929 |
+ |
|
| 2930 |
+ $filename = basename($path); |
|
| 2931 |
+ if ($name == '') {
|
|
| 2932 |
+ $name = $filename; |
|
| 2933 |
+ } |
|
| 2934 |
+ |
|
| 2935 |
+ // Append to $attachment array |
|
| 2936 |
+ $this->attachment[] = array( |
|
| 2937 |
+ 0 => $path, |
|
| 2938 |
+ 1 => $filename, |
|
| 2939 |
+ 2 => $name, |
|
| 2940 |
+ 3 => $encoding, |
|
| 2941 |
+ 4 => $type, |
|
| 2942 |
+ 5 => false, // isStringAttachment |
|
| 2943 |
+ 6 => $disposition, |
|
| 2944 |
+ 7 => $cid |
|
| 2945 |
+ ); |
|
| 2946 |
+ return true; |
|
| 2947 |
+ } |
|
| 2948 |
+ |
|
| 2949 |
+ /** |
|
| 2950 |
+ * Add an embedded stringified attachment. |
|
| 2951 |
+ * This can include images, sounds, and just about any other document type. |
|
| 2952 |
+ * Be sure to set the $type to an image type for images: |
|
| 2953 |
+ * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. |
|
| 2954 |
+ * @param string $string The attachment binary data. |
|
| 2955 |
+ * @param string $cid Content ID of the attachment; Use this to reference |
|
| 2956 |
+ * the content when using an embedded image in HTML. |
|
| 2957 |
+ * @param string $name |
|
| 2958 |
+ * @param string $encoding File encoding (see $Encoding). |
|
| 2959 |
+ * @param string $type MIME type. |
|
| 2960 |
+ * @param string $disposition Disposition to use |
|
| 2961 |
+ * @return boolean True on successfully adding an attachment |
|
| 2962 |
+ */ |
|
| 2963 |
+ public function addStringEmbeddedImage( |
|
| 2964 |
+ $string, |
|
| 2965 |
+ $cid, |
|
| 2966 |
+ $name = '', |
|
| 2967 |
+ $encoding = 'base64', |
|
| 2968 |
+ $type = '', |
|
| 2969 |
+ $disposition = 'inline' |
|
| 2970 |
+ ) {
|
|
| 2971 |
+ // If a MIME type is not specified, try to work it out from the name |
|
| 2972 |
+ if ($type == '' and !empty($name)) {
|
|
| 2973 |
+ $type = self::filenameToType($name); |
|
| 2974 |
+ } |
|
| 2975 |
+ |
|
| 2976 |
+ // Append to $attachment array |
|
| 2977 |
+ $this->attachment[] = array( |
|
| 2978 |
+ 0 => $string, |
|
| 2979 |
+ 1 => $name, |
|
| 2980 |
+ 2 => $name, |
|
| 2981 |
+ 3 => $encoding, |
|
| 2982 |
+ 4 => $type, |
|
| 2983 |
+ 5 => true, // isStringAttachment |
|
| 2984 |
+ 6 => $disposition, |
|
| 2985 |
+ 7 => $cid |
|
| 2986 |
+ ); |
|
| 2987 |
+ return true; |
|
| 2988 |
+ } |
|
| 2989 |
+ |
|
| 2990 |
+ /** |
|
| 2991 |
+ * Check if an inline attachment is present. |
|
| 2992 |
+ * @access public |
|
| 2993 |
+ * @return boolean |
|
| 2994 |
+ */ |
|
| 2995 |
+ public function inlineImageExists() |
|
| 2996 |
+ {
|
|
| 2997 |
+ foreach ($this->attachment as $attachment) {
|
|
| 2998 |
+ if ($attachment[6] == 'inline') {
|
|
| 2999 |
+ return true; |
|
| 3000 |
+ } |
|
| 3001 |
+ } |
|
| 3002 |
+ return false; |
|
| 3003 |
+ } |
|
| 3004 |
+ |
|
| 3005 |
+ /** |
|
| 3006 |
+ * Check if an attachment (non-inline) is present. |
|
| 3007 |
+ * @return boolean |
|
| 3008 |
+ */ |
|
| 3009 |
+ public function attachmentExists() |
|
| 3010 |
+ {
|
|
| 3011 |
+ foreach ($this->attachment as $attachment) {
|
|
| 3012 |
+ if ($attachment[6] == 'attachment') {
|
|
| 3013 |
+ return true; |
|
| 3014 |
+ } |
|
| 3015 |
+ } |
|
| 3016 |
+ return false; |
|
| 3017 |
+ } |
|
| 3018 |
+ |
|
| 3019 |
+ /** |
|
| 3020 |
+ * Check if this message has an alternative body set. |
|
| 3021 |
+ * @return boolean |
|
| 3022 |
+ */ |
|
| 3023 |
+ public function alternativeExists() |
|
| 3024 |
+ {
|
|
| 3025 |
+ return !empty($this->AltBody); |
|
| 3026 |
+ } |
|
| 3027 |
+ |
|
| 3028 |
+ /** |
|
| 3029 |
+ * Clear queued addresses of given kind. |
|
| 3030 |
+ * @access protected |
|
| 3031 |
+ * @param string $kind 'to', 'cc', or 'bcc' |
|
| 3032 |
+ * @return void |
|
| 3033 |
+ */ |
|
| 3034 |
+ public function clearQueuedAddresses($kind) |
|
| 3035 |
+ {
|
|
| 3036 |
+ $RecipientsQueue = $this->RecipientsQueue; |
|
| 3037 |
+ foreach ($RecipientsQueue as $address => $params) {
|
|
| 3038 |
+ if ($params[0] == $kind) {
|
|
| 3039 |
+ unset($this->RecipientsQueue[$address]); |
|
| 3040 |
+ } |
|
| 3041 |
+ } |
|
| 3042 |
+ } |
|
| 3043 |
+ |
|
| 3044 |
+ /** |
|
| 3045 |
+ * Clear all To recipients. |
|
| 3046 |
+ * @return void |
|
| 3047 |
+ */ |
|
| 3048 |
+ public function clearAddresses() |
|
| 3049 |
+ {
|
|
| 3050 |
+ foreach ($this->to as $to) {
|
|
| 3051 |
+ unset($this->all_recipients[strtolower($to[0])]); |
|
| 3052 |
+ } |
|
| 3053 |
+ $this->to = array(); |
|
| 3054 |
+ $this->clearQueuedAddresses('to');
|
|
| 3055 |
+ } |
|
| 3056 |
+ |
|
| 3057 |
+ /** |
|
| 3058 |
+ * Clear all CC recipients. |
|
| 3059 |
+ * @return void |
|
| 3060 |
+ */ |
|
| 3061 |
+ public function clearCCs() |
|
| 3062 |
+ {
|
|
| 3063 |
+ foreach ($this->cc as $cc) {
|
|
| 3064 |
+ unset($this->all_recipients[strtolower($cc[0])]); |
|
| 3065 |
+ } |
|
| 3066 |
+ $this->cc = array(); |
|
| 3067 |
+ $this->clearQueuedAddresses('cc');
|
|
| 3068 |
+ } |
|
| 3069 |
+ |
|
| 3070 |
+ /** |
|
| 3071 |
+ * Clear all BCC recipients. |
|
| 3072 |
+ * @return void |
|
| 3073 |
+ */ |
|
| 3074 |
+ public function clearBCCs() |
|
| 3075 |
+ {
|
|
| 3076 |
+ foreach ($this->bcc as $bcc) {
|
|
| 3077 |
+ unset($this->all_recipients[strtolower($bcc[0])]); |
|
| 3078 |
+ } |
|
| 3079 |
+ $this->bcc = array(); |
|
| 3080 |
+ $this->clearQueuedAddresses('bcc');
|
|
| 3081 |
+ } |
|
| 3082 |
+ |
|
| 3083 |
+ /** |
|
| 3084 |
+ * Clear all ReplyTo recipients. |
|
| 3085 |
+ * @return void |
|
| 3086 |
+ */ |
|
| 3087 |
+ public function clearReplyTos() |
|
| 3088 |
+ {
|
|
| 3089 |
+ $this->ReplyTo = array(); |
|
| 3090 |
+ $this->ReplyToQueue = array(); |
|
| 3091 |
+ } |
|
| 3092 |
+ |
|
| 3093 |
+ /** |
|
| 3094 |
+ * Clear all recipient types. |
|
| 3095 |
+ * @return void |
|
| 3096 |
+ */ |
|
| 3097 |
+ public function clearAllRecipients() |
|
| 3098 |
+ {
|
|
| 3099 |
+ $this->to = array(); |
|
| 3100 |
+ $this->cc = array(); |
|
| 3101 |
+ $this->bcc = array(); |
|
| 3102 |
+ $this->all_recipients = array(); |
|
| 3103 |
+ $this->RecipientsQueue = array(); |
|
| 3104 |
+ } |
|
| 3105 |
+ |
|
| 3106 |
+ /** |
|
| 3107 |
+ * Clear all filesystem, string, and binary attachments. |
|
| 3108 |
+ * @return void |
|
| 3109 |
+ */ |
|
| 3110 |
+ public function clearAttachments() |
|
| 3111 |
+ {
|
|
| 3112 |
+ $this->attachment = array(); |
|
| 3113 |
+ } |
|
| 3114 |
+ |
|
| 3115 |
+ /** |
|
| 3116 |
+ * Clear all custom headers. |
|
| 3117 |
+ * @return void |
|
| 3118 |
+ */ |
|
| 3119 |
+ public function clearCustomHeaders() |
|
| 3120 |
+ {
|
|
| 3121 |
+ $this->CustomHeader = array(); |
|
| 3122 |
+ } |
|
| 3123 |
+ |
|
| 3124 |
+ /** |
|
| 3125 |
+ * Add an error message to the error container. |
|
| 3126 |
+ * @access protected |
|
| 3127 |
+ * @param string $msg |
|
| 3128 |
+ * @return void |
|
| 3129 |
+ */ |
|
| 3130 |
+ protected function setError($msg) |
|
| 3131 |
+ {
|
|
| 3132 |
+ $this->error_count++; |
|
| 3133 |
+ if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
|
|
| 3134 |
+ $lasterror = $this->smtp->getError(); |
|
| 3135 |
+ if (!empty($lasterror['error'])) {
|
|
| 3136 |
+ $msg .= $this->lang('smtp_error') . $lasterror['error'];
|
|
| 3137 |
+ if (!empty($lasterror['detail'])) {
|
|
| 3138 |
+ $msg .= ' Detail: '. $lasterror['detail']; |
|
| 3139 |
+ } |
|
| 3140 |
+ if (!empty($lasterror['smtp_code'])) {
|
|
| 3141 |
+ $msg .= ' SMTP code: ' . $lasterror['smtp_code']; |
|
| 3142 |
+ } |
|
| 3143 |
+ if (!empty($lasterror['smtp_code_ex'])) {
|
|
| 3144 |
+ $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex']; |
|
| 3145 |
+ } |
|
| 3146 |
+ } |
|
| 3147 |
+ } |
|
| 3148 |
+ $this->ErrorInfo = $msg; |
|
| 3149 |
+ } |
|
| 3150 |
+ |
|
| 3151 |
+ /** |
|
| 3152 |
+ * Return an RFC 822 formatted date. |
|
| 3153 |
+ * @access public |
|
| 3154 |
+ * @return string |
|
| 3155 |
+ * @static |
|
| 3156 |
+ */ |
|
| 3157 |
+ public static function rfcDate() |
|
| 3158 |
+ {
|
|
| 3159 |
+ // Set the time zone to whatever the default is to avoid 500 errors |
|
| 3160 |
+ // Will default to UTC if it's not set properly in php.ini |
|
| 3161 |
+ date_default_timezone_set(@date_default_timezone_get()); |
|
| 3162 |
+ return date('D, j M Y H:i:s O');
|
|
| 3163 |
+ } |
|
| 3164 |
+ |
|
| 3165 |
+ /** |
|
| 3166 |
+ * Get the server hostname. |
|
| 3167 |
+ * Returns 'localhost.localdomain' if unknown. |
|
| 3168 |
+ * @access protected |
|
| 3169 |
+ * @return string |
|
| 3170 |
+ */ |
|
| 3171 |
+ protected function serverHostname() |
|
| 3172 |
+ {
|
|
| 3173 |
+ $result = 'localhost.localdomain'; |
|
| 3174 |
+ if (!empty($this->Hostname)) {
|
|
| 3175 |
+ $result = $this->Hostname; |
|
| 3176 |
+ } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
|
|
| 3177 |
+ $result = $_SERVER['SERVER_NAME']; |
|
| 3178 |
+ } elseif (function_exists('gethostname') && gethostname() !== false) {
|
|
| 3179 |
+ $result = gethostname(); |
|
| 3180 |
+ } elseif (php_uname('n') !== false) {
|
|
| 3181 |
+ $result = php_uname('n');
|
|
| 3182 |
+ } |
|
| 3183 |
+ return $result; |
|
| 3184 |
+ } |
|
| 3185 |
+ |
|
| 3186 |
+ /** |
|
| 3187 |
+ * Get an error message in the current language. |
|
| 3188 |
+ * @access protected |
|
| 3189 |
+ * @param string $key |
|
| 3190 |
+ * @return string |
|
| 3191 |
+ */ |
|
| 3192 |
+ protected function lang($key) |
|
| 3193 |
+ {
|
|
| 3194 |
+ if (count($this->language) < 1) {
|
|
| 3195 |
+ $this->setLanguage('en'); // set the default language
|
|
| 3196 |
+ } |
|
| 3197 |
+ |
|
| 3198 |
+ if (array_key_exists($key, $this->language)) {
|
|
| 3199 |
+ if ($key == 'smtp_connect_failed') {
|
|
| 3200 |
+ //Include a link to troubleshooting docs on SMTP connection failure |
|
| 3201 |
+ //this is by far the biggest cause of support questions |
|
| 3202 |
+ //but it's usually not PHPMailer's fault. |
|
| 3203 |
+ return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; |
|
| 3204 |
+ } |
|
| 3205 |
+ return $this->language[$key]; |
|
| 3206 |
+ } else {
|
|
| 3207 |
+ //Return the key as a fallback |
|
| 3208 |
+ return $key; |
|
| 3209 |
+ } |
|
| 3210 |
+ } |
|
| 3211 |
+ |
|
| 3212 |
+ /** |
|
| 3213 |
+ * Check if an error occurred. |
|
| 3214 |
+ * @access public |
|
| 3215 |
+ * @return boolean True if an error did occur. |
|
| 3216 |
+ */ |
|
| 3217 |
+ public function isError() |
|
| 3218 |
+ {
|
|
| 3219 |
+ return ($this->error_count > 0); |
|
| 3220 |
+ } |
|
| 3221 |
+ |
|
| 3222 |
+ /** |
|
| 3223 |
+ * Ensure consistent line endings in a string. |
|
| 3224 |
+ * Changes every end of line from CRLF, CR or LF to $this->LE. |
|
| 3225 |
+ * @access public |
|
| 3226 |
+ * @param string $str String to fixEOL |
|
| 3227 |
+ * @return string |
|
| 3228 |
+ */ |
|
| 3229 |
+ public function fixEOL($str) |
|
| 3230 |
+ {
|
|
| 3231 |
+ // Normalise to \n |
|
| 3232 |
+ $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
|
|
| 3233 |
+ // Now convert LE as needed |
|
| 3234 |
+ if ($this->LE !== "\n") {
|
|
| 3235 |
+ $nstr = str_replace("\n", $this->LE, $nstr);
|
|
| 3236 |
+ } |
|
| 3237 |
+ return $nstr; |
|
| 3238 |
+ } |
|
| 3239 |
+ |
|
| 3240 |
+ /** |
|
| 3241 |
+ * Add a custom header. |
|
| 3242 |
+ * $name value can be overloaded to contain |
|
| 3243 |
+ * both header name and value (name:value) |
|
| 3244 |
+ * @access public |
|
| 3245 |
+ * @param string $name Custom header name |
|
| 3246 |
+ * @param string $value Header value |
|
| 3247 |
+ * @return void |
|
| 3248 |
+ */ |
|
| 3249 |
+ public function addCustomHeader($name, $value = null) |
|
| 3250 |
+ {
|
|
| 3251 |
+ if ($value === null) {
|
|
| 3252 |
+ // Value passed in as name:value |
|
| 3253 |
+ $this->CustomHeader[] = explode(':', $name, 2);
|
|
| 3254 |
+ } else {
|
|
| 3255 |
+ $this->CustomHeader[] = array($name, $value); |
|
| 3256 |
+ } |
|
| 3257 |
+ } |
|
| 3258 |
+ |
|
| 3259 |
+ /** |
|
| 3260 |
+ * Returns all custom headers. |
|
| 3261 |
+ * @return array |
|
| 3262 |
+ */ |
|
| 3263 |
+ public function getCustomHeaders() |
|
| 3264 |
+ {
|
|
| 3265 |
+ return $this->CustomHeader; |
|
| 3266 |
+ } |
|
| 3267 |
+ |
|
| 3268 |
+ /** |
|
| 3269 |
+ * Create a message from an HTML string. |
|
| 3270 |
+ * Automatically makes modifications for inline images and backgrounds |
|
| 3271 |
+ * and creates a plain-text version by converting the HTML. |
|
| 3272 |
+ * Overwrites any existing values in $this->Body and $this->AltBody |
|
| 3273 |
+ * @access public |
|
| 3274 |
+ * @param string $message HTML message string |
|
| 3275 |
+ * @param string $basedir baseline directory for path |
|
| 3276 |
+ * @param boolean|callable $advanced Whether to use the internal HTML to text converter |
|
| 3277 |
+ * or your own custom converter @see PHPMailer::html2text() |
|
| 3278 |
+ * @return string $message |
|
| 3279 |
+ */ |
|
| 3280 |
+ public function msgHTML($message, $basedir = '', $advanced = false) |
|
| 3281 |
+ {
|
|
| 3282 |
+ preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
|
|
| 3283 |
+ if (array_key_exists(2, $images)) {
|
|
| 3284 |
+ foreach ($images[2] as $imgindex => $url) {
|
|
| 3285 |
+ // Convert data URIs into embedded images |
|
| 3286 |
+ if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
|
|
| 3287 |
+ $data = substr($url, strpos($url, ',')); |
|
| 3288 |
+ if ($match[2]) {
|
|
| 3289 |
+ $data = base64_decode($data); |
|
| 3290 |
+ } else {
|
|
| 3291 |
+ $data = rawurldecode($data); |
|
| 3292 |
+ } |
|
| 3293 |
+ $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 |
|
| 3294 |
+ if ($this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1])) {
|
|
| 3295 |
+ $message = str_replace( |
|
| 3296 |
+ $images[0][$imgindex], |
|
| 3297 |
+ $images[1][$imgindex] . '="cid:' . $cid . '"', |
|
| 3298 |
+ $message |
|
| 3299 |
+ ); |
|
| 3300 |
+ } |
|
| 3301 |
+ } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[a-z][a-z0-9+.-]*://#i', $url)) {
|
|
| 3302 |
+ // Do not change urls for absolute images (thanks to corvuscorax) |
|
| 3303 |
+ // Do not change urls that are already inline images |
|
| 3304 |
+ $filename = basename($url); |
|
| 3305 |
+ $directory = dirname($url); |
|
| 3306 |
+ if ($directory == '.') {
|
|
| 3307 |
+ $directory = ''; |
|
| 3308 |
+ } |
|
| 3309 |
+ $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 |
|
| 3310 |
+ if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
|
|
| 3311 |
+ $basedir .= '/'; |
|
| 3312 |
+ } |
|
| 3313 |
+ if (strlen($directory) > 1 && substr($directory, -1) != '/') {
|
|
| 3314 |
+ $directory .= '/'; |
|
| 3315 |
+ } |
|
| 3316 |
+ if ($this->addEmbeddedImage( |
|
| 3317 |
+ $basedir . $directory . $filename, |
|
| 3318 |
+ $cid, |
|
| 3319 |
+ $filename, |
|
| 3320 |
+ 'base64', |
|
| 3321 |
+ self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION)) |
|
| 3322 |
+ ) |
|
| 3323 |
+ ) {
|
|
| 3324 |
+ $message = preg_replace( |
|
| 3325 |
+ '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', |
|
| 3326 |
+ $images[1][$imgindex] . '="cid:' . $cid . '"', |
|
| 3327 |
+ $message |
|
| 3328 |
+ ); |
|
| 3329 |
+ } |
|
| 3330 |
+ } |
|
| 3331 |
+ } |
|
| 3332 |
+ } |
|
| 3333 |
+ $this->isHTML(true); |
|
| 3334 |
+ // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better |
|
| 3335 |
+ $this->Body = $this->normalizeBreaks($message); |
|
| 3336 |
+ $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced)); |
|
| 3337 |
+ if (!$this->alternativeExists()) {
|
|
| 3338 |
+ $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . |
|
| 3339 |
+ self::CRLF . self::CRLF; |
|
| 3340 |
+ } |
|
| 3341 |
+ return $this->Body; |
|
| 3342 |
+ } |
|
| 3343 |
+ |
|
| 3344 |
+ /** |
|
| 3345 |
+ * Convert an HTML string into plain text. |
|
| 3346 |
+ * This is used by msgHTML(). |
|
| 3347 |
+ * Note - older versions of this function used a bundled advanced converter |
|
| 3348 |
+ * which was been removed for license reasons in #232 |
|
| 3349 |
+ * Example usage: |
|
| 3350 |
+ * <code> |
|
| 3351 |
+ * // Use default conversion |
|
| 3352 |
+ * $plain = $mail->html2text($html); |
|
| 3353 |
+ * // Use your own custom converter |
|
| 3354 |
+ * $plain = $mail->html2text($html, function($html) {
|
|
| 3355 |
+ * $converter = new MyHtml2text($html); |
|
| 3356 |
+ * return $converter->get_text(); |
|
| 3357 |
+ * }); |
|
| 3358 |
+ * </code> |
|
| 3359 |
+ * @param string $html The HTML text to convert |
|
| 3360 |
+ * @param boolean|callable $advanced Any boolean value to use the internal converter, |
|
| 3361 |
+ * or provide your own callable for custom conversion. |
|
| 3362 |
+ * @return string |
|
| 3363 |
+ */ |
|
| 3364 |
+ public function html2text($html, $advanced = false) |
|
| 3365 |
+ {
|
|
| 3366 |
+ if (is_callable($advanced)) {
|
|
| 3367 |
+ return call_user_func($advanced, $html); |
|
| 3368 |
+ } |
|
| 3369 |
+ return html_entity_decode( |
|
| 3370 |
+ trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
|
|
| 3371 |
+ ENT_QUOTES, |
|
| 3372 |
+ $this->CharSet |
|
| 3373 |
+ ); |
|
| 3374 |
+ } |
|
| 3375 |
+ |
|
| 3376 |
+ /** |
|
| 3377 |
+ * Get the MIME type for a file extension. |
|
| 3378 |
+ * @param string $ext File extension |
|
| 3379 |
+ * @access public |
|
| 3380 |
+ * @return string MIME type of file. |
|
| 3381 |
+ * @static |
|
| 3382 |
+ */ |
|
| 3383 |
+ public static function _mime_types($ext = '') |
|
| 3384 |
+ {
|
|
| 3385 |
+ $mimes = array( |
|
| 3386 |
+ 'xl' => 'application/excel', |
|
| 3387 |
+ 'js' => 'application/javascript', |
|
| 3388 |
+ 'hqx' => 'application/mac-binhex40', |
|
| 3389 |
+ 'cpt' => 'application/mac-compactpro', |
|
| 3390 |
+ 'bin' => 'application/macbinary', |
|
| 3391 |
+ 'doc' => 'application/msword', |
|
| 3392 |
+ 'word' => 'application/msword', |
|
| 3393 |
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
|
| 3394 |
+ 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', |
|
| 3395 |
+ 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', |
|
| 3396 |
+ 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', |
|
| 3397 |
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', |
|
| 3398 |
+ 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', |
|
| 3399 |
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
|
| 3400 |
+ 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', |
|
| 3401 |
+ 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', |
|
| 3402 |
+ 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', |
|
| 3403 |
+ 'class' => 'application/octet-stream', |
|
| 3404 |
+ 'dll' => 'application/octet-stream', |
|
| 3405 |
+ 'dms' => 'application/octet-stream', |
|
| 3406 |
+ 'exe' => 'application/octet-stream', |
|
| 3407 |
+ 'lha' => 'application/octet-stream', |
|
| 3408 |
+ 'lzh' => 'application/octet-stream', |
|
| 3409 |
+ 'psd' => 'application/octet-stream', |
|
| 3410 |
+ 'sea' => 'application/octet-stream', |
|
| 3411 |
+ 'so' => 'application/octet-stream', |
|
| 3412 |
+ 'oda' => 'application/oda', |
|
| 3413 |
+ 'pdf' => 'application/pdf', |
|
| 3414 |
+ 'ai' => 'application/postscript', |
|
| 3415 |
+ 'eps' => 'application/postscript', |
|
| 3416 |
+ 'ps' => 'application/postscript', |
|
| 3417 |
+ 'smi' => 'application/smil', |
|
| 3418 |
+ 'smil' => 'application/smil', |
|
| 3419 |
+ 'mif' => 'application/vnd.mif', |
|
| 3420 |
+ 'xls' => 'application/vnd.ms-excel', |
|
| 3421 |
+ 'ppt' => 'application/vnd.ms-powerpoint', |
|
| 3422 |
+ 'wbxml' => 'application/vnd.wap.wbxml', |
|
| 3423 |
+ 'wmlc' => 'application/vnd.wap.wmlc', |
|
| 3424 |
+ 'dcr' => 'application/x-director', |
|
| 3425 |
+ 'dir' => 'application/x-director', |
|
| 3426 |
+ 'dxr' => 'application/x-director', |
|
| 3427 |
+ 'dvi' => 'application/x-dvi', |
|
| 3428 |
+ 'gtar' => 'application/x-gtar', |
|
| 3429 |
+ 'php3' => 'application/x-httpd-php', |
|
| 3430 |
+ 'php4' => 'application/x-httpd-php', |
|
| 3431 |
+ 'php' => 'application/x-httpd-php', |
|
| 3432 |
+ 'phtml' => 'application/x-httpd-php', |
|
| 3433 |
+ 'phps' => 'application/x-httpd-php-source', |
|
| 3434 |
+ 'swf' => 'application/x-shockwave-flash', |
|
| 3435 |
+ 'sit' => 'application/x-stuffit', |
|
| 3436 |
+ 'tar' => 'application/x-tar', |
|
| 3437 |
+ 'tgz' => 'application/x-tar', |
|
| 3438 |
+ 'xht' => 'application/xhtml+xml', |
|
| 3439 |
+ 'xhtml' => 'application/xhtml+xml', |
|
| 3440 |
+ 'zip' => 'application/zip', |
|
| 3441 |
+ 'mid' => 'audio/midi', |
|
| 3442 |
+ 'midi' => 'audio/midi', |
|
| 3443 |
+ 'mp2' => 'audio/mpeg', |
|
| 3444 |
+ 'mp3' => 'audio/mpeg', |
|
| 3445 |
+ 'mpga' => 'audio/mpeg', |
|
| 3446 |
+ 'aif' => 'audio/x-aiff', |
|
| 3447 |
+ 'aifc' => 'audio/x-aiff', |
|
| 3448 |
+ 'aiff' => 'audio/x-aiff', |
|
| 3449 |
+ 'ram' => 'audio/x-pn-realaudio', |
|
| 3450 |
+ 'rm' => 'audio/x-pn-realaudio', |
|
| 3451 |
+ 'rpm' => 'audio/x-pn-realaudio-plugin', |
|
| 3452 |
+ 'ra' => 'audio/x-realaudio', |
|
| 3453 |
+ 'wav' => 'audio/x-wav', |
|
| 3454 |
+ 'bmp' => 'image/bmp', |
|
| 3455 |
+ 'gif' => 'image/gif', |
|
| 3456 |
+ 'jpeg' => 'image/jpeg', |
|
| 3457 |
+ 'jpe' => 'image/jpeg', |
|
| 3458 |
+ 'jpg' => 'image/jpeg', |
|
| 3459 |
+ 'png' => 'image/png', |
|
| 3460 |
+ 'tiff' => 'image/tiff', |
|
| 3461 |
+ 'tif' => 'image/tiff', |
|
| 3462 |
+ 'eml' => 'message/rfc822', |
|
| 3463 |
+ 'css' => 'text/css', |
|
| 3464 |
+ 'html' => 'text/html', |
|
| 3465 |
+ 'htm' => 'text/html', |
|
| 3466 |
+ 'shtml' => 'text/html', |
|
| 3467 |
+ 'log' => 'text/plain', |
|
| 3468 |
+ 'text' => 'text/plain', |
|
| 3469 |
+ 'txt' => 'text/plain', |
|
| 3470 |
+ 'rtx' => 'text/richtext', |
|
| 3471 |
+ 'rtf' => 'text/rtf', |
|
| 3472 |
+ 'vcf' => 'text/vcard', |
|
| 3473 |
+ 'vcard' => 'text/vcard', |
|
| 3474 |
+ 'xml' => 'text/xml', |
|
| 3475 |
+ 'xsl' => 'text/xml', |
|
| 3476 |
+ 'mpeg' => 'video/mpeg', |
|
| 3477 |
+ 'mpe' => 'video/mpeg', |
|
| 3478 |
+ 'mpg' => 'video/mpeg', |
|
| 3479 |
+ 'mov' => 'video/quicktime', |
|
| 3480 |
+ 'qt' => 'video/quicktime', |
|
| 3481 |
+ 'rv' => 'video/vnd.rn-realvideo', |
|
| 3482 |
+ 'avi' => 'video/x-msvideo', |
|
| 3483 |
+ 'movie' => 'video/x-sgi-movie' |
|
| 3484 |
+ ); |
|
| 3485 |
+ if (array_key_exists(strtolower($ext), $mimes)) {
|
|
| 3486 |
+ return $mimes[strtolower($ext)]; |
|
| 3487 |
+ } |
|
| 3488 |
+ return 'application/octet-stream'; |
|
| 3489 |
+ } |
|
| 3490 |
+ |
|
| 3491 |
+ /** |
|
| 3492 |
+ * Map a file name to a MIME type. |
|
| 3493 |
+ * Defaults to 'application/octet-stream', i.e.. arbitrary binary data. |
|
| 3494 |
+ * @param string $filename A file name or full path, does not need to exist as a file |
|
| 3495 |
+ * @return string |
|
| 3496 |
+ * @static |
|
| 3497 |
+ */ |
|
| 3498 |
+ public static function filenameToType($filename) |
|
| 3499 |
+ {
|
|
| 3500 |
+ // In case the path is a URL, strip any query string before getting extension |
|
| 3501 |
+ $qpos = strpos($filename, '?'); |
|
| 3502 |
+ if (false !== $qpos) {
|
|
| 3503 |
+ $filename = substr($filename, 0, $qpos); |
|
| 3504 |
+ } |
|
| 3505 |
+ $pathinfo = self::mb_pathinfo($filename); |
|
| 3506 |
+ return self::_mime_types($pathinfo['extension']); |
|
| 3507 |
+ } |
|
| 3508 |
+ |
|
| 3509 |
+ /** |
|
| 3510 |
+ * Multi-byte-safe pathinfo replacement. |
|
| 3511 |
+ * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. |
|
| 3512 |
+ * Works similarly to the one in PHP >= 5.2.0 |
|
| 3513 |
+ * @link http://www.php.net/manual/en/function.pathinfo.php#107461 |
|
| 3514 |
+ * @param string $path A filename or path, does not need to exist as a file |
|
| 3515 |
+ * @param integer|string $options Either a PATHINFO_* constant, |
|
| 3516 |
+ * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2 |
|
| 3517 |
+ * @return string|array |
|
| 3518 |
+ * @static |
|
| 3519 |
+ */ |
|
| 3520 |
+ public static function mb_pathinfo($path, $options = null) |
|
| 3521 |
+ {
|
|
| 3522 |
+ $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
|
|
| 3523 |
+ $pathinfo = array(); |
|
| 3524 |
+ if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
|
|
| 3525 |
+ if (array_key_exists(1, $pathinfo)) {
|
|
| 3526 |
+ $ret['dirname'] = $pathinfo[1]; |
|
| 3527 |
+ } |
|
| 3528 |
+ if (array_key_exists(2, $pathinfo)) {
|
|
| 3529 |
+ $ret['basename'] = $pathinfo[2]; |
|
| 3530 |
+ } |
|
| 3531 |
+ if (array_key_exists(5, $pathinfo)) {
|
|
| 3532 |
+ $ret['extension'] = $pathinfo[5]; |
|
| 3533 |
+ } |
|
| 3534 |
+ if (array_key_exists(3, $pathinfo)) {
|
|
| 3535 |
+ $ret['filename'] = $pathinfo[3]; |
|
| 3536 |
+ } |
|
| 3537 |
+ } |
|
| 3538 |
+ switch ($options) {
|
|
| 3539 |
+ case PATHINFO_DIRNAME: |
|
| 3540 |
+ case 'dirname': |
|
| 3541 |
+ return $ret['dirname']; |
|
| 3542 |
+ case PATHINFO_BASENAME: |
|
| 3543 |
+ case 'basename': |
|
| 3544 |
+ return $ret['basename']; |
|
| 3545 |
+ case PATHINFO_EXTENSION: |
|
| 3546 |
+ case 'extension': |
|
| 3547 |
+ return $ret['extension']; |
|
| 3548 |
+ case PATHINFO_FILENAME: |
|
| 3549 |
+ case 'filename': |
|
| 3550 |
+ return $ret['filename']; |
|
| 3551 |
+ default: |
|
| 3552 |
+ return $ret; |
|
| 3553 |
+ } |
|
| 3554 |
+ } |
|
| 3555 |
+ |
|
| 3556 |
+ /** |
|
| 3557 |
+ * Set or reset instance properties. |
|
| 3558 |
+ * You should avoid this function - it's more verbose, less efficient, more error-prone and |
|
| 3559 |
+ * harder to debug than setting properties directly. |
|
| 3560 |
+ * Usage Example: |
|
| 3561 |
+ * `$mail->set('SMTPSecure', 'tls');`
|
|
| 3562 |
+ * is the same as: |
|
| 3563 |
+ * `$mail->SMTPSecure = 'tls';` |
|
| 3564 |
+ * @access public |
|
| 3565 |
+ * @param string $name The property name to set |
|
| 3566 |
+ * @param mixed $value The value to set the property to |
|
| 3567 |
+ * @return boolean |
|
| 3568 |
+ * @TODO Should this not be using the __set() magic function? |
|
| 3569 |
+ */ |
|
| 3570 |
+ public function set($name, $value = '') |
|
| 3571 |
+ {
|
|
| 3572 |
+ if (property_exists($this, $name)) {
|
|
| 3573 |
+ $this->$name = $value; |
|
| 3574 |
+ return true; |
|
| 3575 |
+ } else {
|
|
| 3576 |
+ $this->setError($this->lang('variable_set') . $name);
|
|
| 3577 |
+ return false; |
|
| 3578 |
+ } |
|
| 3579 |
+ } |
|
| 3580 |
+ |
|
| 3581 |
+ /** |
|
| 3582 |
+ * Strip newlines to prevent header injection. |
|
| 3583 |
+ * @access public |
|
| 3584 |
+ * @param string $str |
|
| 3585 |
+ * @return string |
|
| 3586 |
+ */ |
|
| 3587 |
+ public function secureHeader($str) |
|
| 3588 |
+ {
|
|
| 3589 |
+ return trim(str_replace(array("\r", "\n"), '', $str));
|
|
| 3590 |
+ } |
|
| 3591 |
+ |
|
| 3592 |
+ /** |
|
| 3593 |
+ * Normalize line breaks in a string. |
|
| 3594 |
+ * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. |
|
| 3595 |
+ * Defaults to CRLF (for message bodies) and preserves consecutive breaks. |
|
| 3596 |
+ * @param string $text |
|
| 3597 |
+ * @param string $breaktype What kind of line break to use, defaults to CRLF |
|
| 3598 |
+ * @return string |
|
| 3599 |
+ * @access public |
|
| 3600 |
+ * @static |
|
| 3601 |
+ */ |
|
| 3602 |
+ public static function normalizeBreaks($text, $breaktype = "\r\n") |
|
| 3603 |
+ {
|
|
| 3604 |
+ return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
|
|
| 3605 |
+ } |
|
| 3606 |
+ |
|
| 3607 |
+ /** |
|
| 3608 |
+ * Set the public and private key files and password for S/MIME signing. |
|
| 3609 |
+ * @access public |
|
| 3610 |
+ * @param string $cert_filename |
|
| 3611 |
+ * @param string $key_filename |
|
| 3612 |
+ * @param string $key_pass Password for private key |
|
| 3613 |
+ * @param string $extracerts_filename Optional path to chain certificate |
|
| 3614 |
+ */ |
|
| 3615 |
+ public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '') |
|
| 3616 |
+ {
|
|
| 3617 |
+ $this->sign_cert_file = $cert_filename; |
|
| 3618 |
+ $this->sign_key_file = $key_filename; |
|
| 3619 |
+ $this->sign_key_pass = $key_pass; |
|
| 3620 |
+ $this->sign_extracerts_file = $extracerts_filename; |
|
| 3621 |
+ } |
|
| 3622 |
+ |
|
| 3623 |
+ /** |
|
| 3624 |
+ * Quoted-Printable-encode a DKIM header. |
|
| 3625 |
+ * @access public |
|
| 3626 |
+ * @param string $txt |
|
| 3627 |
+ * @return string |
|
| 3628 |
+ */ |
|
| 3629 |
+ public function DKIM_QP($txt) |
|
| 3630 |
+ {
|
|
| 3631 |
+ $line = ''; |
|
| 3632 |
+ for ($i = 0; $i < strlen($txt); $i++) {
|
|
| 3633 |
+ $ord = ord($txt[$i]); |
|
| 3634 |
+ if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
|
|
| 3635 |
+ $line .= $txt[$i]; |
|
| 3636 |
+ } else {
|
|
| 3637 |
+ $line .= '=' . sprintf('%02X', $ord);
|
|
| 3638 |
+ } |
|
| 3639 |
+ } |
|
| 3640 |
+ return $line; |
|
| 3641 |
+ } |
|
| 3642 |
+ |
|
| 3643 |
+ /** |
|
| 3644 |
+ * Generate a DKIM signature. |
|
| 3645 |
+ * @access public |
|
| 3646 |
+ * @param string $signHeader |
|
| 3647 |
+ * @throws phpmailerException |
|
| 3648 |
+ * @return string |
|
| 3649 |
+ */ |
|
| 3650 |
+ public function DKIM_Sign($signHeader) |
|
| 3651 |
+ {
|
|
| 3652 |
+ if (!defined('PKCS7_TEXT')) {
|
|
| 3653 |
+ if ($this->exceptions) {
|
|
| 3654 |
+ throw new phpmailerException($this->lang('extension_missing') . 'openssl');
|
|
| 3655 |
+ } |
|
| 3656 |
+ return ''; |
|
| 3657 |
+ } |
|
| 3658 |
+ $privKeyStr = file_get_contents($this->DKIM_private); |
|
| 3659 |
+ if ($this->DKIM_passphrase != '') {
|
|
| 3660 |
+ $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); |
|
| 3661 |
+ } else {
|
|
| 3662 |
+ $privKey = openssl_pkey_get_private($privKeyStr); |
|
| 3663 |
+ } |
|
| 3664 |
+ if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) { //sha1WithRSAEncryption
|
|
| 3665 |
+ openssl_pkey_free($privKey); |
|
| 3666 |
+ return base64_encode($signature); |
|
| 3667 |
+ } |
|
| 3668 |
+ openssl_pkey_free($privKey); |
|
| 3669 |
+ return ''; |
|
| 3670 |
+ } |
|
| 3671 |
+ |
|
| 3672 |
+ /** |
|
| 3673 |
+ * Generate a DKIM canonicalization header. |
|
| 3674 |
+ * @access public |
|
| 3675 |
+ * @param string $signHeader Header |
|
| 3676 |
+ * @return string |
|
| 3677 |
+ */ |
|
| 3678 |
+ public function DKIM_HeaderC($signHeader) |
|
| 3679 |
+ {
|
|
| 3680 |
+ $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
|
|
| 3681 |
+ $lines = explode("\r\n", $signHeader);
|
|
| 3682 |
+ foreach ($lines as $key => $line) {
|
|
| 3683 |
+ list($heading, $value) = explode(':', $line, 2);
|
|
| 3684 |
+ $heading = strtolower($heading); |
|
| 3685 |
+ $value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces
|
|
| 3686 |
+ $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value |
|
| 3687 |
+ } |
|
| 3688 |
+ $signHeader = implode("\r\n", $lines);
|
|
| 3689 |
+ return $signHeader; |
|
| 3690 |
+ } |
|
| 3691 |
+ |
|
| 3692 |
+ /** |
|
| 3693 |
+ * Generate a DKIM canonicalization body. |
|
| 3694 |
+ * @access public |
|
| 3695 |
+ * @param string $body Message Body |
|
| 3696 |
+ * @return string |
|
| 3697 |
+ */ |
|
| 3698 |
+ public function DKIM_BodyC($body) |
|
| 3699 |
+ {
|
|
| 3700 |
+ if ($body == '') {
|
|
| 3701 |
+ return "\r\n"; |
|
| 3702 |
+ } |
|
| 3703 |
+ // stabilize line endings |
|
| 3704 |
+ $body = str_replace("\r\n", "\n", $body);
|
|
| 3705 |
+ $body = str_replace("\n", "\r\n", $body);
|
|
| 3706 |
+ // END stabilize line endings |
|
| 3707 |
+ while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
|
|
| 3708 |
+ $body = substr($body, 0, strlen($body) - 2); |
|
| 3709 |
+ } |
|
| 3710 |
+ return $body; |
|
| 3711 |
+ } |
|
| 3712 |
+ |
|
| 3713 |
+ /** |
|
| 3714 |
+ * Create the DKIM header and body in a new message header. |
|
| 3715 |
+ * @access public |
|
| 3716 |
+ * @param string $headers_line Header lines |
|
| 3717 |
+ * @param string $subject Subject |
|
| 3718 |
+ * @param string $body Body |
|
| 3719 |
+ * @return string |
|
| 3720 |
+ */ |
|
| 3721 |
+ public function DKIM_Add($headers_line, $subject, $body) |
|
| 3722 |
+ {
|
|
| 3723 |
+ $DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms |
|
| 3724 |
+ $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body |
|
| 3725 |
+ $DKIMquery = 'dns/txt'; // Query method |
|
| 3726 |
+ $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) |
|
| 3727 |
+ $subject_header = "Subject: $subject"; |
|
| 3728 |
+ $headers = explode($this->LE, $headers_line); |
|
| 3729 |
+ $from_header = ''; |
|
| 3730 |
+ $to_header = ''; |
|
| 3731 |
+ $date_header = ''; |
|
| 3732 |
+ $current = ''; |
|
| 3733 |
+ foreach ($headers as $header) {
|
|
| 3734 |
+ if (strpos($header, 'From:') === 0) {
|
|
| 3735 |
+ $from_header = $header; |
|
| 3736 |
+ $current = 'from_header'; |
|
| 3737 |
+ } elseif (strpos($header, 'To:') === 0) {
|
|
| 3738 |
+ $to_header = $header; |
|
| 3739 |
+ $current = 'to_header'; |
|
| 3740 |
+ } elseif (strpos($header, 'Date:') === 0) {
|
|
| 3741 |
+ $date_header = $header; |
|
| 3742 |
+ $current = 'date_header'; |
|
| 3743 |
+ } else {
|
|
| 3744 |
+ if (!empty($$current) && strpos($header, ' =?') === 0) {
|
|
| 3745 |
+ $$current .= $header; |
|
| 3746 |
+ } else {
|
|
| 3747 |
+ $current = ''; |
|
| 3748 |
+ } |
|
| 3749 |
+ } |
|
| 3750 |
+ } |
|
| 3751 |
+ $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
|
|
| 3752 |
+ $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
|
|
| 3753 |
+ $date = str_replace('|', '=7C', $this->DKIM_QP($date_header));
|
|
| 3754 |
+ $subject = str_replace( |
|
| 3755 |
+ '|', |
|
| 3756 |
+ '=7C', |
|
| 3757 |
+ $this->DKIM_QP($subject_header) |
|
| 3758 |
+ ); // Copied header fields (dkim-quoted-printable) |
|
| 3759 |
+ $body = $this->DKIM_BodyC($body); |
|
| 3760 |
+ $DKIMlen = strlen($body); // Length of body |
|
| 3761 |
+ $DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body
|
|
| 3762 |
+ if ('' == $this->DKIM_identity) {
|
|
| 3763 |
+ $ident = ''; |
|
| 3764 |
+ } else {
|
|
| 3765 |
+ $ident = ' i=' . $this->DKIM_identity . ';'; |
|
| 3766 |
+ } |
|
| 3767 |
+ $dkimhdrs = 'DKIM-Signature: v=1; a=' . |
|
| 3768 |
+ $DKIMsignatureType . '; q=' . |
|
| 3769 |
+ $DKIMquery . '; l=' . |
|
| 3770 |
+ $DKIMlen . '; s=' . |
|
| 3771 |
+ $this->DKIM_selector . |
|
| 3772 |
+ ";\r\n" . |
|
| 3773 |
+ "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . |
|
| 3774 |
+ "\th=From:To:Date:Subject;\r\n" . |
|
| 3775 |
+ "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . |
|
| 3776 |
+ "\tz=$from\r\n" . |
|
| 3777 |
+ "\t|$to\r\n" . |
|
| 3778 |
+ "\t|$date\r\n" . |
|
| 3779 |
+ "\t|$subject;\r\n" . |
|
| 3780 |
+ "\tbh=" . $DKIMb64 . ";\r\n" . |
|
| 3781 |
+ "\tb="; |
|
| 3782 |
+ $toSign = $this->DKIM_HeaderC( |
|
| 3783 |
+ $from_header . "\r\n" . |
|
| 3784 |
+ $to_header . "\r\n" . |
|
| 3785 |
+ $date_header . "\r\n" . |
|
| 3786 |
+ $subject_header . "\r\n" . |
|
| 3787 |
+ $dkimhdrs |
|
| 3788 |
+ ); |
|
| 3789 |
+ $signed = $this->DKIM_Sign($toSign); |
|
| 3790 |
+ return $dkimhdrs . $signed . "\r\n"; |
|
| 3791 |
+ } |
|
| 3792 |
+ |
|
| 3793 |
+ /** |
|
| 3794 |
+ * Detect if a string contains a line longer than the maximum line length allowed. |
|
| 3795 |
+ * @param string $str |
|
| 3796 |
+ * @return boolean |
|
| 3797 |
+ * @static |
|
| 3798 |
+ */ |
|
| 3799 |
+ public static function hasLineLongerThanMax($str) |
|
| 3800 |
+ {
|
|
| 3801 |
+ //+2 to include CRLF line break for a 1000 total |
|
| 3802 |
+ return (boolean)preg_match('/^(.{'.(self::MAX_LINE_LENGTH + 2).',})/m', $str);
|
|
| 3803 |
+ } |
|
| 3804 |
+ |
|
| 3805 |
+ /** |
|
| 3806 |
+ * Allows for public read access to 'to' property. |
|
| 3807 |
+ * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. |
|
| 3808 |
+ * @access public |
|
| 3809 |
+ * @return array |
|
| 3810 |
+ */ |
|
| 3811 |
+ public function getToAddresses() |
|
| 3812 |
+ {
|
|
| 3813 |
+ return $this->to; |
|
| 3814 |
+ } |
|
| 3815 |
+ |
|
| 3816 |
+ /** |
|
| 3817 |
+ * Allows for public read access to 'cc' property. |
|
| 3818 |
+ * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. |
|
| 3819 |
+ * @access public |
|
| 3820 |
+ * @return array |
|
| 3821 |
+ */ |
|
| 3822 |
+ public function getCcAddresses() |
|
| 3823 |
+ {
|
|
| 3824 |
+ return $this->cc; |
|
| 3825 |
+ } |
|
| 3826 |
+ |
|
| 3827 |
+ /** |
|
| 3828 |
+ * Allows for public read access to 'bcc' property. |
|
| 3829 |
+ * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. |
|
| 3830 |
+ * @access public |
|
| 3831 |
+ * @return array |
|
| 3832 |
+ */ |
|
| 3833 |
+ public function getBccAddresses() |
|
| 3834 |
+ {
|
|
| 3835 |
+ return $this->bcc; |
|
| 3836 |
+ } |
|
| 3837 |
+ |
|
| 3838 |
+ /** |
|
| 3839 |
+ * Allows for public read access to 'ReplyTo' property. |
|
| 3840 |
+ * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. |
|
| 3841 |
+ * @access public |
|
| 3842 |
+ * @return array |
|
| 3843 |
+ */ |
|
| 3844 |
+ public function getReplyToAddresses() |
|
| 3845 |
+ {
|
|
| 3846 |
+ return $this->ReplyTo; |
|
| 3847 |
+ } |
|
| 3848 |
+ |
|
| 3849 |
+ /** |
|
| 3850 |
+ * Allows for public read access to 'all_recipients' property. |
|
| 3851 |
+ * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. |
|
| 3852 |
+ * @access public |
|
| 3853 |
+ * @return array |
|
| 3854 |
+ */ |
|
| 3855 |
+ public function getAllRecipientAddresses() |
|
| 3856 |
+ {
|
|
| 3857 |
+ return $this->all_recipients; |
|
| 3858 |
+ } |
|
| 3859 |
+ |
|
| 3860 |
+ /** |
|
| 3861 |
+ * Perform a callback. |
|
| 3862 |
+ * @param boolean $isSent |
|
| 3863 |
+ * @param array $to |
|
| 3864 |
+ * @param array $cc |
|
| 3865 |
+ * @param array $bcc |
|
| 3866 |
+ * @param string $subject |
|
| 3867 |
+ * @param string $body |
|
| 3868 |
+ * @param string $from |
|
| 3869 |
+ */ |
|
| 3870 |
+ protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from) |
|
| 3871 |
+ {
|
|
| 3872 |
+ if (!empty($this->action_function) && is_callable($this->action_function)) {
|
|
| 3873 |
+ $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from); |
|
| 3874 |
+ call_user_func_array($this->action_function, $params); |
|
| 3875 |
+ } |
|
| 3876 |
+ } |
|
| 3877 |
+} |
|
| 3878 |
+ |
|
| 3879 |
+/** |
|
| 3880 |
+ * PHPMailer exception handler |
|
| 3881 |
+ * @package PHPMailer |
|
| 3882 |
+ */ |
|
| 3883 |
+class phpmailerException extends Exception |
|
| 3884 |
+{
|
|
| 3885 |
+ /** |
|
| 3886 |
+ * Prettify error message output |
|
| 3887 |
+ * @return string |
|
| 3888 |
+ */ |
|
| 3889 |
+ public function errorMessage() |
|
| 3890 |
+ {
|
|
| 3891 |
+ $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n"; |
|
| 3892 |
+ return $errorMsg; |
|
| 3893 |
+ } |
|
| 3894 |
+} |
| 0 | 3895 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,1192 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * PHPMailer RFC821 SMTP email transport class. |
|
| 4 |
+ * PHP Version 5 |
|
| 5 |
+ * @package PHPMailer |
|
| 6 |
+ * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project |
|
| 7 |
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> |
|
| 8 |
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com> |
|
| 9 |
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> |
|
| 10 |
+ * @author Brent R. Matzelle (original founder) |
|
| 11 |
+ * @copyright 2014 Marcus Bointon |
|
| 12 |
+ * @copyright 2010 - 2012 Jim Jagielski |
|
| 13 |
+ * @copyright 2004 - 2009 Andy Prevost |
|
| 14 |
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
|
| 15 |
+ * @note This program is distributed in the hope that it will be useful - WITHOUT |
|
| 16 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
| 17 |
+ * FITNESS FOR A PARTICULAR PURPOSE. |
|
| 18 |
+ */ |
|
| 19 |
+ |
|
| 20 |
+/** |
|
| 21 |
+ * PHPMailer RFC821 SMTP email transport class. |
|
| 22 |
+ * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server. |
|
| 23 |
+ * @package PHPMailer |
|
| 24 |
+ * @author Chris Ryan |
|
| 25 |
+ * @author Marcus Bointon <phpmailer@synchromedia.co.uk> |
|
| 26 |
+ */ |
|
| 27 |
+class SMTP |
|
| 28 |
+{
|
|
| 29 |
+ /** |
|
| 30 |
+ * The PHPMailer SMTP version number. |
|
| 31 |
+ * @var string |
|
| 32 |
+ */ |
|
| 33 |
+ const VERSION = '5.2.14'; |
|
| 34 |
+ |
|
| 35 |
+ /** |
|
| 36 |
+ * SMTP line break constant. |
|
| 37 |
+ * @var string |
|
| 38 |
+ */ |
|
| 39 |
+ const CRLF = "\r\n"; |
|
| 40 |
+ |
|
| 41 |
+ /** |
|
| 42 |
+ * The SMTP port to use if one is not specified. |
|
| 43 |
+ * @var integer |
|
| 44 |
+ */ |
|
| 45 |
+ const DEFAULT_SMTP_PORT = 25; |
|
| 46 |
+ |
|
| 47 |
+ /** |
|
| 48 |
+ * The maximum line length allowed by RFC 2822 section 2.1.1 |
|
| 49 |
+ * @var integer |
|
| 50 |
+ */ |
|
| 51 |
+ const MAX_LINE_LENGTH = 998; |
|
| 52 |
+ |
|
| 53 |
+ /** |
|
| 54 |
+ * Debug level for no output |
|
| 55 |
+ */ |
|
| 56 |
+ const DEBUG_OFF = 0; |
|
| 57 |
+ |
|
| 58 |
+ /** |
|
| 59 |
+ * Debug level to show client -> server messages |
|
| 60 |
+ */ |
|
| 61 |
+ const DEBUG_CLIENT = 1; |
|
| 62 |
+ |
|
| 63 |
+ /** |
|
| 64 |
+ * Debug level to show client -> server and server -> client messages |
|
| 65 |
+ */ |
|
| 66 |
+ const DEBUG_SERVER = 2; |
|
| 67 |
+ |
|
| 68 |
+ /** |
|
| 69 |
+ * Debug level to show connection status, client -> server and server -> client messages |
|
| 70 |
+ */ |
|
| 71 |
+ const DEBUG_CONNECTION = 3; |
|
| 72 |
+ |
|
| 73 |
+ /** |
|
| 74 |
+ * Debug level to show all messages |
|
| 75 |
+ */ |
|
| 76 |
+ const DEBUG_LOWLEVEL = 4; |
|
| 77 |
+ |
|
| 78 |
+ /** |
|
| 79 |
+ * The PHPMailer SMTP Version number. |
|
| 80 |
+ * @var string |
|
| 81 |
+ * @deprecated Use the `VERSION` constant instead |
|
| 82 |
+ * @see SMTP::VERSION |
|
| 83 |
+ */ |
|
| 84 |
+ public $Version = '5.2.14'; |
|
| 85 |
+ |
|
| 86 |
+ /** |
|
| 87 |
+ * SMTP server port number. |
|
| 88 |
+ * @var integer |
|
| 89 |
+ * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead |
|
| 90 |
+ * @see SMTP::DEFAULT_SMTP_PORT |
|
| 91 |
+ */ |
|
| 92 |
+ public $SMTP_PORT = 25; |
|
| 93 |
+ |
|
| 94 |
+ /** |
|
| 95 |
+ * SMTP reply line ending. |
|
| 96 |
+ * @var string |
|
| 97 |
+ * @deprecated Use the `CRLF` constant instead |
|
| 98 |
+ * @see SMTP::CRLF |
|
| 99 |
+ */ |
|
| 100 |
+ public $CRLF = "\r\n"; |
|
| 101 |
+ |
|
| 102 |
+ /** |
|
| 103 |
+ * Debug output level. |
|
| 104 |
+ * Options: |
|
| 105 |
+ * * self::DEBUG_OFF (`0`) No debug output, default |
|
| 106 |
+ * * self::DEBUG_CLIENT (`1`) Client commands |
|
| 107 |
+ * * self::DEBUG_SERVER (`2`) Client commands and server responses |
|
| 108 |
+ * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status |
|
| 109 |
+ * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages |
|
| 110 |
+ * @var integer |
|
| 111 |
+ */ |
|
| 112 |
+ public $do_debug = self::DEBUG_OFF; |
|
| 113 |
+ |
|
| 114 |
+ /** |
|
| 115 |
+ * How to handle debug output. |
|
| 116 |
+ * Options: |
|
| 117 |
+ * * `echo` Output plain-text as-is, appropriate for CLI |
|
| 118 |
+ * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output |
|
| 119 |
+ * * `error_log` Output to error log as configured in php.ini |
|
| 120 |
+ * |
|
| 121 |
+ * Alternatively, you can provide a callable expecting two params: a message string and the debug level: |
|
| 122 |
+ * <code> |
|
| 123 |
+ * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
|
|
| 124 |
+ * </code> |
|
| 125 |
+ * @var string|callable |
|
| 126 |
+ */ |
|
| 127 |
+ public $Debugoutput = 'echo'; |
|
| 128 |
+ |
|
| 129 |
+ /** |
|
| 130 |
+ * Whether to use VERP. |
|
| 131 |
+ * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path |
|
| 132 |
+ * @link http://www.postfix.org/VERP_README.html Info on VERP |
|
| 133 |
+ * @var boolean |
|
| 134 |
+ */ |
|
| 135 |
+ public $do_verp = false; |
|
| 136 |
+ |
|
| 137 |
+ /** |
|
| 138 |
+ * The timeout value for connection, in seconds. |
|
| 139 |
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 |
|
| 140 |
+ * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure. |
|
| 141 |
+ * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2 |
|
| 142 |
+ * @var integer |
|
| 143 |
+ */ |
|
| 144 |
+ public $Timeout = 300; |
|
| 145 |
+ |
|
| 146 |
+ /** |
|
| 147 |
+ * How long to wait for commands to complete, in seconds. |
|
| 148 |
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 |
|
| 149 |
+ * @var integer |
|
| 150 |
+ */ |
|
| 151 |
+ public $Timelimit = 300; |
|
| 152 |
+ |
|
| 153 |
+ /** |
|
| 154 |
+ * The socket for the server connection. |
|
| 155 |
+ * @var resource |
|
| 156 |
+ */ |
|
| 157 |
+ protected $smtp_conn; |
|
| 158 |
+ |
|
| 159 |
+ /** |
|
| 160 |
+ * Error information, if any, for the last SMTP command. |
|
| 161 |
+ * @var array |
|
| 162 |
+ */ |
|
| 163 |
+ protected $error = array( |
|
| 164 |
+ 'error' => '', |
|
| 165 |
+ 'detail' => '', |
|
| 166 |
+ 'smtp_code' => '', |
|
| 167 |
+ 'smtp_code_ex' => '' |
|
| 168 |
+ ); |
|
| 169 |
+ |
|
| 170 |
+ /** |
|
| 171 |
+ * The reply the server sent to us for HELO. |
|
| 172 |
+ * If null, no HELO string has yet been received. |
|
| 173 |
+ * @var string|null |
|
| 174 |
+ */ |
|
| 175 |
+ protected $helo_rply = null; |
|
| 176 |
+ |
|
| 177 |
+ /** |
|
| 178 |
+ * The set of SMTP extensions sent in reply to EHLO command. |
|
| 179 |
+ * Indexes of the array are extension names. |
|
| 180 |
+ * Value at index 'HELO' or 'EHLO' (according to command that was sent) |
|
| 181 |
+ * represents the server name. In case of HELO it is the only element of the array. |
|
| 182 |
+ * Other values can be boolean TRUE or an array containing extension options. |
|
| 183 |
+ * If null, no HELO/EHLO string has yet been received. |
|
| 184 |
+ * @var array|null |
|
| 185 |
+ */ |
|
| 186 |
+ protected $server_caps = null; |
|
| 187 |
+ |
|
| 188 |
+ /** |
|
| 189 |
+ * The most recent reply received from the server. |
|
| 190 |
+ * @var string |
|
| 191 |
+ */ |
|
| 192 |
+ protected $last_reply = ''; |
|
| 193 |
+ |
|
| 194 |
+ /** |
|
| 195 |
+ * Output debugging info via a user-selected method. |
|
| 196 |
+ * @see SMTP::$Debugoutput |
|
| 197 |
+ * @see SMTP::$do_debug |
|
| 198 |
+ * @param string $str Debug string to output |
|
| 199 |
+ * @param integer $level The debug level of this message; see DEBUG_* constants |
|
| 200 |
+ * @return void |
|
| 201 |
+ */ |
|
| 202 |
+ protected function edebug($str, $level = 0) |
|
| 203 |
+ {
|
|
| 204 |
+ if ($level > $this->do_debug) {
|
|
| 205 |
+ return; |
|
| 206 |
+ } |
|
| 207 |
+ //Avoid clash with built-in function names |
|
| 208 |
+ if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
|
|
| 209 |
+ call_user_func($this->Debugoutput, $str, $this->do_debug); |
|
| 210 |
+ return; |
|
| 211 |
+ } |
|
| 212 |
+ switch ($this->Debugoutput) {
|
|
| 213 |
+ case 'error_log': |
|
| 214 |
+ //Don't output, just log |
|
| 215 |
+ error_log($str); |
|
| 216 |
+ break; |
|
| 217 |
+ case 'html': |
|
| 218 |
+ //Cleans up output a bit for a better looking, HTML-safe output |
|
| 219 |
+ echo htmlentities( |
|
| 220 |
+ preg_replace('/[\r\n]+/', '', $str),
|
|
| 221 |
+ ENT_QUOTES, |
|
| 222 |
+ 'UTF-8' |
|
| 223 |
+ ) |
|
| 224 |
+ . "<br>\n"; |
|
| 225 |
+ break; |
|
| 226 |
+ case 'echo': |
|
| 227 |
+ default: |
|
| 228 |
+ //Normalize line breaks |
|
| 229 |
+ $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
|
|
| 230 |
+ echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
|
|
| 231 |
+ "\n", |
|
| 232 |
+ "\n \t ", |
|
| 233 |
+ trim($str) |
|
| 234 |
+ )."\n"; |
|
| 235 |
+ } |
|
| 236 |
+ } |
|
| 237 |
+ |
|
| 238 |
+ /** |
|
| 239 |
+ * Connect to an SMTP server. |
|
| 240 |
+ * @param string $host SMTP server IP or host name |
|
| 241 |
+ * @param integer $port The port number to connect to |
|
| 242 |
+ * @param integer $timeout How long to wait for the connection to open |
|
| 243 |
+ * @param array $options An array of options for stream_context_create() |
|
| 244 |
+ * @access public |
|
| 245 |
+ * @return boolean |
|
| 246 |
+ */ |
|
| 247 |
+ public function connect($host, $port = null, $timeout = 30, $options = array()) |
|
| 248 |
+ {
|
|
| 249 |
+ static $streamok; |
|
| 250 |
+ //This is enabled by default since 5.0.0 but some providers disable it |
|
| 251 |
+ //Check this once and cache the result |
|
| 252 |
+ if (is_null($streamok)) {
|
|
| 253 |
+ $streamok = function_exists('stream_socket_client');
|
|
| 254 |
+ } |
|
| 255 |
+ // Clear errors to avoid confusion |
|
| 256 |
+ $this->setError('');
|
|
| 257 |
+ // Make sure we are __not__ connected |
|
| 258 |
+ if ($this->connected()) {
|
|
| 259 |
+ // Already connected, generate error |
|
| 260 |
+ $this->setError('Already connected to a server');
|
|
| 261 |
+ return false; |
|
| 262 |
+ } |
|
| 263 |
+ if (empty($port)) {
|
|
| 264 |
+ $port = self::DEFAULT_SMTP_PORT; |
|
| 265 |
+ } |
|
| 266 |
+ // Connect to the SMTP server |
|
| 267 |
+ $this->edebug( |
|
| 268 |
+ "Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true), |
|
| 269 |
+ self::DEBUG_CONNECTION |
|
| 270 |
+ ); |
|
| 271 |
+ $errno = 0; |
|
| 272 |
+ $errstr = ''; |
|
| 273 |
+ if ($streamok) {
|
|
| 274 |
+ $socket_context = stream_context_create($options); |
|
| 275 |
+ //Suppress errors; connection failures are handled at a higher level |
|
| 276 |
+ $this->smtp_conn = @stream_socket_client( |
|
| 277 |
+ $host . ":" . $port, |
|
| 278 |
+ $errno, |
|
| 279 |
+ $errstr, |
|
| 280 |
+ $timeout, |
|
| 281 |
+ STREAM_CLIENT_CONNECT, |
|
| 282 |
+ $socket_context |
|
| 283 |
+ ); |
|
| 284 |
+ } else {
|
|
| 285 |
+ //Fall back to fsockopen which should work in more places, but is missing some features |
|
| 286 |
+ $this->edebug( |
|
| 287 |
+ "Connection: stream_socket_client not available, falling back to fsockopen", |
|
| 288 |
+ self::DEBUG_CONNECTION |
|
| 289 |
+ ); |
|
| 290 |
+ $this->smtp_conn = fsockopen( |
|
| 291 |
+ $host, |
|
| 292 |
+ $port, |
|
| 293 |
+ $errno, |
|
| 294 |
+ $errstr, |
|
| 295 |
+ $timeout |
|
| 296 |
+ ); |
|
| 297 |
+ } |
|
| 298 |
+ // Verify we connected properly |
|
| 299 |
+ if (!is_resource($this->smtp_conn)) {
|
|
| 300 |
+ $this->setError( |
|
| 301 |
+ 'Failed to connect to server', |
|
| 302 |
+ $errno, |
|
| 303 |
+ $errstr |
|
| 304 |
+ ); |
|
| 305 |
+ $this->edebug( |
|
| 306 |
+ 'SMTP ERROR: ' . $this->error['error'] |
|
| 307 |
+ . ": $errstr ($errno)", |
|
| 308 |
+ self::DEBUG_CLIENT |
|
| 309 |
+ ); |
|
| 310 |
+ return false; |
|
| 311 |
+ } |
|
| 312 |
+ $this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
|
| 313 |
+ // SMTP server can take longer to respond, give longer timeout for first read |
|
| 314 |
+ // Windows does not have support for this timeout function |
|
| 315 |
+ if (substr(PHP_OS, 0, 3) != 'WIN') {
|
|
| 316 |
+ $max = ini_get('max_execution_time');
|
|
| 317 |
+ // Don't bother if unlimited |
|
| 318 |
+ if ($max != 0 && $timeout > $max) {
|
|
| 319 |
+ @set_time_limit($timeout); |
|
| 320 |
+ } |
|
| 321 |
+ stream_set_timeout($this->smtp_conn, $timeout, 0); |
|
| 322 |
+ } |
|
| 323 |
+ // Get any announcement |
|
| 324 |
+ $announce = $this->get_lines(); |
|
| 325 |
+ $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
|
|
| 326 |
+ return true; |
|
| 327 |
+ } |
|
| 328 |
+ |
|
| 329 |
+ /** |
|
| 330 |
+ * Initiate a TLS (encrypted) session. |
|
| 331 |
+ * @access public |
|
| 332 |
+ * @return boolean |
|
| 333 |
+ */ |
|
| 334 |
+ public function startTLS() |
|
| 335 |
+ {
|
|
| 336 |
+ if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
|
|
| 337 |
+ return false; |
|
| 338 |
+ } |
|
| 339 |
+ |
|
| 340 |
+ //Allow the best TLS version(s) we can |
|
| 341 |
+ $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; |
|
| 342 |
+ |
|
| 343 |
+ //PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT |
|
| 344 |
+ //so add them back in manually if we can |
|
| 345 |
+ if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
|
|
| 346 |
+ $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
|
| 347 |
+ $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; |
|
| 348 |
+ } |
|
| 349 |
+ |
|
| 350 |
+ // Begin encrypted connection |
|
| 351 |
+ if (!stream_socket_enable_crypto( |
|
| 352 |
+ $this->smtp_conn, |
|
| 353 |
+ true, |
|
| 354 |
+ $crypto_method |
|
| 355 |
+ )) {
|
|
| 356 |
+ return false; |
|
| 357 |
+ } |
|
| 358 |
+ return true; |
|
| 359 |
+ } |
|
| 360 |
+ |
|
| 361 |
+ /** |
|
| 362 |
+ * Perform SMTP authentication. |
|
| 363 |
+ * Must be run after hello(). |
|
| 364 |
+ * @see hello() |
|
| 365 |
+ * @param string $username The user name |
|
| 366 |
+ * @param string $password The password |
|
| 367 |
+ * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2) |
|
| 368 |
+ * @param string $realm The auth realm for NTLM |
|
| 369 |
+ * @param string $workstation The auth workstation for NTLM |
|
| 370 |
+ * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth) |
|
| 371 |
+ * @return bool True if successfully authenticated.* @access public |
|
| 372 |
+ */ |
|
| 373 |
+ public function authenticate( |
|
| 374 |
+ $username, |
|
| 375 |
+ $password, |
|
| 376 |
+ $authtype = null, |
|
| 377 |
+ $realm = '', |
|
| 378 |
+ $workstation = '', |
|
| 379 |
+ $OAuth = null |
|
| 380 |
+ ) {
|
|
| 381 |
+ if (!$this->server_caps) {
|
|
| 382 |
+ $this->setError('Authentication is not allowed before HELO/EHLO');
|
|
| 383 |
+ return false; |
|
| 384 |
+ } |
|
| 385 |
+ |
|
| 386 |
+ if (array_key_exists('EHLO', $this->server_caps)) {
|
|
| 387 |
+ // SMTP extensions are available. Let's try to find a proper authentication method |
|
| 388 |
+ |
|
| 389 |
+ if (!array_key_exists('AUTH', $this->server_caps)) {
|
|
| 390 |
+ $this->setError('Authentication is not allowed at this stage');
|
|
| 391 |
+ // 'at this stage' means that auth may be allowed after the stage changes |
|
| 392 |
+ // e.g. after STARTTLS |
|
| 393 |
+ return false; |
|
| 394 |
+ } |
|
| 395 |
+ |
|
| 396 |
+ self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
|
|
| 397 |
+ self::edebug( |
|
| 398 |
+ 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
|
|
| 399 |
+ self::DEBUG_LOWLEVEL |
|
| 400 |
+ ); |
|
| 401 |
+ |
|
| 402 |
+ if (empty($authtype)) {
|
|
| 403 |
+ foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN', 'XOAUTH2') as $method) {
|
|
| 404 |
+ if (in_array($method, $this->server_caps['AUTH'])) {
|
|
| 405 |
+ $authtype = $method; |
|
| 406 |
+ break; |
|
| 407 |
+ } |
|
| 408 |
+ } |
|
| 409 |
+ if (empty($authtype)) {
|
|
| 410 |
+ $this->setError('No supported authentication methods found');
|
|
| 411 |
+ return false; |
|
| 412 |
+ } |
|
| 413 |
+ self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
|
|
| 414 |
+ } |
|
| 415 |
+ |
|
| 416 |
+ if (!in_array($authtype, $this->server_caps['AUTH'])) {
|
|
| 417 |
+ $this->setError("The requested authentication method \"$authtype\" is not supported by the server");
|
|
| 418 |
+ return false; |
|
| 419 |
+ } |
|
| 420 |
+ } elseif (empty($authtype)) {
|
|
| 421 |
+ $authtype = 'LOGIN'; |
|
| 422 |
+ } |
|
| 423 |
+ switch ($authtype) {
|
|
| 424 |
+ case 'PLAIN': |
|
| 425 |
+ // Start authentication |
|
| 426 |
+ if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
|
|
| 427 |
+ return false; |
|
| 428 |
+ } |
|
| 429 |
+ // Send encoded username and password |
|
| 430 |
+ if (!$this->sendCommand( |
|
| 431 |
+ 'User & Password', |
|
| 432 |
+ base64_encode("\0" . $username . "\0" . $password),
|
|
| 433 |
+ 235 |
|
| 434 |
+ ) |
|
| 435 |
+ ) {
|
|
| 436 |
+ return false; |
|
| 437 |
+ } |
|
| 438 |
+ break; |
|
| 439 |
+ case 'LOGIN': |
|
| 440 |
+ // Start authentication |
|
| 441 |
+ if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
|
|
| 442 |
+ return false; |
|
| 443 |
+ } |
|
| 444 |
+ if (!$this->sendCommand("Username", base64_encode($username), 334)) {
|
|
| 445 |
+ return false; |
|
| 446 |
+ } |
|
| 447 |
+ if (!$this->sendCommand("Password", base64_encode($password), 235)) {
|
|
| 448 |
+ return false; |
|
| 449 |
+ } |
|
| 450 |
+ break; |
|
| 451 |
+ case 'XOAUTH2': |
|
| 452 |
+ //If the OAuth Instance is not set. Can be a case when PHPMailer is used |
|
| 453 |
+ //instead of PHPMailerOAuth |
|
| 454 |
+ if (is_null($OAuth)) {
|
|
| 455 |
+ return false; |
|
| 456 |
+ } |
|
| 457 |
+ $oauth = $OAuth->getOauth64(); |
|
| 458 |
+ |
|
| 459 |
+ // Start authentication |
|
| 460 |
+ if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
|
|
| 461 |
+ return false; |
|
| 462 |
+ } |
|
| 463 |
+ break; |
|
| 464 |
+ case 'NTLM': |
|
| 465 |
+ /* |
|
| 466 |
+ * ntlm_sasl_client.php |
|
| 467 |
+ * Bundled with Permission |
|
| 468 |
+ * |
|
| 469 |
+ * How to telnet in windows: |
|
| 470 |
+ * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx |
|
| 471 |
+ * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication |
|
| 472 |
+ */ |
|
| 473 |
+ require_once 'extras/ntlm_sasl_client.php'; |
|
| 474 |
+ $temp = new stdClass; |
|
| 475 |
+ $ntlm_client = new ntlm_sasl_client_class; |
|
| 476 |
+ //Check that functions are available |
|
| 477 |
+ if (!$ntlm_client->Initialize($temp)) {
|
|
| 478 |
+ $this->setError($temp->error); |
|
| 479 |
+ $this->edebug( |
|
| 480 |
+ 'You need to enable some modules in your php.ini file: ' |
|
| 481 |
+ . $this->error['error'], |
|
| 482 |
+ self::DEBUG_CLIENT |
|
| 483 |
+ ); |
|
| 484 |
+ return false; |
|
| 485 |
+ } |
|
| 486 |
+ //msg1 |
|
| 487 |
+ $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1 |
|
| 488 |
+ |
|
| 489 |
+ if (!$this->sendCommand( |
|
| 490 |
+ 'AUTH NTLM', |
|
| 491 |
+ 'AUTH NTLM ' . base64_encode($msg1), |
|
| 492 |
+ 334 |
|
| 493 |
+ ) |
|
| 494 |
+ ) {
|
|
| 495 |
+ return false; |
|
| 496 |
+ } |
|
| 497 |
+ //Though 0 based, there is a white space after the 3 digit number |
|
| 498 |
+ //msg2 |
|
| 499 |
+ $challenge = substr($this->last_reply, 3); |
|
| 500 |
+ $challenge = base64_decode($challenge); |
|
| 501 |
+ $ntlm_res = $ntlm_client->NTLMResponse( |
|
| 502 |
+ substr($challenge, 24, 8), |
|
| 503 |
+ $password |
|
| 504 |
+ ); |
|
| 505 |
+ //msg3 |
|
| 506 |
+ $msg3 = $ntlm_client->TypeMsg3( |
|
| 507 |
+ $ntlm_res, |
|
| 508 |
+ $username, |
|
| 509 |
+ $realm, |
|
| 510 |
+ $workstation |
|
| 511 |
+ ); |
|
| 512 |
+ // send encoded username |
|
| 513 |
+ return $this->sendCommand('Username', base64_encode($msg3), 235);
|
|
| 514 |
+ case 'CRAM-MD5': |
|
| 515 |
+ // Start authentication |
|
| 516 |
+ if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
|
|
| 517 |
+ return false; |
|
| 518 |
+ } |
|
| 519 |
+ // Get the challenge |
|
| 520 |
+ $challenge = base64_decode(substr($this->last_reply, 4)); |
|
| 521 |
+ |
|
| 522 |
+ // Build the response |
|
| 523 |
+ $response = $username . ' ' . $this->hmac($challenge, $password); |
|
| 524 |
+ |
|
| 525 |
+ // send encoded credentials |
|
| 526 |
+ return $this->sendCommand('Username', base64_encode($response), 235);
|
|
| 527 |
+ default: |
|
| 528 |
+ $this->setError("Authentication method \"$authtype\" is not supported");
|
|
| 529 |
+ return false; |
|
| 530 |
+ } |
|
| 531 |
+ return true; |
|
| 532 |
+ } |
|
| 533 |
+ |
|
| 534 |
+ /** |
|
| 535 |
+ * Calculate an MD5 HMAC hash. |
|
| 536 |
+ * Works like hash_hmac('md5', $data, $key)
|
|
| 537 |
+ * in case that function is not available |
|
| 538 |
+ * @param string $data The data to hash |
|
| 539 |
+ * @param string $key The key to hash with |
|
| 540 |
+ * @access protected |
|
| 541 |
+ * @return string |
|
| 542 |
+ */ |
|
| 543 |
+ protected function hmac($data, $key) |
|
| 544 |
+ {
|
|
| 545 |
+ if (function_exists('hash_hmac')) {
|
|
| 546 |
+ return hash_hmac('md5', $data, $key);
|
|
| 547 |
+ } |
|
| 548 |
+ |
|
| 549 |
+ // The following borrowed from |
|
| 550 |
+ // http://php.net/manual/en/function.mhash.php#27225 |
|
| 551 |
+ |
|
| 552 |
+ // RFC 2104 HMAC implementation for php. |
|
| 553 |
+ // Creates an md5 HMAC. |
|
| 554 |
+ // Eliminates the need to install mhash to compute a HMAC |
|
| 555 |
+ // by Lance Rushing |
|
| 556 |
+ |
|
| 557 |
+ $bytelen = 64; // byte length for md5 |
|
| 558 |
+ if (strlen($key) > $bytelen) {
|
|
| 559 |
+ $key = pack('H*', md5($key));
|
|
| 560 |
+ } |
|
| 561 |
+ $key = str_pad($key, $bytelen, chr(0x00)); |
|
| 562 |
+ $ipad = str_pad('', $bytelen, chr(0x36));
|
|
| 563 |
+ $opad = str_pad('', $bytelen, chr(0x5c));
|
|
| 564 |
+ $k_ipad = $key ^ $ipad; |
|
| 565 |
+ $k_opad = $key ^ $opad; |
|
| 566 |
+ |
|
| 567 |
+ return md5($k_opad . pack('H*', md5($k_ipad . $data)));
|
|
| 568 |
+ } |
|
| 569 |
+ |
|
| 570 |
+ /** |
|
| 571 |
+ * Check connection state. |
|
| 572 |
+ * @access public |
|
| 573 |
+ * @return boolean True if connected. |
|
| 574 |
+ */ |
|
| 575 |
+ public function connected() |
|
| 576 |
+ {
|
|
| 577 |
+ if (is_resource($this->smtp_conn)) {
|
|
| 578 |
+ $sock_status = stream_get_meta_data($this->smtp_conn); |
|
| 579 |
+ if ($sock_status['eof']) {
|
|
| 580 |
+ // The socket is valid but we are not connected |
|
| 581 |
+ $this->edebug( |
|
| 582 |
+ 'SMTP NOTICE: EOF caught while checking if connected', |
|
| 583 |
+ self::DEBUG_CLIENT |
|
| 584 |
+ ); |
|
| 585 |
+ $this->close(); |
|
| 586 |
+ return false; |
|
| 587 |
+ } |
|
| 588 |
+ return true; // everything looks good |
|
| 589 |
+ } |
|
| 590 |
+ return false; |
|
| 591 |
+ } |
|
| 592 |
+ |
|
| 593 |
+ /** |
|
| 594 |
+ * Close the socket and clean up the state of the class. |
|
| 595 |
+ * Don't use this function without first trying to use QUIT. |
|
| 596 |
+ * @see quit() |
|
| 597 |
+ * @access public |
|
| 598 |
+ * @return void |
|
| 599 |
+ */ |
|
| 600 |
+ public function close() |
|
| 601 |
+ {
|
|
| 602 |
+ $this->setError('');
|
|
| 603 |
+ $this->server_caps = null; |
|
| 604 |
+ $this->helo_rply = null; |
|
| 605 |
+ if (is_resource($this->smtp_conn)) {
|
|
| 606 |
+ // close the connection and cleanup |
|
| 607 |
+ fclose($this->smtp_conn); |
|
| 608 |
+ $this->smtp_conn = null; //Makes for cleaner serialization |
|
| 609 |
+ $this->edebug('Connection: closed', self::DEBUG_CONNECTION);
|
|
| 610 |
+ } |
|
| 611 |
+ } |
|
| 612 |
+ |
|
| 613 |
+ /** |
|
| 614 |
+ * Send an SMTP DATA command. |
|
| 615 |
+ * Issues a data command and sends the msg_data to the server, |
|
| 616 |
+ * finializing the mail transaction. $msg_data is the message |
|
| 617 |
+ * that is to be send with the headers. Each header needs to be |
|
| 618 |
+ * on a single line followed by a <CRLF> with the message headers |
|
| 619 |
+ * and the message body being separated by and additional <CRLF>. |
|
| 620 |
+ * Implements rfc 821: DATA <CRLF> |
|
| 621 |
+ * @param string $msg_data Message data to send |
|
| 622 |
+ * @access public |
|
| 623 |
+ * @return boolean |
|
| 624 |
+ */ |
|
| 625 |
+ public function data($msg_data) |
|
| 626 |
+ {
|
|
| 627 |
+ //This will use the standard timelimit |
|
| 628 |
+ if (!$this->sendCommand('DATA', 'DATA', 354)) {
|
|
| 629 |
+ return false; |
|
| 630 |
+ } |
|
| 631 |
+ |
|
| 632 |
+ /* The server is ready to accept data! |
|
| 633 |
+ * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF) |
|
| 634 |
+ * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into |
|
| 635 |
+ * smaller lines to fit within the limit. |
|
| 636 |
+ * We will also look for lines that start with a '.' and prepend an additional '.'. |
|
| 637 |
+ * NOTE: this does not count towards line-length limit. |
|
| 638 |
+ */ |
|
| 639 |
+ |
|
| 640 |
+ // Normalize line breaks before exploding |
|
| 641 |
+ $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
|
|
| 642 |
+ |
|
| 643 |
+ /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field |
|
| 644 |
+ * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
|
|
| 645 |
+ * process all lines before a blank line as headers. |
|
| 646 |
+ */ |
|
| 647 |
+ |
|
| 648 |
+ $field = substr($lines[0], 0, strpos($lines[0], ':')); |
|
| 649 |
+ $in_headers = false; |
|
| 650 |
+ if (!empty($field) && strpos($field, ' ') === false) {
|
|
| 651 |
+ $in_headers = true; |
|
| 652 |
+ } |
|
| 653 |
+ |
|
| 654 |
+ foreach ($lines as $line) {
|
|
| 655 |
+ $lines_out = array(); |
|
| 656 |
+ if ($in_headers and $line == '') {
|
|
| 657 |
+ $in_headers = false; |
|
| 658 |
+ } |
|
| 659 |
+ //Break this line up into several smaller lines if it's too long |
|
| 660 |
+ //Micro-optimisation: isset($str[$len]) is faster than (strlen($str) > $len), |
|
| 661 |
+ while (isset($line[self::MAX_LINE_LENGTH])) {
|
|
| 662 |
+ //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on |
|
| 663 |
+ //so as to avoid breaking in the middle of a word |
|
| 664 |
+ $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' '); |
|
| 665 |
+ //Deliberately matches both false and 0 |
|
| 666 |
+ if (!$pos) {
|
|
| 667 |
+ //No nice break found, add a hard break |
|
| 668 |
+ $pos = self::MAX_LINE_LENGTH - 1; |
|
| 669 |
+ $lines_out[] = substr($line, 0, $pos); |
|
| 670 |
+ $line = substr($line, $pos); |
|
| 671 |
+ } else {
|
|
| 672 |
+ //Break at the found point |
|
| 673 |
+ $lines_out[] = substr($line, 0, $pos); |
|
| 674 |
+ //Move along by the amount we dealt with |
|
| 675 |
+ $line = substr($line, $pos + 1); |
|
| 676 |
+ } |
|
| 677 |
+ //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1 |
|
| 678 |
+ if ($in_headers) {
|
|
| 679 |
+ $line = "\t" . $line; |
|
| 680 |
+ } |
|
| 681 |
+ } |
|
| 682 |
+ $lines_out[] = $line; |
|
| 683 |
+ |
|
| 684 |
+ //Send the lines to the server |
|
| 685 |
+ foreach ($lines_out as $line_out) {
|
|
| 686 |
+ //RFC2821 section 4.5.2 |
|
| 687 |
+ if (!empty($line_out) and $line_out[0] == '.') {
|
|
| 688 |
+ $line_out = '.' . $line_out; |
|
| 689 |
+ } |
|
| 690 |
+ $this->client_send($line_out . self::CRLF); |
|
| 691 |
+ } |
|
| 692 |
+ } |
|
| 693 |
+ |
|
| 694 |
+ //Message data has been sent, complete the command |
|
| 695 |
+ //Increase timelimit for end of DATA command |
|
| 696 |
+ $savetimelimit = $this->Timelimit; |
|
| 697 |
+ $this->Timelimit = $this->Timelimit * 2; |
|
| 698 |
+ $result = $this->sendCommand('DATA END', '.', 250);
|
|
| 699 |
+ //Restore timelimit |
|
| 700 |
+ $this->Timelimit = $savetimelimit; |
|
| 701 |
+ return $result; |
|
| 702 |
+ } |
|
| 703 |
+ |
|
| 704 |
+ /** |
|
| 705 |
+ * Send an SMTP HELO or EHLO command. |
|
| 706 |
+ * Used to identify the sending server to the receiving server. |
|
| 707 |
+ * This makes sure that client and server are in a known state. |
|
| 708 |
+ * Implements RFC 821: HELO <SP> <domain> <CRLF> |
|
| 709 |
+ * and RFC 2821 EHLO. |
|
| 710 |
+ * @param string $host The host name or IP to connect to |
|
| 711 |
+ * @access public |
|
| 712 |
+ * @return boolean |
|
| 713 |
+ */ |
|
| 714 |
+ public function hello($host = '') |
|
| 715 |
+ {
|
|
| 716 |
+ //Try extended hello first (RFC 2821) |
|
| 717 |
+ return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
|
|
| 718 |
+ } |
|
| 719 |
+ |
|
| 720 |
+ /** |
|
| 721 |
+ * Send an SMTP HELO or EHLO command. |
|
| 722 |
+ * Low-level implementation used by hello() |
|
| 723 |
+ * @see hello() |
|
| 724 |
+ * @param string $hello The HELO string |
|
| 725 |
+ * @param string $host The hostname to say we are |
|
| 726 |
+ * @access protected |
|
| 727 |
+ * @return boolean |
|
| 728 |
+ */ |
|
| 729 |
+ protected function sendHello($hello, $host) |
|
| 730 |
+ {
|
|
| 731 |
+ $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250); |
|
| 732 |
+ $this->helo_rply = $this->last_reply; |
|
| 733 |
+ if ($noerror) {
|
|
| 734 |
+ $this->parseHelloFields($hello); |
|
| 735 |
+ } else {
|
|
| 736 |
+ $this->server_caps = null; |
|
| 737 |
+ } |
|
| 738 |
+ return $noerror; |
|
| 739 |
+ } |
|
| 740 |
+ |
|
| 741 |
+ /** |
|
| 742 |
+ * Parse a reply to HELO/EHLO command to discover server extensions. |
|
| 743 |
+ * In case of HELO, the only parameter that can be discovered is a server name. |
|
| 744 |
+ * @access protected |
|
| 745 |
+ * @param string $type - 'HELO' or 'EHLO' |
|
| 746 |
+ */ |
|
| 747 |
+ protected function parseHelloFields($type) |
|
| 748 |
+ {
|
|
| 749 |
+ $this->server_caps = array(); |
|
| 750 |
+ $lines = explode("\n", $this->helo_rply);
|
|
| 751 |
+ |
|
| 752 |
+ foreach ($lines as $n => $s) {
|
|
| 753 |
+ //First 4 chars contain response code followed by - or space |
|
| 754 |
+ $s = trim(substr($s, 4)); |
|
| 755 |
+ if (empty($s)) {
|
|
| 756 |
+ continue; |
|
| 757 |
+ } |
|
| 758 |
+ $fields = explode(' ', $s);
|
|
| 759 |
+ if (!empty($fields)) {
|
|
| 760 |
+ if (!$n) {
|
|
| 761 |
+ $name = $type; |
|
| 762 |
+ $fields = $fields[0]; |
|
| 763 |
+ } else {
|
|
| 764 |
+ $name = array_shift($fields); |
|
| 765 |
+ switch ($name) {
|
|
| 766 |
+ case 'SIZE': |
|
| 767 |
+ $fields = ($fields ? $fields[0] : 0); |
|
| 768 |
+ break; |
|
| 769 |
+ case 'AUTH': |
|
| 770 |
+ if (!is_array($fields)) {
|
|
| 771 |
+ $fields = array(); |
|
| 772 |
+ } |
|
| 773 |
+ break; |
|
| 774 |
+ default: |
|
| 775 |
+ $fields = true; |
|
| 776 |
+ } |
|
| 777 |
+ } |
|
| 778 |
+ $this->server_caps[$name] = $fields; |
|
| 779 |
+ } |
|
| 780 |
+ } |
|
| 781 |
+ } |
|
| 782 |
+ |
|
| 783 |
+ /** |
|
| 784 |
+ * Send an SMTP MAIL command. |
|
| 785 |
+ * Starts a mail transaction from the email address specified in |
|
| 786 |
+ * $from. Returns true if successful or false otherwise. If True |
|
| 787 |
+ * the mail transaction is started and then one or more recipient |
|
| 788 |
+ * commands may be called followed by a data command. |
|
| 789 |
+ * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF> |
|
| 790 |
+ * @param string $from Source address of this message |
|
| 791 |
+ * @access public |
|
| 792 |
+ * @return boolean |
|
| 793 |
+ */ |
|
| 794 |
+ public function mail($from) |
|
| 795 |
+ {
|
|
| 796 |
+ $useVerp = ($this->do_verp ? ' XVERP' : ''); |
|
| 797 |
+ return $this->sendCommand( |
|
| 798 |
+ 'MAIL FROM', |
|
| 799 |
+ 'MAIL FROM:<' . $from . '>' . $useVerp, |
|
| 800 |
+ 250 |
|
| 801 |
+ ); |
|
| 802 |
+ } |
|
| 803 |
+ |
|
| 804 |
+ /** |
|
| 805 |
+ * Send an SMTP QUIT command. |
|
| 806 |
+ * Closes the socket if there is no error or the $close_on_error argument is true. |
|
| 807 |
+ * Implements from rfc 821: QUIT <CRLF> |
|
| 808 |
+ * @param boolean $close_on_error Should the connection close if an error occurs? |
|
| 809 |
+ * @access public |
|
| 810 |
+ * @return boolean |
|
| 811 |
+ */ |
|
| 812 |
+ public function quit($close_on_error = true) |
|
| 813 |
+ {
|
|
| 814 |
+ $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
|
|
| 815 |
+ $err = $this->error; //Save any error |
|
| 816 |
+ if ($noerror or $close_on_error) {
|
|
| 817 |
+ $this->close(); |
|
| 818 |
+ $this->error = $err; //Restore any error from the quit command |
|
| 819 |
+ } |
|
| 820 |
+ return $noerror; |
|
| 821 |
+ } |
|
| 822 |
+ |
|
| 823 |
+ /** |
|
| 824 |
+ * Send an SMTP RCPT command. |
|
| 825 |
+ * Sets the TO argument to $toaddr. |
|
| 826 |
+ * Returns true if the recipient was accepted false if it was rejected. |
|
| 827 |
+ * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF> |
|
| 828 |
+ * @param string $address The address the message is being sent to |
|
| 829 |
+ * @access public |
|
| 830 |
+ * @return boolean |
|
| 831 |
+ */ |
|
| 832 |
+ public function recipient($address) |
|
| 833 |
+ {
|
|
| 834 |
+ return $this->sendCommand( |
|
| 835 |
+ 'RCPT TO', |
|
| 836 |
+ 'RCPT TO:<' . $address . '>', |
|
| 837 |
+ array(250, 251) |
|
| 838 |
+ ); |
|
| 839 |
+ } |
|
| 840 |
+ |
|
| 841 |
+ /** |
|
| 842 |
+ * Send an SMTP RSET command. |
|
| 843 |
+ * Abort any transaction that is currently in progress. |
|
| 844 |
+ * Implements rfc 821: RSET <CRLF> |
|
| 845 |
+ * @access public |
|
| 846 |
+ * @return boolean True on success. |
|
| 847 |
+ */ |
|
| 848 |
+ public function reset() |
|
| 849 |
+ {
|
|
| 850 |
+ return $this->sendCommand('RSET', 'RSET', 250);
|
|
| 851 |
+ } |
|
| 852 |
+ |
|
| 853 |
+ /** |
|
| 854 |
+ * Send a command to an SMTP server and check its return code. |
|
| 855 |
+ * @param string $command The command name - not sent to the server |
|
| 856 |
+ * @param string $commandstring The actual command to send |
|
| 857 |
+ * @param integer|array $expect One or more expected integer success codes |
|
| 858 |
+ * @access protected |
|
| 859 |
+ * @return boolean True on success. |
|
| 860 |
+ */ |
|
| 861 |
+ protected function sendCommand($command, $commandstring, $expect) |
|
| 862 |
+ {
|
|
| 863 |
+ if (!$this->connected()) {
|
|
| 864 |
+ $this->setError("Called $command without being connected");
|
|
| 865 |
+ return false; |
|
| 866 |
+ } |
|
| 867 |
+ //Reject line breaks in all commands |
|
| 868 |
+ if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) {
|
|
| 869 |
+ $this->setError("Command '$command' contained line breaks");
|
|
| 870 |
+ return false; |
|
| 871 |
+ } |
|
| 872 |
+ $this->client_send($commandstring . self::CRLF); |
|
| 873 |
+ |
|
| 874 |
+ $this->last_reply = $this->get_lines(); |
|
| 875 |
+ // Fetch SMTP code and possible error code explanation |
|
| 876 |
+ $matches = array(); |
|
| 877 |
+ if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
|
|
| 878 |
+ $code = $matches[1]; |
|
| 879 |
+ $code_ex = (count($matches) > 2 ? $matches[2] : null); |
|
| 880 |
+ // Cut off error code from each response line |
|
| 881 |
+ $detail = preg_replace( |
|
| 882 |
+ "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
|
|
| 883 |
+ '', |
|
| 884 |
+ $this->last_reply |
|
| 885 |
+ ); |
|
| 886 |
+ } else {
|
|
| 887 |
+ // Fall back to simple parsing if regex fails |
|
| 888 |
+ $code = substr($this->last_reply, 0, 3); |
|
| 889 |
+ $code_ex = null; |
|
| 890 |
+ $detail = substr($this->last_reply, 4); |
|
| 891 |
+ } |
|
| 892 |
+ |
|
| 893 |
+ $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
|
|
| 894 |
+ |
|
| 895 |
+ if (!in_array($code, (array)$expect)) {
|
|
| 896 |
+ $this->setError( |
|
| 897 |
+ "$command command failed", |
|
| 898 |
+ $detail, |
|
| 899 |
+ $code, |
|
| 900 |
+ $code_ex |
|
| 901 |
+ ); |
|
| 902 |
+ $this->edebug( |
|
| 903 |
+ 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply, |
|
| 904 |
+ self::DEBUG_CLIENT |
|
| 905 |
+ ); |
|
| 906 |
+ return false; |
|
| 907 |
+ } |
|
| 908 |
+ |
|
| 909 |
+ $this->setError('');
|
|
| 910 |
+ return true; |
|
| 911 |
+ } |
|
| 912 |
+ |
|
| 913 |
+ /** |
|
| 914 |
+ * Send an SMTP SAML command. |
|
| 915 |
+ * Starts a mail transaction from the email address specified in $from. |
|
| 916 |
+ * Returns true if successful or false otherwise. If True |
|
| 917 |
+ * the mail transaction is started and then one or more recipient |
|
| 918 |
+ * commands may be called followed by a data command. This command |
|
| 919 |
+ * will send the message to the users terminal if they are logged |
|
| 920 |
+ * in and send them an email. |
|
| 921 |
+ * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF> |
|
| 922 |
+ * @param string $from The address the message is from |
|
| 923 |
+ * @access public |
|
| 924 |
+ * @return boolean |
|
| 925 |
+ */ |
|
| 926 |
+ public function sendAndMail($from) |
|
| 927 |
+ {
|
|
| 928 |
+ return $this->sendCommand('SAML', "SAML FROM:$from", 250);
|
|
| 929 |
+ } |
|
| 930 |
+ |
|
| 931 |
+ /** |
|
| 932 |
+ * Send an SMTP VRFY command. |
|
| 933 |
+ * @param string $name The name to verify |
|
| 934 |
+ * @access public |
|
| 935 |
+ * @return boolean |
|
| 936 |
+ */ |
|
| 937 |
+ public function verify($name) |
|
| 938 |
+ {
|
|
| 939 |
+ return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
|
|
| 940 |
+ } |
|
| 941 |
+ |
|
| 942 |
+ /** |
|
| 943 |
+ * Send an SMTP NOOP command. |
|
| 944 |
+ * Used to keep keep-alives alive, doesn't actually do anything |
|
| 945 |
+ * @access public |
|
| 946 |
+ * @return boolean |
|
| 947 |
+ */ |
|
| 948 |
+ public function noop() |
|
| 949 |
+ {
|
|
| 950 |
+ return $this->sendCommand('NOOP', 'NOOP', 250);
|
|
| 951 |
+ } |
|
| 952 |
+ |
|
| 953 |
+ /** |
|
| 954 |
+ * Send an SMTP TURN command. |
|
| 955 |
+ * This is an optional command for SMTP that this class does not support. |
|
| 956 |
+ * This method is here to make the RFC821 Definition complete for this class |
|
| 957 |
+ * and _may_ be implemented in future |
|
| 958 |
+ * Implements from rfc 821: TURN <CRLF> |
|
| 959 |
+ * @access public |
|
| 960 |
+ * @return boolean |
|
| 961 |
+ */ |
|
| 962 |
+ public function turn() |
|
| 963 |
+ {
|
|
| 964 |
+ $this->setError('The SMTP TURN command is not implemented');
|
|
| 965 |
+ $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
|
|
| 966 |
+ return false; |
|
| 967 |
+ } |
|
| 968 |
+ |
|
| 969 |
+ /** |
|
| 970 |
+ * Send raw data to the server. |
|
| 971 |
+ * @param string $data The data to send |
|
| 972 |
+ * @access public |
|
| 973 |
+ * @return integer|boolean The number of bytes sent to the server or false on error |
|
| 974 |
+ */ |
|
| 975 |
+ public function client_send($data) |
|
| 976 |
+ {
|
|
| 977 |
+ $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
|
|
| 978 |
+ return fwrite($this->smtp_conn, $data); |
|
| 979 |
+ } |
|
| 980 |
+ |
|
| 981 |
+ /** |
|
| 982 |
+ * Get the latest error. |
|
| 983 |
+ * @access public |
|
| 984 |
+ * @return array |
|
| 985 |
+ */ |
|
| 986 |
+ public function getError() |
|
| 987 |
+ {
|
|
| 988 |
+ return $this->error; |
|
| 989 |
+ } |
|
| 990 |
+ |
|
| 991 |
+ /** |
|
| 992 |
+ * Get SMTP extensions available on the server |
|
| 993 |
+ * @access public |
|
| 994 |
+ * @return array|null |
|
| 995 |
+ */ |
|
| 996 |
+ public function getServerExtList() |
|
| 997 |
+ {
|
|
| 998 |
+ return $this->server_caps; |
|
| 999 |
+ } |
|
| 1000 |
+ |
|
| 1001 |
+ /** |
|
| 1002 |
+ * A multipurpose method |
|
| 1003 |
+ * The method works in three ways, dependent on argument value and current state |
|
| 1004 |
+ * 1. HELO/EHLO was not sent - returns null and set up $this->error |
|
| 1005 |
+ * 2. HELO was sent |
|
| 1006 |
+ * $name = 'HELO': returns server name |
|
| 1007 |
+ * $name = 'EHLO': returns boolean false |
|
| 1008 |
+ * $name = any string: returns null and set up $this->error |
|
| 1009 |
+ * 3. EHLO was sent |
|
| 1010 |
+ * $name = 'HELO'|'EHLO': returns server name |
|
| 1011 |
+ * $name = any string: if extension $name exists, returns boolean True |
|
| 1012 |
+ * or its options. Otherwise returns boolean False |
|
| 1013 |
+ * In other words, one can use this method to detect 3 conditions: |
|
| 1014 |
+ * - null returned: handshake was not or we don't know about ext (refer to $this->error) |
|
| 1015 |
+ * - false returned: the requested feature exactly not exists |
|
| 1016 |
+ * - positive value returned: the requested feature exists |
|
| 1017 |
+ * @param string $name Name of SMTP extension or 'HELO'|'EHLO' |
|
| 1018 |
+ * @return mixed |
|
| 1019 |
+ */ |
|
| 1020 |
+ public function getServerExt($name) |
|
| 1021 |
+ {
|
|
| 1022 |
+ if (!$this->server_caps) {
|
|
| 1023 |
+ $this->setError('No HELO/EHLO was sent');
|
|
| 1024 |
+ return null; |
|
| 1025 |
+ } |
|
| 1026 |
+ |
|
| 1027 |
+ // the tight logic knot ;) |
|
| 1028 |
+ if (!array_key_exists($name, $this->server_caps)) {
|
|
| 1029 |
+ if ($name == 'HELO') {
|
|
| 1030 |
+ return $this->server_caps['EHLO']; |
|
| 1031 |
+ } |
|
| 1032 |
+ if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
|
|
| 1033 |
+ return false; |
|
| 1034 |
+ } |
|
| 1035 |
+ $this->setError('HELO handshake was used. Client knows nothing about server extensions');
|
|
| 1036 |
+ return null; |
|
| 1037 |
+ } |
|
| 1038 |
+ |
|
| 1039 |
+ return $this->server_caps[$name]; |
|
| 1040 |
+ } |
|
| 1041 |
+ |
|
| 1042 |
+ /** |
|
| 1043 |
+ * Get the last reply from the server. |
|
| 1044 |
+ * @access public |
|
| 1045 |
+ * @return string |
|
| 1046 |
+ */ |
|
| 1047 |
+ public function getLastReply() |
|
| 1048 |
+ {
|
|
| 1049 |
+ return $this->last_reply; |
|
| 1050 |
+ } |
|
| 1051 |
+ |
|
| 1052 |
+ /** |
|
| 1053 |
+ * Read the SMTP server's response. |
|
| 1054 |
+ * Either before eof or socket timeout occurs on the operation. |
|
| 1055 |
+ * With SMTP we can tell if we have more lines to read if the |
|
| 1056 |
+ * 4th character is '-' symbol. If it is a space then we don't |
|
| 1057 |
+ * need to read anything else. |
|
| 1058 |
+ * @access protected |
|
| 1059 |
+ * @return string |
|
| 1060 |
+ */ |
|
| 1061 |
+ protected function get_lines() |
|
| 1062 |
+ {
|
|
| 1063 |
+ // If the connection is bad, give up straight away |
|
| 1064 |
+ if (!is_resource($this->smtp_conn)) {
|
|
| 1065 |
+ return ''; |
|
| 1066 |
+ } |
|
| 1067 |
+ $data = ''; |
|
| 1068 |
+ $endtime = 0; |
|
| 1069 |
+ stream_set_timeout($this->smtp_conn, $this->Timeout); |
|
| 1070 |
+ if ($this->Timelimit > 0) {
|
|
| 1071 |
+ $endtime = time() + $this->Timelimit; |
|
| 1072 |
+ } |
|
| 1073 |
+ while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
|
|
| 1074 |
+ $str = @fgets($this->smtp_conn, 515); |
|
| 1075 |
+ $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
|
|
| 1076 |
+ $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
|
|
| 1077 |
+ $data .= $str; |
|
| 1078 |
+ // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen |
|
| 1079 |
+ if ((isset($str[3]) and $str[3] == ' ')) {
|
|
| 1080 |
+ break; |
|
| 1081 |
+ } |
|
| 1082 |
+ // Timed-out? Log and break |
|
| 1083 |
+ $info = stream_get_meta_data($this->smtp_conn); |
|
| 1084 |
+ if ($info['timed_out']) {
|
|
| 1085 |
+ $this->edebug( |
|
| 1086 |
+ 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
|
|
| 1087 |
+ self::DEBUG_LOWLEVEL |
|
| 1088 |
+ ); |
|
| 1089 |
+ break; |
|
| 1090 |
+ } |
|
| 1091 |
+ // Now check if reads took too long |
|
| 1092 |
+ if ($endtime and time() > $endtime) {
|
|
| 1093 |
+ $this->edebug( |
|
| 1094 |
+ 'SMTP -> get_lines(): timelimit reached ('.
|
|
| 1095 |
+ $this->Timelimit . ' sec)', |
|
| 1096 |
+ self::DEBUG_LOWLEVEL |
|
| 1097 |
+ ); |
|
| 1098 |
+ break; |
|
| 1099 |
+ } |
|
| 1100 |
+ } |
|
| 1101 |
+ return $data; |
|
| 1102 |
+ } |
|
| 1103 |
+ |
|
| 1104 |
+ /** |
|
| 1105 |
+ * Enable or disable VERP address generation. |
|
| 1106 |
+ * @param boolean $enabled |
|
| 1107 |
+ */ |
|
| 1108 |
+ public function setVerp($enabled = false) |
|
| 1109 |
+ {
|
|
| 1110 |
+ $this->do_verp = $enabled; |
|
| 1111 |
+ } |
|
| 1112 |
+ |
|
| 1113 |
+ /** |
|
| 1114 |
+ * Get VERP address generation mode. |
|
| 1115 |
+ * @return boolean |
|
| 1116 |
+ */ |
|
| 1117 |
+ public function getVerp() |
|
| 1118 |
+ {
|
|
| 1119 |
+ return $this->do_verp; |
|
| 1120 |
+ } |
|
| 1121 |
+ |
|
| 1122 |
+ /** |
|
| 1123 |
+ * Set error messages and codes. |
|
| 1124 |
+ * @param string $message The error message |
|
| 1125 |
+ * @param string $detail Further detail on the error |
|
| 1126 |
+ * @param string $smtp_code An associated SMTP error code |
|
| 1127 |
+ * @param string $smtp_code_ex Extended SMTP code |
|
| 1128 |
+ */ |
|
| 1129 |
+ protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '') |
|
| 1130 |
+ {
|
|
| 1131 |
+ $this->error = array( |
|
| 1132 |
+ 'error' => $message, |
|
| 1133 |
+ 'detail' => $detail, |
|
| 1134 |
+ 'smtp_code' => $smtp_code, |
|
| 1135 |
+ 'smtp_code_ex' => $smtp_code_ex |
|
| 1136 |
+ ); |
|
| 1137 |
+ } |
|
| 1138 |
+ |
|
| 1139 |
+ /** |
|
| 1140 |
+ * Set debug output method. |
|
| 1141 |
+ * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it. |
|
| 1142 |
+ */ |
|
| 1143 |
+ public function setDebugOutput($method = 'echo') |
|
| 1144 |
+ {
|
|
| 1145 |
+ $this->Debugoutput = $method; |
|
| 1146 |
+ } |
|
| 1147 |
+ |
|
| 1148 |
+ /** |
|
| 1149 |
+ * Get debug output method. |
|
| 1150 |
+ * @return string |
|
| 1151 |
+ */ |
|
| 1152 |
+ public function getDebugOutput() |
|
| 1153 |
+ {
|
|
| 1154 |
+ return $this->Debugoutput; |
|
| 1155 |
+ } |
|
| 1156 |
+ |
|
| 1157 |
+ /** |
|
| 1158 |
+ * Set debug output level. |
|
| 1159 |
+ * @param integer $level |
|
| 1160 |
+ */ |
|
| 1161 |
+ public function setDebugLevel($level = 0) |
|
| 1162 |
+ {
|
|
| 1163 |
+ $this->do_debug = $level; |
|
| 1164 |
+ } |
|
| 1165 |
+ |
|
| 1166 |
+ /** |
|
| 1167 |
+ * Get debug output level. |
|
| 1168 |
+ * @return integer |
|
| 1169 |
+ */ |
|
| 1170 |
+ public function getDebugLevel() |
|
| 1171 |
+ {
|
|
| 1172 |
+ return $this->do_debug; |
|
| 1173 |
+ } |
|
| 1174 |
+ |
|
| 1175 |
+ /** |
|
| 1176 |
+ * Set SMTP timeout. |
|
| 1177 |
+ * @param integer $timeout |
|
| 1178 |
+ */ |
|
| 1179 |
+ public function setTimeout($timeout = 0) |
|
| 1180 |
+ {
|
|
| 1181 |
+ $this->Timeout = $timeout; |
|
| 1182 |
+ } |
|
| 1183 |
+ |
|
| 1184 |
+ /** |
|
| 1185 |
+ * Get SMTP timeout. |
|
| 1186 |
+ * @return integer |
|
| 1187 |
+ */ |
|
| 1188 |
+ public function getTimeout() |
|
| 1189 |
+ {
|
|
| 1190 |
+ return $this->Timeout; |
|
| 1191 |
+ } |
|
| 1192 |
+} |
| ... | ... |
@@ -53,12 +53,12 @@ function sendemail($to_name,$to_email,$from_name,$from_email,$subject,$message,$ |
| 53 | 53 |
// Try to determine the right $type setting |
| 54 | 54 |
if(strpos($message, "<br>") || strpos($message, "</p>") || strpos($message, "<br />") || strpos($message, "<br>") || strpos($message, "<a href")) $type = "html"; |
| 55 | 55 |
|
| 56 |
- require_once(_BASEDIR."includes/phpmailer_include.php"); |
|
| 57 |
- $mail = new PHPMailer( ); |
|
| 58 |
- if(file_exists("languages/mailer/phpmailer.lang-".$language.".php"))
|
|
| 59 |
- $mail->SetLanguage($language, "language/mailer/"); |
|
| 56 |
+ require_once(_BASEDIR."includes/PHPMailerAutoload.php"); |
|
| 57 |
+ $mail = new PHPMailer; |
|
| 58 |
+ if(file_exists(_BASEDIR."languages/mailer/phpmailer.lang-".$language.".php")) |
|
| 59 |
+ $mail->SetLanguage($language, _BASEDIR."languages/mailer/"); |
|
| 60 | 60 |
else |
| 61 |
- $mail->SetLanguage("en", "language/mailer/");
|
|
| 61 |
+ $mail->SetLanguage("en", _BASEDIR."languages/mailer/");
|
|
| 62 | 62 |
|
| 63 | 63 |
if(!$smtp_host) {
|
| 64 | 64 |
$mail->IsMail( ); |
| 66 | 66 |
deleted file mode 100644 |
| ... | ... |
@@ -1,23 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
-/** |
|
| 3 |
- * PHPMailer language file. |
|
| 4 |
- * English Version |
|
| 5 |
- */ |
|
| 6 |
- |
|
| 7 |
-$PHPMAILER_LANG = array(); |
|
| 8 |
- |
|
| 9 |
-$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . |
|
| 10 |
- 'recipient email address.'; |
|
| 11 |
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.'; |
|
| 12 |
-$PHPMAILER_LANG["execute"] = 'Could not execute: '; |
|
| 13 |
-$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.'; |
|
| 14 |
-$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.'; |
|
| 15 |
-$PHPMAILER_LANG["from_failed"] = 'The following From address failed: '; |
|
| 16 |
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . |
|
| 17 |
- 'recipients failed: '; |
|
| 18 |
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.'; |
|
| 19 |
-$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.'; |
|
| 20 |
-$PHPMAILER_LANG["file_access"] = 'Could not access file: '; |
|
| 21 |
-$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: '; |
|
| 22 |
-$PHPMAILER_LANG["encoding"] = 'Unknown encoding: '; |
|
| 23 |
-?> |
| 24 | 0 |
deleted file mode 100644 |
| ... | ... |
@@ -1,1501 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
-if(!defined("_CHARSET")) exit( );
|
|
| 3 |
-//////////////////////////////////////////////////// |
|
| 4 |
-// PHPMailer - PHP email class |
|
| 5 |
-// |
|
| 6 |
-// Class for sending email using either |
|
| 7 |
-// sendmail, PHP mail(), or SMTP. Methods are |
|
| 8 |
-// based upon the standard AspEmail(tm) classes. |
|
| 9 |
-// |
|
| 10 |
-// Copyright (C) 2001 - 2003 Brent R. Matzelle |
|
| 11 |
-// |
|
| 12 |
-// License: LGPL, see LICENSE |
|
| 13 |
-//////////////////////////////////////////////////// |
|
| 14 |
- |
|
| 15 |
-/** |
|
| 16 |
- * PHPMailer - PHP email transport class |
|
| 17 |
- * @package PHPMailer |
|
| 18 |
- * @author Brent R. Matzelle |
|
| 19 |
- * @copyright 2001 - 2003 Brent R. Matzelle |
|
| 20 |
- */ |
|
| 21 |
-class PHPMailer |
|
| 22 |
-{
|
|
| 23 |
- |
|
| 24 |
- ///////////////////////////////////////////////// |
|
| 25 |
- // PUBLIC VARIABLES |
|
| 26 |
- ///////////////////////////////////////////////// |
|
| 27 |
- |
|
| 28 |
- /** |
|
| 29 |
- * Email priority (1 = High, 3 = Normal, 5 = low). |
|
| 30 |
- * @var int |
|
| 31 |
- */ |
|
| 32 |
- var $Priority = 3; |
|
| 33 |
- |
|
| 34 |
- /** |
|
| 35 |
- * Sets the CharSet of the message. |
|
| 36 |
- * @var string |
|
| 37 |
- */ |
|
| 38 |
- var $CharSet = "iso-8859-1"; |
|
| 39 |
- |
|
| 40 |
- /** |
|
| 41 |
- * Sets the Content-type of the message. |
|
| 42 |
- * @var string |
|
| 43 |
- */ |
|
| 44 |
- var $ContentType = "text/plain"; |
|
| 45 |
- |
|
| 46 |
- /** |
|
| 47 |
- * Sets the Encoding of the message. Options for this are "8bit", |
|
| 48 |
- * "7bit", "binary", "base64", and "quoted-printable". |
|
| 49 |
- * @var string |
|
| 50 |
- */ |
|
| 51 |
- var $Encoding = "8bit"; |
|
| 52 |
- |
|
| 53 |
- /** |
|
| 54 |
- * Holds the most recent mailer error message. |
|
| 55 |
- * @var string |
|
| 56 |
- */ |
|
| 57 |
- var $ErrorInfo = ""; |
|
| 58 |
- |
|
| 59 |
- /** |
|
| 60 |
- * Sets the From email address for the message. |
|
| 61 |
- * @var string |
|
| 62 |
- */ |
|
| 63 |
- var $From = "root@localhost"; |
|
| 64 |
- |
|
| 65 |
- /** |
|
| 66 |
- * Sets the From name of the message. |
|
| 67 |
- * @var string |
|
| 68 |
- */ |
|
| 69 |
- var $FromName = "Root User"; |
|
| 70 |
- |
|
| 71 |
- /** |
|
| 72 |
- * Sets the Sender email (Return-Path) of the message. If not empty, |
|
| 73 |
- * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. |
|
| 74 |
- * @var string |
|
| 75 |
- */ |
|
| 76 |
- var $Sender = ""; |
|
| 77 |
- |
|
| 78 |
- /** |
|
| 79 |
- * Sets the Subject of the message. |
|
| 80 |
- * @var string |
|
| 81 |
- */ |
|
| 82 |
- var $Subject = ""; |
|
| 83 |
- |
|
| 84 |
- /** |
|
| 85 |
- * Sets the Body of the message. This can be either an HTML or text body. |
|
| 86 |
- * If HTML then run IsHTML(true). |
|
| 87 |
- * @var string |
|
| 88 |
- */ |
|
| 89 |
- var $Body = ""; |
|
| 90 |
- |
|
| 91 |
- /** |
|
| 92 |
- * Sets the text-only body of the message. This automatically sets the |
|
| 93 |
- * email to multipart/alternative. This body can be read by mail |
|
| 94 |
- * clients that do not have HTML email capability such as mutt. Clients |
|
| 95 |
- * that can read HTML will view the normal Body. |
|
| 96 |
- * @var string |
|
| 97 |
- */ |
|
| 98 |
- var $AltBody = ""; |
|
| 99 |
- |
|
| 100 |
- /** |
|
| 101 |
- * Sets word wrapping on the body of the message to a given number of |
|
| 102 |
- * characters. |
|
| 103 |
- * @var int |
|
| 104 |
- */ |
|
| 105 |
- var $WordWrap = 0; |
|
| 106 |
- |
|
| 107 |
- /** |
|
| 108 |
- * Method to send mail: ("mail", "sendmail", or "smtp").
|
|
| 109 |
- * @var string |
|
| 110 |
- */ |
|
| 111 |
- var $Mailer = "mail"; |
|
| 112 |
- |
|
| 113 |
- /** |
|
| 114 |
- * Sets the path of the sendmail program. |
|
| 115 |
- * @var string |
|
| 116 |
- */ |
|
| 117 |
- var $Sendmail = "/usr/sbin/sendmail"; |
|
| 118 |
- |
|
| 119 |
- /** |
|
| 120 |
- * Path to PHPMailer plugins. This is now only useful if the SMTP class |
|
| 121 |
- * is in a different directory than the PHP include path. |
|
| 122 |
- * @var string |
|
| 123 |
- */ |
|
| 124 |
- var $PluginDir = ""; |
|
| 125 |
- |
|
| 126 |
- /** |
|
| 127 |
- * Holds PHPMailer version. |
|
| 128 |
- * @var string |
|
| 129 |
- */ |
|
| 130 |
- var $Version = "1.73"; |
|
| 131 |
- |
|
| 132 |
- /** |
|
| 133 |
- * Sets the email address that a reading confirmation will be sent. |
|
| 134 |
- * @var string |
|
| 135 |
- */ |
|
| 136 |
- var $ConfirmReadingTo = ""; |
|
| 137 |
- |
|
| 138 |
- /** |
|
| 139 |
- * Sets the hostname to use in Message-Id and Received headers |
|
| 140 |
- * and as default HELO string. If empty, the value returned |
|
| 141 |
- * by SERVER_NAME is used or 'localhost.localdomain'. |
|
| 142 |
- * @var string |
|
| 143 |
- */ |
|
| 144 |
- var $Hostname = ""; |
|
| 145 |
- |
|
| 146 |
- ///////////////////////////////////////////////// |
|
| 147 |
- // SMTP VARIABLES |
|
| 148 |
- ///////////////////////////////////////////////// |
|
| 149 |
- |
|
| 150 |
- /** |
|
| 151 |
- * Sets the SMTP hosts. All hosts must be separated by a |
|
| 152 |
- * semicolon. You can also specify a different port |
|
| 153 |
- * for each host by using this format: [hostname:port] |
|
| 154 |
- * (e.g. "smtp1.example.com:25;smtp2.example.com"). |
|
| 155 |
- * Hosts will be tried in order. |
|
| 156 |
- * @var string |
|
| 157 |
- */ |
|
| 158 |
- var $Host = "localhost"; |
|
| 159 |
- |
|
| 160 |
- /** |
|
| 161 |
- * Sets the default SMTP server port. |
|
| 162 |
- * @var int |
|
| 163 |
- */ |
|
| 164 |
- var $Port = 25; |
|
| 165 |
- |
|
| 166 |
- /** |
|
| 167 |
- * Sets the SMTP HELO of the message (Default is $Hostname). |
|
| 168 |
- * @var string |
|
| 169 |
- */ |
|
| 170 |
- var $Helo = ""; |
|
| 171 |
- |
|
| 172 |
- /** |
|
| 173 |
- * Sets SMTP authentication. Utilizes the Username and Password variables. |
|
| 174 |
- * @var bool |
|
| 175 |
- */ |
|
| 176 |
- var $SMTPAuth = false; |
|
| 177 |
- |
|
| 178 |
- /** |
|
| 179 |
- * Sets SMTP username. |
|
| 180 |
- * @var string |
|
| 181 |
- */ |
|
| 182 |
- var $Username = ""; |
|
| 183 |
- |
|
| 184 |
- /** |
|
| 185 |
- * Sets SMTP password. |
|
| 186 |
- * @var string |
|
| 187 |
- */ |
|
| 188 |
- var $Password = ""; |
|
| 189 |
- |
|
| 190 |
- /** |
|
| 191 |
- * Sets the SMTP server timeout in seconds. This function will not |
|
| 192 |
- * work with the win32 version. |
|
| 193 |
- * @var int |
|
| 194 |
- */ |
|
| 195 |
- var $Timeout = 10; |
|
| 196 |
- |
|
| 197 |
- /** |
|
| 198 |
- * Sets SMTP class debugging on or off. |
|
| 199 |
- * @var bool |
|
| 200 |
- */ |
|
| 201 |
- var $SMTPDebug = false; |
|
| 202 |
- |
|
| 203 |
- /** |
|
| 204 |
- * Prevents the SMTP connection from being closed after each mail |
|
| 205 |
- * sending. If this is set to true then to close the connection |
|
| 206 |
- * requires an explicit call to SmtpClose(). |
|
| 207 |
- * @var bool |
|
| 208 |
- */ |
|
| 209 |
- var $SMTPKeepAlive = false; |
|
| 210 |
- |
|
| 211 |
- /**#@+ |
|
| 212 |
- * @access private |
|
| 213 |
- */ |
|
| 214 |
- var $smtp = NULL; |
|
| 215 |
- var $to = array(); |
|
| 216 |
- var $cc = array(); |
|
| 217 |
- var $bcc = array(); |
|
| 218 |
- var $ReplyTo = array(); |
|
| 219 |
- var $attachment = array(); |
|
| 220 |
- var $CustomHeader = array(); |
|
| 221 |
- var $message_type = ""; |
|
| 222 |
- var $boundary = array(); |
|
| 223 |
- var $language = array(); |
|
| 224 |
- var $error_count = 0; |
|
| 225 |
- var $LE = "\n"; |
|
| 226 |
- /**#@-*/ |
|
| 227 |
- |
|
| 228 |
- ///////////////////////////////////////////////// |
|
| 229 |
- // VARIABLE METHODS |
|
| 230 |
- ///////////////////////////////////////////////// |
|
| 231 |
- |
|
| 232 |
- /** |
|
| 233 |
- * Sets message type to HTML. |
|
| 234 |
- * @param bool $bool |
|
| 235 |
- * @return void |
|
| 236 |
- */ |
|
| 237 |
- function IsHTML($bool) {
|
|
| 238 |
- if($bool == true) |
|
| 239 |
- $this->ContentType = "text/html"; |
|
| 240 |
- else |
|
| 241 |
- $this->ContentType = "text/plain"; |
|
| 242 |
- } |
|
| 243 |
- |
|
| 244 |
- /** |
|
| 245 |
- * Sets Mailer to send message using SMTP. |
|
| 246 |
- * @return void |
|
| 247 |
- */ |
|
| 248 |
- function IsSMTP() {
|
|
| 249 |
- $this->Mailer = "smtp"; |
|
| 250 |
- } |
|
| 251 |
- |
|
| 252 |
- /** |
|
| 253 |
- * Sets Mailer to send message using PHP mail() function. |
|
| 254 |
- * @return void |
|
| 255 |
- */ |
|
| 256 |
- function IsMail() {
|
|
| 257 |
- $this->Mailer = "mail"; |
|
| 258 |
- } |
|
| 259 |
- |
|
| 260 |
- /** |
|
| 261 |
- * Sets Mailer to send message using the $Sendmail program. |
|
| 262 |
- * @return void |
|
| 263 |
- */ |
|
| 264 |
- function IsSendmail() {
|
|
| 265 |
- $this->Mailer = "sendmail"; |
|
| 266 |
- } |
|
| 267 |
- |
|
| 268 |
- /** |
|
| 269 |
- * Sets Mailer to send message using the qmail MTA. |
|
| 270 |
- * @return void |
|
| 271 |
- */ |
|
| 272 |
- function IsQmail() {
|
|
| 273 |
- $this->Sendmail = "/var/qmail/bin/sendmail"; |
|
| 274 |
- $this->Mailer = "sendmail"; |
|
| 275 |
- } |
|
| 276 |
- |
|
| 277 |
- |
|
| 278 |
- ///////////////////////////////////////////////// |
|
| 279 |
- // RECIPIENT METHODS |
|
| 280 |
- ///////////////////////////////////////////////// |
|
| 281 |
- |
|
| 282 |
- /** |
|
| 283 |
- * Adds a "To" address. |
|
| 284 |
- * @param string $address |
|
| 285 |
- * @param string $name |
|
| 286 |
- * @return void |
|
| 287 |
- */ |
|
| 288 |
- function AddAddress($address, $name = "") {
|
|
| 289 |
- $cur = count($this->to); |
|
| 290 |
- $this->to[$cur][0] = trim($address); |
|
| 291 |
- $this->to[$cur][1] = $name; |
|
| 292 |
- } |
|
| 293 |
- |
|
| 294 |
- /** |
|
| 295 |
- * Adds a "Cc" address. Note: this function works |
|
| 296 |
- * with the SMTP mailer on win32, not with the "mail" |
|
| 297 |
- * mailer. |
|
| 298 |
- * @param string $address |
|
| 299 |
- * @param string $name |
|
| 300 |
- * @return void |
|
| 301 |
- */ |
|
| 302 |
- function AddCC($address, $name = "") {
|
|
| 303 |
- $cur = count($this->cc); |
|
| 304 |
- $this->cc[$cur][0] = trim($address); |
|
| 305 |
- $this->cc[$cur][1] = $name; |
|
| 306 |
- } |
|
| 307 |
- |
|
| 308 |
- /** |
|
| 309 |
- * Adds a "Bcc" address. Note: this function works |
|
| 310 |
- * with the SMTP mailer on win32, not with the "mail" |
|
| 311 |
- * mailer. |
|
| 312 |
- * @param string $address |
|
| 313 |
- * @param string $name |
|
| 314 |
- * @return void |
|
| 315 |
- */ |
|
| 316 |
- function AddBCC($address, $name = "") {
|
|
| 317 |
- $cur = count($this->bcc); |
|
| 318 |
- $this->bcc[$cur][0] = trim($address); |
|
| 319 |
- $this->bcc[$cur][1] = $name; |
|
| 320 |
- } |
|
| 321 |
- |
|
| 322 |
- /** |
|
| 323 |
- * Adds a "Reply-to" address. |
|
| 324 |
- * @param string $address |
|
| 325 |
- * @param string $name |
|
| 326 |
- * @return void |
|
| 327 |
- */ |
|
| 328 |
- function AddReplyTo($address, $name = "") {
|
|
| 329 |
- $cur = count($this->ReplyTo); |
|
| 330 |
- $this->ReplyTo[$cur][0] = trim($address); |
|
| 331 |
- $this->ReplyTo[$cur][1] = $name; |
|
| 332 |
- } |
|
| 333 |
- |
|
| 334 |
- |
|
| 335 |
- ///////////////////////////////////////////////// |
|
| 336 |
- // MAIL SENDING METHODS |
|
| 337 |
- ///////////////////////////////////////////////// |
|
| 338 |
- |
|
| 339 |
- /** |
|
| 340 |
- * Creates message and assigns Mailer. If the message is |
|
| 341 |
- * not sent successfully then it returns false. Use the ErrorInfo |
|
| 342 |
- * variable to view description of the error. |
|
| 343 |
- * @return bool |
|
| 344 |
- */ |
|
| 345 |
- function Send() {
|
|
| 346 |
- $header = ""; |
|
| 347 |
- $body = ""; |
|
| 348 |
- $result = true; |
|
| 349 |
- |
|
| 350 |
- if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) |
|
| 351 |
- {
|
|
| 352 |
- $this->SetError($this->Lang("provide_address"));
|
|
| 353 |
- return false; |
|
| 354 |
- } |
|
| 355 |
- |
|
| 356 |
- // Set whether the message is multipart/alternative |
|
| 357 |
- if(!empty($this->AltBody)) |
|
| 358 |
- $this->ContentType = "multipart/alternative"; |
|
| 359 |
- |
|
| 360 |
- $this->error_count = 0; // reset errors |
|
| 361 |
- $this->SetMessageType(); |
|
| 362 |
- $header .= $this->CreateHeader(); |
|
| 363 |
- $body = $this->CreateBody(); |
|
| 364 |
- |
|
| 365 |
- if($body == "") { return false; }
|
|
| 366 |
- |
|
| 367 |
- // Choose the mailer |
|
| 368 |
- switch($this->Mailer) |
|
| 369 |
- {
|
|
| 370 |
- case "sendmail": |
|
| 371 |
- $result = $this->SendmailSend($header, $body); |
|
| 372 |
- break; |
|
| 373 |
- case "mail": |
|
| 374 |
- $result = $this->MailSend($header, $body); |
|
| 375 |
- break; |
|
| 376 |
- case "smtp": |
|
| 377 |
- $result = $this->SmtpSend($header, $body); |
|
| 378 |
- break; |
|
| 379 |
- default: |
|
| 380 |
- $this->SetError($this->Mailer . $this->Lang("mailer_not_supported"));
|
|
| 381 |
- $result = false; |
|
| 382 |
- break; |
|
| 383 |
- } |
|
| 384 |
- |
|
| 385 |
- return $result; |
|
| 386 |
- } |
|
| 387 |
- |
|
| 388 |
- /** |
|
| 389 |
- * Sends mail using the $Sendmail program. |
|
| 390 |
- * @access private |
|
| 391 |
- * @return bool |
|
| 392 |
- */ |
|
| 393 |
- function SendmailSend($header, $body) {
|
|
| 394 |
- if ($this->Sender != "") |
|
| 395 |
- $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
|
|
| 396 |
- else |
|
| 397 |
- $sendmail = sprintf("%s -oi -t", $this->Sendmail);
|
|
| 398 |
- |
|
| 399 |
- if(!@$mail = popen($sendmail, "w")) |
|
| 400 |
- {
|
|
| 401 |
- $this->SetError($this->Lang("execute") . $this->Sendmail);
|
|
| 402 |
- return false; |
|
| 403 |
- } |
|
| 404 |
- |
|
| 405 |
- fputs($mail, $header); |
|
| 406 |
- fputs($mail, $body); |
|
| 407 |
- |
|
| 408 |
- $result = pclose($mail) >> 8 & 0xFF; |
|
| 409 |
- if($result != 0) |
|
| 410 |
- {
|
|
| 411 |
- $this->SetError($this->Lang("execute") . $this->Sendmail);
|
|
| 412 |
- return false; |
|
| 413 |
- } |
|
| 414 |
- |
|
| 415 |
- return true; |
|
| 416 |
- } |
|
| 417 |
- |
|
| 418 |
- /** |
|
| 419 |
- * Sends mail using the PHP mail() function. |
|
| 420 |
- * @access private |
|
| 421 |
- * @return bool |
|
| 422 |
- */ |
|
| 423 |
- function MailSend($header, $body) {
|
|
| 424 |
- $to = ""; |
|
| 425 |
- for($i = 0; $i < count($this->to); $i++) |
|
| 426 |
- {
|
|
| 427 |
- if($i != 0) { $to .= ", "; }
|
|
| 428 |
- $to .= $this->to[$i][0]; |
|
| 429 |
- } |
|
| 430 |
- |
|
| 431 |
- if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
|
|
| 432 |
- {
|
|
| 433 |
- $old_from = ini_get("sendmail_from");
|
|
| 434 |
- ini_set("sendmail_from", $this->Sender);
|
|
| 435 |
- $params = sprintf("-oi -f %s", $this->Sender);
|
|
| 436 |
- $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, |
|
| 437 |
- $header, $params); |
|
| 438 |
- } |
|
| 439 |
- else |
|
| 440 |
- $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header); |
|
| 441 |
- |
|
| 442 |
- if (isset($old_from)) |
|
| 443 |
- ini_set("sendmail_from", $old_from);
|
|
| 444 |
- |
|
| 445 |
- if(!$rt) |
|
| 446 |
- {
|
|
| 447 |
- $this->SetError($this->Lang("instantiate"));
|
|
| 448 |
- return false; |
|
| 449 |
- } |
|
| 450 |
- |
|
| 451 |
- return true; |
|
| 452 |
- } |
|
| 453 |
- |
|
| 454 |
- /** |
|
| 455 |
- * Sends mail via SMTP using PhpSMTP (Author: |
|
| 456 |
- * Chris Ryan). Returns bool. Returns false if there is a |
|
| 457 |
- * bad MAIL FROM, RCPT, or DATA input. |
|
| 458 |
- * @access private |
|
| 459 |
- * @return bool |
|
| 460 |
- */ |
|
| 461 |
- function SmtpSend($header, $body) {
|
|
| 462 |
- include_once(_BASEDIR."includes/smtp_include.php"); |
|
| 463 |
- $error = ""; |
|
| 464 |
- $bad_rcpt = array(); |
|
| 465 |
- |
|
| 466 |
- if(!$this->SmtpConnect()) |
|
| 467 |
- return false; |
|
| 468 |
- |
|
| 469 |
- $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender; |
|
| 470 |
- if(!$this->smtp->Mail($smtp_from)) |
|
| 471 |
- {
|
|
| 472 |
- $error = $this->Lang("from_failed") . $smtp_from;
|
|
| 473 |
- $this->SetError($error); |
|
| 474 |
- $this->smtp->Reset(); |
|
| 475 |
- return false; |
|
| 476 |
- } |
|
| 477 |
- |
|
| 478 |
- // Attempt to send attach all recipients |
|
| 479 |
- for($i = 0; $i < count($this->to); $i++) |
|
| 480 |
- {
|
|
| 481 |
- if(!$this->smtp->Recipient($this->to[$i][0])) |
|
| 482 |
- $bad_rcpt[] = $this->to[$i][0]; |
|
| 483 |
- } |
|
| 484 |
- for($i = 0; $i < count($this->cc); $i++) |
|
| 485 |
- {
|
|
| 486 |
- if(!$this->smtp->Recipient($this->cc[$i][0])) |
|
| 487 |
- $bad_rcpt[] = $this->cc[$i][0]; |
|
| 488 |
- } |
|
| 489 |
- for($i = 0; $i < count($this->bcc); $i++) |
|
| 490 |
- {
|
|
| 491 |
- if(!$this->smtp->Recipient($this->bcc[$i][0])) |
|
| 492 |
- $bad_rcpt[] = $this->bcc[$i][0]; |
|
| 493 |
- } |
|
| 494 |
- |
|
| 495 |
- if(count($bad_rcpt) > 0) // Create error message |
|
| 496 |
- {
|
|
| 497 |
- for($i = 0; $i < count($bad_rcpt); $i++) |
|
| 498 |
- {
|
|
| 499 |
- if($i != 0) { $error .= ", "; }
|
|
| 500 |
- $error .= $bad_rcpt[$i]; |
|
| 501 |
- } |
|
| 502 |
- $error = $this->Lang("recipients_failed") . $error;
|
|
| 503 |
- $this->SetError($error); |
|
| 504 |
- $this->smtp->Reset(); |
|
| 505 |
- return false; |
|
| 506 |
- } |
|
| 507 |
- |
|
| 508 |
- if(!$this->smtp->Data($header . $body)) |
|
| 509 |
- {
|
|
| 510 |
- $this->SetError($this->Lang("data_not_accepted"));
|
|
| 511 |
- $this->smtp->Reset(); |
|
| 512 |
- return false; |
|
| 513 |
- } |
|
| 514 |
- if($this->SMTPKeepAlive == true) |
|
| 515 |
- $this->smtp->Reset(); |
|
| 516 |
- else |
|
| 517 |
- $this->SmtpClose(); |
|
| 518 |
- |
|
| 519 |
- return true; |
|
| 520 |
- } |
|
| 521 |
- |
|
| 522 |
- /** |
|
| 523 |
- * Initiates a connection to an SMTP server. Returns false if the |
|
| 524 |
- * operation failed. |
|
| 525 |
- * @access private |
|
| 526 |
- * @return bool |
|
| 527 |
- */ |
|
| 528 |
- function SmtpConnect() {
|
|
| 529 |
- if($this->smtp == NULL) { $this->smtp = new SMTP(); }
|
|
| 530 |
- |
|
| 531 |
- $this->smtp->do_debug = $this->SMTPDebug; |
|
| 532 |
- $hosts = explode(";", $this->Host);
|
|
| 533 |
- $index = 0; |
|
| 534 |
- $connection = ($this->smtp->Connected()); |
|
| 535 |
- |
|
| 536 |
- // Retry while there is no connection |
|
| 537 |
- while($index < count($hosts) && $connection == false) |
|
| 538 |
- {
|
|
| 539 |
- if(strstr($hosts[$index], ":")) |
|
| 540 |
- list($host, $port) = explode(":", $hosts[$index]);
|
|
| 541 |
- else |
|
| 542 |
- {
|
|
| 543 |
- $host = $hosts[$index]; |
|
| 544 |
- $port = $this->Port; |
|
| 545 |
- } |
|
| 546 |
- |
|
| 547 |
- if($this->smtp->Connect($host, $port, $this->Timeout)) |
|
| 548 |
- {
|
|
| 549 |
- if ($this->Helo != '') |
|
| 550 |
- $this->smtp->Hello($this->Helo); |
|
| 551 |
- else |
|
| 552 |
- $this->smtp->Hello($this->ServerHostname()); |
|
| 553 |
- |
|
| 554 |
- if($this->SMTPAuth) |
|
| 555 |
- {
|
|
| 556 |
- if(!$this->smtp->Authenticate($this->Username, |
|
| 557 |
- $this->Password)) |
|
| 558 |
- {
|
|
| 559 |
- $this->SetError($this->Lang("authenticate"));
|
|
| 560 |
- $this->smtp->Reset(); |
|
| 561 |
- $connection = false; |
|
| 562 |
- } |
|
| 563 |
- } |
|
| 564 |
- $connection = true; |
|
| 565 |
- } |
|
| 566 |
- $index++; |
|
| 567 |
- } |
|
| 568 |
- if(!$connection) |
|
| 569 |
- $this->SetError($this->Lang("connect_host"));
|
|
| 570 |
- |
|
| 571 |
- return $connection; |
|
| 572 |
- } |
|
| 573 |
- |
|
| 574 |
- /** |
|
| 575 |
- * Closes the active SMTP session if one exists. |
|
| 576 |
- * @return void |
|
| 577 |
- */ |
|
| 578 |
- function SmtpClose() {
|
|
| 579 |
- if($this->smtp != NULL) |
|
| 580 |
- {
|
|
| 581 |
- if($this->smtp->Connected()) |
|
| 582 |
- {
|
|
| 583 |
- $this->smtp->Quit(); |
|
| 584 |
- $this->smtp->Close(); |
|
| 585 |
- } |
|
| 586 |
- } |
|
| 587 |
- } |
|
| 588 |
- |
|
| 589 |
- /** |
|
| 590 |
- * Sets the language for all class error messages. Returns false |
|
| 591 |
- * if it cannot load the language file. The default language type |
|
| 592 |
- * is English. |
|
| 593 |
- * @param string $lang_type Type of language (e.g. Portuguese: "br") |
|
| 594 |
- * @param string $lang_path Path to the language file directory |
|
| 595 |
- * @access public |
|
| 596 |
- * @return bool |
|
| 597 |
- */ |
|
| 598 |
- function SetLanguage($lang_type, $lang_path = "language/") {
|
|
| 599 |
- if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) |
|
| 600 |
- include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); |
|
| 601 |
- else if(file_exists($lang_path.'phpmailer.lang-en.php')) |
|
| 602 |
- include($lang_path.'phpmailer.lang-en.php'); |
|
| 603 |
- else |
|
| 604 |
- {
|
|
| 605 |
- $this->SetError("Could not load language file");
|
|
| 606 |
- return false; |
|
| 607 |
- } |
|
| 608 |
- $this->language = $PHPMAILER_LANG; |
|
| 609 |
- |
|
| 610 |
- return true; |
|
| 611 |
- } |
|
| 612 |
- |
|
| 613 |
- ///////////////////////////////////////////////// |
|
| 614 |
- // MESSAGE CREATION METHODS |
|
| 615 |
- ///////////////////////////////////////////////// |
|
| 616 |
- |
|
| 617 |
- /** |
|
| 618 |
- * Creates recipient headers. |
|
| 619 |
- * @access private |
|
| 620 |
- * @return string |
|
| 621 |
- */ |
|
| 622 |
- function AddrAppend($type, $addr) {
|
|
| 623 |
- $addr_str = $type . ": "; |
|
| 624 |
- $addr_str .= $this->AddrFormat($addr[0]); |
|
| 625 |
- if(count($addr) > 1) |
|
| 626 |
- {
|
|
| 627 |
- for($i = 1; $i < count($addr); $i++) |
|
| 628 |
- $addr_str .= ", " . $this->AddrFormat($addr[$i]); |
|
| 629 |
- } |
|
| 630 |
- $addr_str .= $this->LE; |
|
| 631 |
- |
|
| 632 |
- return $addr_str; |
|
| 633 |
- } |
|
| 634 |
- |
|
| 635 |
- /** |
|
| 636 |
- * Formats an address correctly. |
|
| 637 |
- * @access private |
|
| 638 |
- * @return string |
|
| 639 |
- */ |
|
| 640 |
- function AddrFormat($addr) {
|
|
| 641 |
- if(empty($addr[1])) |
|
| 642 |
- $formatted = $addr[0]; |
|
| 643 |
- else |
|
| 644 |
- {
|
|
| 645 |
- $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . |
|
| 646 |
- $addr[0] . ">"; |
|
| 647 |
- } |
|
| 648 |
- |
|
| 649 |
- return $formatted; |
|
| 650 |
- } |
|
| 651 |
- |
|
| 652 |
- /** |
|
| 653 |
- * Wraps message for use with mailers that do not |
|
| 654 |
- * automatically perform wrapping and for quoted-printable. |
|
| 655 |
- * Original written by philippe. |
|
| 656 |
- * @access private |
|
| 657 |
- * @return string |
|
| 658 |
- */ |
|
| 659 |
- function WrapText($message, $length, $qp_mode = false) {
|
|
| 660 |
- $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
|
|
| 661 |
- |
|
| 662 |
- $message = $this->FixEOL($message); |
|
| 663 |
- if (substr($message, -1) == $this->LE) |
|
| 664 |
- $message = substr($message, 0, -1); |
|
| 665 |
- |
|
| 666 |
- $line = explode($this->LE, $message); |
|
| 667 |
- $message = ""; |
|
| 668 |
- for ($i=0 ;$i < count($line); $i++) |
|
| 669 |
- {
|
|
| 670 |
- $line_part = explode(" ", $line[$i]);
|
|
| 671 |
- $buf = ""; |
|
| 672 |
- for ($e = 0; $e<count($line_part); $e++) |
|
| 673 |
- {
|
|
| 674 |
- $word = $line_part[$e]; |
|
| 675 |
- if ($qp_mode and (strlen($word) > $length)) |
|
| 676 |
- {
|
|
| 677 |
- $space_left = $length - strlen($buf) - 1; |
|
| 678 |
- if ($e != 0) |
|
| 679 |
- {
|
|
| 680 |
- if ($space_left > 20) |
|
| 681 |
- {
|
|
| 682 |
- $len = $space_left; |
|
| 683 |
- if (substr($word, $len - 1, 1) == "=") |
|
| 684 |
- $len--; |
|
| 685 |
- elseif (substr($word, $len - 2, 1) == "=") |
|
| 686 |
- $len -= 2; |
|
| 687 |
- $part = substr($word, 0, $len); |
|
| 688 |
- $word = substr($word, $len); |
|
| 689 |
- $buf .= " " . $part; |
|
| 690 |
- $message .= $buf . sprintf("=%s", $this->LE);
|
|
| 691 |
- } |
|
| 692 |
- else |
|
| 693 |
- {
|
|
| 694 |
- $message .= $buf . $soft_break; |
|
| 695 |
- } |
|
| 696 |
- $buf = ""; |
|
| 697 |
- } |
|
| 698 |
- while (strlen($word) > 0) |
|
| 699 |
- {
|
|
| 700 |
- $len = $length; |
|
| 701 |
- if (substr($word, $len - 1, 1) == "=") |
|
| 702 |
- $len--; |
|
| 703 |
- elseif (substr($word, $len - 2, 1) == "=") |
|
| 704 |
- $len -= 2; |
|
| 705 |
- $part = substr($word, 0, $len); |
|
| 706 |
- $word = substr($word, $len); |
|
| 707 |
- |
|
| 708 |
- if (strlen($word) > 0) |
|
| 709 |
- $message .= $part . sprintf("=%s", $this->LE);
|
|
| 710 |
- else |
|
| 711 |
- $buf = $part; |
|
| 712 |
- } |
|
| 713 |
- } |
|
| 714 |
- else |
|
| 715 |
- {
|
|
| 716 |
- $buf_o = $buf; |
|
| 717 |
- $buf .= ($e == 0) ? $word : (" " . $word);
|
|
| 718 |
- |
|
| 719 |
- if (strlen($buf) > $length and $buf_o != "") |
|
| 720 |
- {
|
|
| 721 |
- $message .= $buf_o . $soft_break; |
|
| 722 |
- $buf = $word; |
|
| 723 |
- } |
|
| 724 |
- } |
|
| 725 |
- } |
|
| 726 |
- $message .= $buf . $this->LE; |
|
| 727 |
- } |
|
| 728 |
- |
|
| 729 |
- return $message; |
|
| 730 |
- } |
|
| 731 |
- |
|
| 732 |
- /** |
|
| 733 |
- * Set the body wrapping. |
|
| 734 |
- * @access private |
|
| 735 |
- * @return void |
|
| 736 |
- */ |
|
| 737 |
- function SetWordWrap() {
|
|
| 738 |
- if($this->WordWrap < 1) |
|
| 739 |
- return; |
|
| 740 |
- |
|
| 741 |
- switch($this->message_type) |
|
| 742 |
- {
|
|
| 743 |
- case "alt": |
|
| 744 |
- // fall through |
|
| 745 |
- case "alt_attachments": |
|
| 746 |
- $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); |
|
| 747 |
- break; |
|
| 748 |
- default: |
|
| 749 |
- $this->Body = $this->WrapText($this->Body, $this->WordWrap); |
|
| 750 |
- break; |
|
| 751 |
- } |
|
| 752 |
- } |
|
| 753 |
- |
|
| 754 |
- /** |
|
| 755 |
- * Assembles message header. |
|
| 756 |
- * @access private |
|
| 757 |
- * @return string |
|
| 758 |
- */ |
|
| 759 |
- function CreateHeader() {
|
|
| 760 |
- $result = ""; |
|
| 761 |
- |
|
| 762 |
- // Set the boundaries |
|
| 763 |
- $uniq_id = md5(uniqid(time())); |
|
| 764 |
- $this->boundary[1] = "b1_" . $uniq_id; |
|
| 765 |
- $this->boundary[2] = "b2_" . $uniq_id; |
|
| 766 |
- |
|
| 767 |
- $result .= $this->HeaderLine("Date", $this->RFCDate());
|
|
| 768 |
- if($this->Sender == "") |
|
| 769 |
- $result .= $this->HeaderLine("Return-Path", trim($this->From));
|
|
| 770 |
- else |
|
| 771 |
- $result .= $this->HeaderLine("Return-Path", trim($this->Sender));
|
|
| 772 |
- |
|
| 773 |
- // To be created automatically by mail() |
|
| 774 |
- if($this->Mailer != "mail") |
|
| 775 |
- {
|
|
| 776 |
- if(count($this->to) > 0) |
|
| 777 |
- $result .= $this->AddrAppend("To", $this->to);
|
|
| 778 |
- else if (count($this->cc) == 0) |
|
| 779 |
- $result .= $this->HeaderLine("To", "undisclosed-recipients:;");
|
|
| 780 |
- if(count($this->cc) > 0) |
|
| 781 |
- $result .= $this->AddrAppend("Cc", $this->cc);
|
|
| 782 |
- } |
|
| 783 |
- |
|
| 784 |
- $from = array(); |
|
| 785 |
- $from[0][0] = trim($this->From); |
|
| 786 |
- $from[0][1] = $this->FromName; |
|
| 787 |
- $result .= $this->AddrAppend("From", $from);
|
|
| 788 |
- |
|
| 789 |
- // sendmail and mail() extract Bcc from the header before sending |
|
| 790 |
- if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) |
|
| 791 |
- $result .= $this->AddrAppend("Bcc", $this->bcc);
|
|
| 792 |
- |
|
| 793 |
- if(count($this->ReplyTo) > 0) |
|
| 794 |
- $result .= $this->AddrAppend("Reply-to", $this->ReplyTo);
|
|
| 795 |
- |
|
| 796 |
- // mail() sets the subject itself |
|
| 797 |
- if($this->Mailer != "mail") |
|
| 798 |
- $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject)));
|
|
| 799 |
- |
|
| 800 |
- $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
|
|
| 801 |
- $result .= $this->HeaderLine("X-Priority", $this->Priority);
|
|
| 802 |
- $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]");
|
|
| 803 |
- |
|
| 804 |
- if($this->ConfirmReadingTo != "") |
|
| 805 |
- {
|
|
| 806 |
- $result .= $this->HeaderLine("Disposition-Notification-To",
|
|
| 807 |
- "<" . trim($this->ConfirmReadingTo) . ">"); |
|
| 808 |
- } |
|
| 809 |
- |
|
| 810 |
- // Add custom headers |
|
| 811 |
- for($index = 0; $index < count($this->CustomHeader); $index++) |
|
| 812 |
- {
|
|
| 813 |
- $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), |
|
| 814 |
- $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); |
|
| 815 |
- } |
|
| 816 |
- $result .= $this->HeaderLine("MIME-Version", "1.0");
|
|
| 817 |
- |
|
| 818 |
- switch($this->message_type) |
|
| 819 |
- {
|
|
| 820 |
- case "plain": |
|
| 821 |
- $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
|
|
| 822 |
- $result .= sprintf("Content-Type: %s; charset=\"%s\"",
|
|
| 823 |
- $this->ContentType, $this->CharSet); |
|
| 824 |
- break; |
|
| 825 |
- case "attachments": |
|
| 826 |
- // fall through |
|
| 827 |
- case "alt_attachments": |
|
| 828 |
- if($this->InlineImageExists()) |
|
| 829 |
- {
|
|
| 830 |
- $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s",
|
|
| 831 |
- "multipart/related", $this->LE, $this->LE, |
|
| 832 |
- $this->boundary[1], $this->LE); |
|
| 833 |
- } |
|
| 834 |
- else |
|
| 835 |
- {
|
|
| 836 |
- $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
|
|
| 837 |
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
|
|
| 838 |
- } |
|
| 839 |
- break; |
|
| 840 |
- case "alt": |
|
| 841 |
- $result .= $this->HeaderLine("Content-Type", "multipart/alternative;");
|
|
| 842 |
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
|
|
| 843 |
- break; |
|
| 844 |
- } |
|
| 845 |
- |
|
| 846 |
- if($this->Mailer != "mail") |
|
| 847 |
- $result .= $this->LE.$this->LE; |
|
| 848 |
- |
|
| 849 |
- return $result; |
|
| 850 |
- } |
|
| 851 |
- |
|
| 852 |
- /** |
|
| 853 |
- * Assembles the message body. Returns an empty string on failure. |
|
| 854 |
- * @access private |
|
| 855 |
- * @return string |
|
| 856 |
- */ |
|
| 857 |
- function CreateBody() {
|
|
| 858 |
- $result = ""; |
|
| 859 |
- |
|
| 860 |
- $this->SetWordWrap(); |
|
| 861 |
- |
|
| 862 |
- switch($this->message_type) |
|
| 863 |
- {
|
|
| 864 |
- case "alt": |
|
| 865 |
- $result .= $this->GetBoundary($this->boundary[1], "", |
|
| 866 |
- "text/plain", ""); |
|
| 867 |
- $result .= $this->EncodeString($this->AltBody, $this->Encoding); |
|
| 868 |
- $result .= $this->LE.$this->LE; |
|
| 869 |
- $result .= $this->GetBoundary($this->boundary[1], "", |
|
| 870 |
- "text/html", ""); |
|
| 871 |
- |
|
| 872 |
- $result .= $this->EncodeString($this->Body, $this->Encoding); |
|
| 873 |
- $result .= $this->LE.$this->LE; |
|
| 874 |
- |
|
| 875 |
- $result .= $this->EndBoundary($this->boundary[1]); |
|
| 876 |
- break; |
|
| 877 |
- case "plain": |
|
| 878 |
- $result .= $this->EncodeString($this->Body, $this->Encoding); |
|
| 879 |
- break; |
|
| 880 |
- case "attachments": |
|
| 881 |
- $result .= $this->GetBoundary($this->boundary[1], "", "", ""); |
|
| 882 |
- $result .= $this->EncodeString($this->Body, $this->Encoding); |
|
| 883 |
- $result .= $this->LE; |
|
| 884 |
- |
|
| 885 |
- $result .= $this->AttachAll(); |
|
| 886 |
- break; |
|
| 887 |
- case "alt_attachments": |
|
| 888 |
- $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
|
|
| 889 |
- $result .= sprintf("Content-Type: %s;%s" .
|
|
| 890 |
- "\tboundary=\"%s\"%s", |
|
| 891 |
- "multipart/alternative", $this->LE, |
|
| 892 |
- $this->boundary[2], $this->LE.$this->LE); |
|
| 893 |
- |
|
| 894 |
- // Create text body |
|
| 895 |
- $result .= $this->GetBoundary($this->boundary[2], "", |
|
| 896 |
- "text/plain", "") . $this->LE; |
|
| 897 |
- |
|
| 898 |
- $result .= $this->EncodeString($this->AltBody, $this->Encoding); |
|
| 899 |
- $result .= $this->LE.$this->LE; |
|
| 900 |
- |
|
| 901 |
- // Create the HTML body |
|
| 902 |
- $result .= $this->GetBoundary($this->boundary[2], "", |
|
| 903 |
- "text/html", "") . $this->LE; |
|
| 904 |
- |
|
| 905 |
- $result .= $this->EncodeString($this->Body, $this->Encoding); |
|
| 906 |
- $result .= $this->LE.$this->LE; |
|
| 907 |
- |
|
| 908 |
- $result .= $this->EndBoundary($this->boundary[2]); |
|
| 909 |
- |
|
| 910 |
- $result .= $this->AttachAll(); |
|
| 911 |
- break; |
|
| 912 |
- } |
|
| 913 |
- if($this->IsError()) |
|
| 914 |
- $result = ""; |
|
| 915 |
- |
|
| 916 |
- return $result; |
|
| 917 |
- } |
|
| 918 |
- |
|
| 919 |
- /** |
|
| 920 |
- * Returns the start of a message boundary. |
|
| 921 |
- * @access private |
|
| 922 |
- */ |
|
| 923 |
- function GetBoundary($boundary, $charSet, $contentType, $encoding) {
|
|
| 924 |
- $result = ""; |
|
| 925 |
- if($charSet == "") { $charSet = $this->CharSet; }
|
|
| 926 |
- if($contentType == "") { $contentType = $this->ContentType; }
|
|
| 927 |
- if($encoding == "") { $encoding = $this->Encoding; }
|
|
| 928 |
- |
|
| 929 |
- $result .= $this->TextLine("--" . $boundary);
|
|
| 930 |
- $result .= sprintf("Content-Type: %s; charset = \"%s\"",
|
|
| 931 |
- $contentType, $charSet); |
|
| 932 |
- $result .= $this->LE; |
|
| 933 |
- $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
|
|
| 934 |
- $result .= $this->LE; |
|
| 935 |
- |
|
| 936 |
- return $result; |
|
| 937 |
- } |
|
| 938 |
- |
|
| 939 |
- /** |
|
| 940 |
- * Returns the end of a message boundary. |
|
| 941 |
- * @access private |
|
| 942 |
- */ |
|
| 943 |
- function EndBoundary($boundary) {
|
|
| 944 |
- return $this->LE . "--" . $boundary . "--" . $this->LE; |
|
| 945 |
- } |
|
| 946 |
- |
|
| 947 |
- /** |
|
| 948 |
- * Sets the message type. |
|
| 949 |
- * @access private |
|
| 950 |
- * @return void |
|
| 951 |
- */ |
|
| 952 |
- function SetMessageType() {
|
|
| 953 |
- if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) |
|
| 954 |
- $this->message_type = "plain"; |
|
| 955 |
- else |
|
| 956 |
- {
|
|
| 957 |
- if(count($this->attachment) > 0) |
|
| 958 |
- $this->message_type = "attachments"; |
|
| 959 |
- if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) |
|
| 960 |
- $this->message_type = "alt"; |
|
| 961 |
- if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) |
|
| 962 |
- $this->message_type = "alt_attachments"; |
|
| 963 |
- } |
|
| 964 |
- } |
|
| 965 |
- |
|
| 966 |
- /** |
|
| 967 |
- * Returns a formatted header line. |
|
| 968 |
- * @access private |
|
| 969 |
- * @return string |
|
| 970 |
- */ |
|
| 971 |
- function HeaderLine($name, $value) {
|
|
| 972 |
- return $name . ": " . $value . $this->LE; |
|
| 973 |
- } |
|
| 974 |
- |
|
| 975 |
- /** |
|
| 976 |
- * Returns a formatted mail line. |
|
| 977 |
- * @access private |
|
| 978 |
- * @return string |
|
| 979 |
- */ |
|
| 980 |
- function TextLine($value) {
|
|
| 981 |
- return $value . $this->LE; |
|
| 982 |
- } |
|
| 983 |
- |
|
| 984 |
- ///////////////////////////////////////////////// |
|
| 985 |
- // ATTACHMENT METHODS |
|
| 986 |
- ///////////////////////////////////////////////// |
|
| 987 |
- |
|
| 988 |
- /** |
|
| 989 |
- * Adds an attachment from a path on the filesystem. |
|
| 990 |
- * Returns false if the file could not be found |
|
| 991 |
- * or accessed. |
|
| 992 |
- * @param string $path Path to the attachment. |
|
| 993 |
- * @param string $name Overrides the attachment name. |
|
| 994 |
- * @param string $encoding File encoding (see $Encoding). |
|
| 995 |
- * @param string $type File extension (MIME) type. |
|
| 996 |
- * @return bool |
|
| 997 |
- */ |
|
| 998 |
- function AddAttachment($path, $name = "", $encoding = "base64", |
|
| 999 |
- $type = "application/octet-stream") {
|
|
| 1000 |
- if(!@is_file($path)) |
|
| 1001 |
- {
|
|
| 1002 |
- $this->SetError($this->Lang("file_access") . $path);
|
|
| 1003 |
- return false; |
|
| 1004 |
- } |
|
| 1005 |
- |
|
| 1006 |
- $filename = basename($path); |
|
| 1007 |
- if($name == "") |
|
| 1008 |
- $name = $filename; |
|
| 1009 |
- |
|
| 1010 |
- $cur = count($this->attachment); |
|
| 1011 |
- $this->attachment[$cur][0] = $path; |
|
| 1012 |
- $this->attachment[$cur][1] = $filename; |
|
| 1013 |
- $this->attachment[$cur][2] = $name; |
|
| 1014 |
- $this->attachment[$cur][3] = $encoding; |
|
| 1015 |
- $this->attachment[$cur][4] = $type; |
|
| 1016 |
- $this->attachment[$cur][5] = false; // isStringAttachment |
|
| 1017 |
- $this->attachment[$cur][6] = "attachment"; |
|
| 1018 |
- $this->attachment[$cur][7] = 0; |
|
| 1019 |
- |
|
| 1020 |
- return true; |
|
| 1021 |
- } |
|
| 1022 |
- |
|
| 1023 |
- /** |
|
| 1024 |
- * Attaches all fs, string, and binary attachments to the message. |
|
| 1025 |
- * Returns an empty string on failure. |
|
| 1026 |
- * @access private |
|
| 1027 |
- * @return string |
|
| 1028 |
- */ |
|
| 1029 |
- function AttachAll() {
|
|
| 1030 |
- // Return text of body |
|
| 1031 |
- $mime = array(); |
|
| 1032 |
- |
|
| 1033 |
- // Add all attachments |
|
| 1034 |
- for($i = 0; $i < count($this->attachment); $i++) |
|
| 1035 |
- {
|
|
| 1036 |
- // Check for string attachment |
|
| 1037 |
- $bString = $this->attachment[$i][5]; |
|
| 1038 |
- if ($bString) |
|
| 1039 |
- $string = $this->attachment[$i][0]; |
|
| 1040 |
- else |
|
| 1041 |
- $path = $this->attachment[$i][0]; |
|
| 1042 |
- |
|
| 1043 |
- $filename = $this->attachment[$i][1]; |
|
| 1044 |
- $name = $this->attachment[$i][2]; |
|
| 1045 |
- $encoding = $this->attachment[$i][3]; |
|
| 1046 |
- $type = $this->attachment[$i][4]; |
|
| 1047 |
- $disposition = $this->attachment[$i][6]; |
|
| 1048 |
- $cid = $this->attachment[$i][7]; |
|
| 1049 |
- |
|
| 1050 |
- $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
|
|
| 1051 |
- $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
|
|
| 1052 |
- $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
|
|
| 1053 |
- |
|
| 1054 |
- if($disposition == "inline") |
|
| 1055 |
- $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
|
|
| 1056 |
- |
|
| 1057 |
- $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s",
|
|
| 1058 |
- $disposition, $name, $this->LE.$this->LE); |
|
| 1059 |
- |
|
| 1060 |
- // Encode as string attachment |
|
| 1061 |
- if($bString) |
|
| 1062 |
- {
|
|
| 1063 |
- $mime[] = $this->EncodeString($string, $encoding); |
|
| 1064 |
- if($this->IsError()) { return ""; }
|
|
| 1065 |
- $mime[] = $this->LE.$this->LE; |
|
| 1066 |
- } |
|
| 1067 |
- else |
|
| 1068 |
- {
|
|
| 1069 |
- $mime[] = $this->EncodeFile($path, $encoding); |
|
| 1070 |
- if($this->IsError()) { return ""; }
|
|
| 1071 |
- $mime[] = $this->LE.$this->LE; |
|
| 1072 |
- } |
|
| 1073 |
- } |
|
| 1074 |
- |
|
| 1075 |
- $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
|
|
| 1076 |
- |
|
| 1077 |
- return join("", $mime);
|
|
| 1078 |
- } |
|
| 1079 |
- |
|
| 1080 |
- /** |
|
| 1081 |
- * Encodes attachment in requested format. Returns an |
|
| 1082 |
- * empty string on failure. |
|
| 1083 |
- * @access private |
|
| 1084 |
- * @return string |
|
| 1085 |
- */ |
|
| 1086 |
- function EncodeFile ($path, $encoding = "base64") {
|
|
| 1087 |
- if(!@$fd = fopen($path, "rb")) |
|
| 1088 |
- {
|
|
| 1089 |
- $this->SetError($this->Lang("file_open") . $path);
|
|
| 1090 |
- return ""; |
|
| 1091 |
- } |
|
| 1092 |
- $magic_quotes = get_magic_quotes_runtime(); |
|
| 1093 |
- set_magic_quotes_runtime(0); |
|
| 1094 |
- $file_buffer = fread($fd, filesize($path)); |
|
| 1095 |
- $file_buffer = $this->EncodeString($file_buffer, $encoding); |
|
| 1096 |
- fclose($fd); |
|
| 1097 |
- set_magic_quotes_runtime($magic_quotes); |
|
| 1098 |
- |
|
| 1099 |
- return $file_buffer; |
|
| 1100 |
- } |
|
| 1101 |
- |
|
| 1102 |
- /** |
|
| 1103 |
- * Encodes string to requested format. Returns an |
|
| 1104 |
- * empty string on failure. |
|
| 1105 |
- * @access private |
|
| 1106 |
- * @return string |
|
| 1107 |
- */ |
|
| 1108 |
- function EncodeString ($str, $encoding = "base64") {
|
|
| 1109 |
- $encoded = ""; |
|
| 1110 |
- switch(strtolower($encoding)) {
|
|
| 1111 |
- case "base64": |
|
| 1112 |
- // chunk_split is found in PHP >= 3.0.6 |
|
| 1113 |
- $encoded = chunk_split(base64_encode($str), 76, $this->LE); |
|
| 1114 |
- break; |
|
| 1115 |
- case "7bit": |
|
| 1116 |
- case "8bit": |
|
| 1117 |
- $encoded = $this->FixEOL($str); |
|
| 1118 |
- if (substr($encoded, -(strlen($this->LE))) != $this->LE) |
|
| 1119 |
- $encoded .= $this->LE; |
|
| 1120 |
- break; |
|
| 1121 |
- case "binary": |
|
| 1122 |
- $encoded = $str; |
|
| 1123 |
- break; |
|
| 1124 |
- case "quoted-printable": |
|
| 1125 |
- $encoded = $this->EncodeQP($str); |
|
| 1126 |
- break; |
|
| 1127 |
- default: |
|
| 1128 |
- $this->SetError($this->Lang("encoding") . $encoding);
|
|
| 1129 |
- break; |
|
| 1130 |
- } |
|
| 1131 |
- return $encoded; |
|
| 1132 |
- } |
|
| 1133 |
- |
|
| 1134 |
- /** |
|
| 1135 |
- * Encode a header string to best of Q, B, quoted or none. |
|
| 1136 |
- * @access private |
|
| 1137 |
- * @return string |
|
| 1138 |
- */ |
|
| 1139 |
- function EncodeHeader ($str, $position = 'text') {
|
|
| 1140 |
- $x = 0; |
|
| 1141 |
- |
|
| 1142 |
- switch (strtolower($position)) {
|
|
| 1143 |
- case 'phrase': |
|
| 1144 |
- if (!preg_match('/[\200-\377]/', $str)) {
|
|
| 1145 |
- // Can't use addslashes as we don't know what value has magic_quotes_sybase. |
|
| 1146 |
- $encoded = addcslashes($str, "\0..\37\177\\\""); |
|
| 1147 |
- |
|
| 1148 |
- if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str))
|
|
| 1149 |
- return ($encoded); |
|
| 1150 |
- else |
|
| 1151 |
- return ("\"$encoded\"");
|
|
| 1152 |
- } |
|
| 1153 |
- $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
|
|
| 1154 |
- break; |
|
| 1155 |
- case 'comment': |
|
| 1156 |
- $x = preg_match_all('/[()"]/', $str, $matches);
|
|
| 1157 |
- // Fall-through |
|
| 1158 |
- case 'text': |
|
| 1159 |
- default: |
|
| 1160 |
- $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
|
|
| 1161 |
- break; |
|
| 1162 |
- } |
|
| 1163 |
- |
|
| 1164 |
- if ($x == 0) |
|
| 1165 |
- return ($str); |
|
| 1166 |
- |
|
| 1167 |
- $maxlen = 75 - 7 - strlen($this->CharSet); |
|
| 1168 |
- // Try to select the encoding which should produce the shortest output |
|
| 1169 |
- if (strlen($str)/3 < $x) {
|
|
| 1170 |
- $encoding = 'B'; |
|
| 1171 |
- $encoded = base64_encode($str); |
|
| 1172 |
- $maxlen -= $maxlen % 4; |
|
| 1173 |
- $encoded = trim(chunk_split($encoded, $maxlen, "\n")); |
|
| 1174 |
- } else {
|
|
| 1175 |
- $encoding = 'Q'; |
|
| 1176 |
- $encoded = $this->EncodeQ($str, $position); |
|
| 1177 |
- $encoded = $this->WrapText($encoded, $maxlen, true); |
|
| 1178 |
- $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
|
|
| 1179 |
- } |
|
| 1180 |
- |
|
| 1181 |
- $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
|
|
| 1182 |
- $encoded = trim(str_replace("\n", $this->LE, $encoded));
|
|
| 1183 |
- |
|
| 1184 |
- return $encoded; |
|
| 1185 |
- } |
|
| 1186 |
- |
|
| 1187 |
- /** |
|
| 1188 |
- * Encode string to quoted-printable. |
|
| 1189 |
- * @access private |
|
| 1190 |
- * @return string |
|
| 1191 |
- */ |
|
| 1192 |
- function EncodeQP ($str) {
|
|
| 1193 |
- $encoded = $this->FixEOL($str); |
|
| 1194 |
- if (substr($encoded, -(strlen($this->LE))) != $this->LE) |
|
| 1195 |
- $encoded .= $this->LE; |
|
| 1196 |
- |
|
| 1197 |
- // Replace every high ascii, control and = characters |
|
| 1198 |
- $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
|
|
| 1199 |
- "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
|
| 1200 |
- // Replace every spaces and tabs when it's the last character on a line |
|
| 1201 |
- $encoded = preg_replace("/([\011\040])".$this->LE."/e",
|
|
| 1202 |
- "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
|
|
| 1203 |
- |
|
| 1204 |
- // Maximum line length of 76 characters before CRLF (74 + space + '=') |
|
| 1205 |
- $encoded = $this->WrapText($encoded, 74, true); |
|
| 1206 |
- |
|
| 1207 |
- return $encoded; |
|
| 1208 |
- } |
|
| 1209 |
- |
|
| 1210 |
- /** |
|
| 1211 |
- * Encode string to q encoding. |
|
| 1212 |
- * @access private |
|
| 1213 |
- * @return string |
|
| 1214 |
- */ |
|
| 1215 |
- function EncodeQ ($str, $position = "text") {
|
|
| 1216 |
- // There should not be any EOL in the string |
|
| 1217 |
- $encoded = preg_replace("[\r\n]", "", $str);
|
|
| 1218 |
- |
|
| 1219 |
- switch (strtolower($position)) {
|
|
| 1220 |
- case "phrase": |
|
| 1221 |
- $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
|
| 1222 |
- break; |
|
| 1223 |
- case "comment": |
|
| 1224 |
- $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
|
| 1225 |
- case "text": |
|
| 1226 |
- default: |
|
| 1227 |
- // Replace every high ascii, control =, ? and _ characters |
|
| 1228 |
- $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
|
|
| 1229 |
- "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
|
| 1230 |
- break; |
|
| 1231 |
- } |
|
| 1232 |
- |
|
| 1233 |
- // Replace every spaces to _ (more readable than =20) |
|
| 1234 |
- $encoded = str_replace(" ", "_", $encoded);
|
|
| 1235 |
- |
|
| 1236 |
- return $encoded; |
|
| 1237 |
- } |
|
| 1238 |
- |
|
| 1239 |
- /** |
|
| 1240 |
- * Adds a string or binary attachment (non-filesystem) to the list. |
|
| 1241 |
- * This method can be used to attach ascii or binary data, |
|
| 1242 |
- * such as a BLOB record from a database. |
|
| 1243 |
- * @param string $string String attachment data. |
|
| 1244 |
- * @param string $filename Name of the attachment. |
|
| 1245 |
- * @param string $encoding File encoding (see $Encoding). |
|
| 1246 |
- * @param string $type File extension (MIME) type. |
|
| 1247 |
- * @return void |
|
| 1248 |
- */ |
|
| 1249 |
- function AddStringAttachment($string, $filename, $encoding = "base64", |
|
| 1250 |
- $type = "application/octet-stream") {
|
|
| 1251 |
- // Append to $attachment array |
|
| 1252 |
- $cur = count($this->attachment); |
|
| 1253 |
- $this->attachment[$cur][0] = $string; |
|
| 1254 |
- $this->attachment[$cur][1] = $filename; |
|
| 1255 |
- $this->attachment[$cur][2] = $filename; |
|
| 1256 |
- $this->attachment[$cur][3] = $encoding; |
|
| 1257 |
- $this->attachment[$cur][4] = $type; |
|
| 1258 |
- $this->attachment[$cur][5] = true; // isString |
|
| 1259 |
- $this->attachment[$cur][6] = "attachment"; |
|
| 1260 |
- $this->attachment[$cur][7] = 0; |
|
| 1261 |
- } |
|
| 1262 |
- |
|
| 1263 |
- /** |
|
| 1264 |
- * Adds an embedded attachment. This can include images, sounds, and |
|
| 1265 |
- * just about any other document. Make sure to set the $type to an |
|
| 1266 |
- * image type. For JPEG images use "image/jpeg" and for GIF images |
|
| 1267 |
- * use "image/gif". |
|
| 1268 |
- * @param string $path Path to the attachment. |
|
| 1269 |
- * @param string $cid Content ID of the attachment. Use this to identify |
|
| 1270 |
- * the Id for accessing the image in an HTML form. |
|
| 1271 |
- * @param string $name Overrides the attachment name. |
|
| 1272 |
- * @param string $encoding File encoding (see $Encoding). |
|
| 1273 |
- * @param string $type File extension (MIME) type. |
|
| 1274 |
- * @return bool |
|
| 1275 |
- */ |
|
| 1276 |
- function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", |
|
| 1277 |
- $type = "application/octet-stream") {
|
|
| 1278 |
- |
|
| 1279 |
- if(!@is_file($path)) |
|
| 1280 |
- {
|
|
| 1281 |
- $this->SetError($this->Lang("file_access") . $path);
|
|
| 1282 |
- return false; |
|
| 1283 |
- } |
|
| 1284 |
- |
|
| 1285 |
- $filename = basename($path); |
|
| 1286 |
- if($name == "") |
|
| 1287 |
- $name = $filename; |
|
| 1288 |
- |
|
| 1289 |
- // Append to $attachment array |
|
| 1290 |
- $cur = count($this->attachment); |
|
| 1291 |
- $this->attachment[$cur][0] = $path; |
|
| 1292 |
- $this->attachment[$cur][1] = $filename; |
|
| 1293 |
- $this->attachment[$cur][2] = $name; |
|
| 1294 |
- $this->attachment[$cur][3] = $encoding; |
|
| 1295 |
- $this->attachment[$cur][4] = $type; |
|
| 1296 |
- $this->attachment[$cur][5] = false; // isStringAttachment |
|
| 1297 |
- $this->attachment[$cur][6] = "inline"; |
|
| 1298 |
- $this->attachment[$cur][7] = $cid; |
|
| 1299 |
- |
|
| 1300 |
- return true; |
|
| 1301 |
- } |
|
| 1302 |
- |
|
| 1303 |
- /** |
|
| 1304 |
- * Returns true if an inline attachment is present. |
|
| 1305 |
- * @access private |
|
| 1306 |
- * @return bool |
|
| 1307 |
- */ |
|
| 1308 |
- function InlineImageExists() {
|
|
| 1309 |
- $result = false; |
|
| 1310 |
- for($i = 0; $i < count($this->attachment); $i++) |
|
| 1311 |
- {
|
|
| 1312 |
- if($this->attachment[$i][6] == "inline") |
|
| 1313 |
- {
|
|
| 1314 |
- $result = true; |
|
| 1315 |
- break; |
|
| 1316 |
- } |
|
| 1317 |
- } |
|
| 1318 |
- |
|
| 1319 |
- return $result; |
|
| 1320 |
- } |
|
| 1321 |
- |
|
| 1322 |
- ///////////////////////////////////////////////// |
|
| 1323 |
- // MESSAGE RESET METHODS |
|
| 1324 |
- ///////////////////////////////////////////////// |
|
| 1325 |
- |
|
| 1326 |
- /** |
|
| 1327 |
- * Clears all recipients assigned in the TO array. Returns void. |
|
| 1328 |
- * @return void |
|
| 1329 |
- */ |
|
| 1330 |
- function ClearAddresses() {
|
|
| 1331 |
- $this->to = array(); |
|
| 1332 |
- } |
|
| 1333 |
- |
|
| 1334 |
- /** |
|
| 1335 |
- * Clears all recipients assigned in the CC array. Returns void. |
|
| 1336 |
- * @return void |
|
| 1337 |
- */ |
|
| 1338 |
- function ClearCCs() {
|
|
| 1339 |
- $this->cc = array(); |
|
| 1340 |
- } |
|
| 1341 |
- |
|
| 1342 |
- /** |
|
| 1343 |
- * Clears all recipients assigned in the BCC array. Returns void. |
|
| 1344 |
- * @return void |
|
| 1345 |
- */ |
|
| 1346 |
- function ClearBCCs() {
|
|
| 1347 |
- $this->bcc = array(); |
|
| 1348 |
- } |
|
| 1349 |
- |
|
| 1350 |
- /** |
|
| 1351 |
- * Clears all recipients assigned in the ReplyTo array. Returns void. |
|
| 1352 |
- * @return void |
|
| 1353 |
- */ |
|
| 1354 |
- function ClearReplyTos() {
|
|
| 1355 |
- $this->ReplyTo = array(); |
|
| 1356 |
- } |
|
| 1357 |
- |
|
| 1358 |
- /** |
|
| 1359 |
- * Clears all recipients assigned in the TO, CC and BCC |
|
| 1360 |
- * array. Returns void. |
|
| 1361 |
- * @return void |
|
| 1362 |
- */ |
|
| 1363 |
- function ClearAllRecipients() {
|
|
| 1364 |
- $this->to = array(); |
|
| 1365 |
- $this->cc = array(); |
|
| 1366 |
- $this->bcc = array(); |
|
| 1367 |
- } |
|
| 1368 |
- |
|
| 1369 |
- /** |
|
| 1370 |
- * Clears all previously set filesystem, string, and binary |
|
| 1371 |
- * attachments. Returns void. |
|
| 1372 |
- * @return void |
|
| 1373 |
- */ |
|
| 1374 |
- function ClearAttachments() {
|
|
| 1375 |
- $this->attachment = array(); |
|
| 1376 |
- } |
|
| 1377 |
- |
|
| 1378 |
- /** |
|
| 1379 |
- * Clears all custom headers. Returns void. |
|
| 1380 |
- * @return void |
|
| 1381 |
- */ |
|
| 1382 |
- function ClearCustomHeaders() {
|
|
| 1383 |
- $this->CustomHeader = array(); |
|
| 1384 |
- } |
|
| 1385 |
- |
|
| 1386 |
- |
|
| 1387 |
- ///////////////////////////////////////////////// |
|
| 1388 |
- // MISCELLANEOUS METHODS |
|
| 1389 |
- ///////////////////////////////////////////////// |
|
| 1390 |
- |
|
| 1391 |
- /** |
|
| 1392 |
- * Adds the error message to the error container. |
|
| 1393 |
- * Returns void. |
|
| 1394 |
- * @access private |
|
| 1395 |
- * @return void |
|
| 1396 |
- */ |
|
| 1397 |
- function SetError($msg) {
|
|
| 1398 |
- $this->error_count++; |
|
| 1399 |
- $this->ErrorInfo = $msg; |
|
| 1400 |
- } |
|
| 1401 |
- |
|
| 1402 |
- /** |
|
| 1403 |
- * Returns the proper RFC 822 formatted date. |
|
| 1404 |
- * @access private |
|
| 1405 |
- * @return string |
|
| 1406 |
- */ |
|
| 1407 |
- function RFCDate() {
|
|
| 1408 |
- $tz = date("Z");
|
|
| 1409 |
- $tzs = ($tz < 0) ? "-" : "+"; |
|
| 1410 |
- $tz = abs($tz); |
|
| 1411 |
- $tz = ($tz/3600)*100 + ($tz%3600)/60; |
|
| 1412 |
- $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
|
|
| 1413 |
- |
|
| 1414 |
- return $result; |
|
| 1415 |
- } |
|
| 1416 |
- |
|
| 1417 |
- /** |
|
| 1418 |
- * Returns the appropriate server variable. Should work with both |
|
| 1419 |
- * PHP 4.1.0+ as well as older versions. Returns an empty string |
|
| 1420 |
- * if nothing is found. |
|
| 1421 |
- * @access private |
|
| 1422 |
- * @return mixed |
|
| 1423 |
- */ |
|
| 1424 |
- function ServerVar($varName) {
|
|
| 1425 |
- global $HTTP_SERVER_VARS; |
|
| 1426 |
- global $HTTP_ENV_VARS; |
|
| 1427 |
- |
|
| 1428 |
- if(!isset($_SERVER)) |
|
| 1429 |
- {
|
|
| 1430 |
- $_SERVER = $HTTP_SERVER_VARS; |
|
| 1431 |
- if(!isset($_SERVER["REMOTE_ADDR"])) |
|
| 1432 |
- $_SERVER = $HTTP_ENV_VARS; // must be Apache |
|
| 1433 |
- } |
|
| 1434 |
- |
|
| 1435 |
- if(isset($_SERVER[$varName])) |
|
| 1436 |
- return $_SERVER[$varName]; |
|
| 1437 |
- else |
|
| 1438 |
- return ""; |
|
| 1439 |
- } |
|
| 1440 |
- |
|
| 1441 |
- /** |
|
| 1442 |
- * Returns the server hostname or 'localhost.localdomain' if unknown. |
|
| 1443 |
- * @access private |
|
| 1444 |
- * @return string |
|
| 1445 |
- */ |
|
| 1446 |
- function ServerHostname() {
|
|
| 1447 |
- if ($this->Hostname != "") |
|
| 1448 |
- $result = $this->Hostname; |
|
| 1449 |
- elseif ($this->ServerVar('SERVER_NAME') != "")
|
|
| 1450 |
- $result = $this->ServerVar('SERVER_NAME');
|
|
| 1451 |
- else |
|
| 1452 |
- $result = "localhost.localdomain"; |
|
| 1453 |
- |
|
| 1454 |
- return $result; |
|
| 1455 |
- } |
|
| 1456 |
- |
|
| 1457 |
- /** |
|
| 1458 |
- * Returns a message in the appropriate language. |
|
| 1459 |
- * @access private |
|
| 1460 |
- * @return string |
|
| 1461 |
- */ |
|
| 1462 |
- function Lang($key) {
|
|
| 1463 |
- if(count($this->language) < 1) |
|
| 1464 |
- $this->SetLanguage("en"); // set the default language
|
|
| 1465 |
- |
|
| 1466 |
- if(isset($this->language[$key])) |
|
| 1467 |
- return $this->language[$key]; |
|
| 1468 |
- else |
|
| 1469 |
- return "Language string failed to load: " . $key; |
|
| 1470 |
- } |
|
| 1471 |
- |
|
| 1472 |
- /** |
|
| 1473 |
- * Returns true if an error occurred. |
|
| 1474 |
- * @return bool |
|
| 1475 |
- */ |
|
| 1476 |
- function IsError() {
|
|
| 1477 |
- return ($this->error_count > 0); |
|
| 1478 |
- } |
|
| 1479 |
- |
|
| 1480 |
- /** |
|
| 1481 |
- * Changes every end of line from CR or LF to CRLF. |
|
| 1482 |
- * @access private |
|
| 1483 |
- * @return string |
|
| 1484 |
- */ |
|
| 1485 |
- function FixEOL($str) {
|
|
| 1486 |
- $str = str_replace("\r\n", "\n", $str);
|
|
| 1487 |
- $str = str_replace("\r", "\n", $str);
|
|
| 1488 |
- $str = str_replace("\n", $this->LE, $str);
|
|
| 1489 |
- return $str; |
|
| 1490 |
- } |
|
| 1491 |
- |
|
| 1492 |
- /** |
|
| 1493 |
- * Adds a custom header. |
|
| 1494 |
- * @return void |
|
| 1495 |
- */ |
|
| 1496 |
- function AddCustomHeader($custom_header) {
|
|
| 1497 |
- $this->CustomHeader[] = explode(":", $custom_header, 2);
|
|
| 1498 |
- } |
|
| 1499 |
-} |
|
| 1500 |
- |
|
| 1501 |
-?> |
|
| 1502 | 0 |
\ No newline at end of file |
| 1503 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,1046 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
-if(!defined("_CHARSET")) exit( );
|
|
| 3 |
-//////////////////////////////////////////////////// |
|
| 4 |
-// SMTP - PHP SMTP class |
|
| 5 |
-// |
|
| 6 |
-// Version 1.02 |
|
| 7 |
-// |
|
| 8 |
-// Define an SMTP class that can be used to connect |
|
| 9 |
-// and communicate with any SMTP server. It implements |
|
| 10 |
-// all the SMTP functions defined in RFC821 except TURN. |
|
| 11 |
-// |
|
| 12 |
-// Author: Chris Ryan |
|
| 13 |
-// |
|
| 14 |
-// License: LGPL, see LICENSE |
|
| 15 |
-//////////////////////////////////////////////////// |
|
| 16 |
- |
|
| 17 |
-/** |
|
| 18 |
- * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP |
|
| 19 |
- * commands except TURN which will always return a not implemented |
|
| 20 |
- * error. SMTP also provides some utility methods for sending mail |
|
| 21 |
- * to an SMTP server. |
|
| 22 |
- * @package PHPMailer |
|
| 23 |
- * @author Chris Ryan |
|
| 24 |
- */ |
|
| 25 |
-class SMTP |
|
| 26 |
-{
|
|
| 27 |
- /** |
|
| 28 |
- * SMTP server port |
|
| 29 |
- * @var int |
|
| 30 |
- */ |
|
| 31 |
- var $SMTP_PORT = 25; |
|
| 32 |
- |
|
| 33 |
- /** |
|
| 34 |
- * SMTP reply line ending |
|
| 35 |
- * @var string |
|
| 36 |
- */ |
|
| 37 |
- var $CRLF = "\r\n"; |
|
| 38 |
- |
|
| 39 |
- /** |
|
| 40 |
- * Sets whether debugging is turned on |
|
| 41 |
- * @var bool |
|
| 42 |
- */ |
|
| 43 |
- var $do_debug; # the level of debug to perform |
|
| 44 |
- |
|
| 45 |
- /**#@+ |
|
| 46 |
- * @access private |
|
| 47 |
- */ |
|
| 48 |
- var $smtp_conn; # the socket to the server |
|
| 49 |
- var $error; # error if any on the last call |
|
| 50 |
- var $helo_rply; # the reply the server sent to us for HELO |
|
| 51 |
- /**#@-*/ |
|
| 52 |
- |
|
| 53 |
- /** |
|
| 54 |
- * Initialize the class so that the data is in a known state. |
|
| 55 |
- * @access public |
|
| 56 |
- * @return void |
|
| 57 |
- */ |
|
| 58 |
- function SMTP() {
|
|
| 59 |
- $this->smtp_conn = 0; |
|
| 60 |
- $this->error = null; |
|
| 61 |
- $this->helo_rply = null; |
|
| 62 |
- |
|
| 63 |
- $this->do_debug = 0; |
|
| 64 |
- } |
|
| 65 |
- |
|
| 66 |
- /************************************************************* |
|
| 67 |
- * CONNECTION FUNCTIONS * |
|
| 68 |
- ***********************************************************/ |
|
| 69 |
- |
|
| 70 |
- /** |
|
| 71 |
- * Connect to the server specified on the port specified. |
|
| 72 |
- * If the port is not specified use the default SMTP_PORT. |
|
| 73 |
- * If tval is specified then a connection will try and be |
|
| 74 |
- * established with the server for that number of seconds. |
|
| 75 |
- * If tval is not specified the default is 30 seconds to |
|
| 76 |
- * try on the connection. |
|
| 77 |
- * |
|
| 78 |
- * SMTP CODE SUCCESS: 220 |
|
| 79 |
- * SMTP CODE FAILURE: 421 |
|
| 80 |
- * @access public |
|
| 81 |
- * @return bool |
|
| 82 |
- */ |
|
| 83 |
- function Connect($host,$port=0,$tval=30) {
|
|
| 84 |
- # set the error val to null so there is no confusion |
|
| 85 |
- $this->error = null; |
|
| 86 |
- |
|
| 87 |
- # make sure we are __not__ connected |
|
| 88 |
- if($this->connected()) {
|
|
| 89 |
- # ok we are connected! what should we do? |
|
| 90 |
- # for now we will just give an error saying we |
|
| 91 |
- # are already connected |
|
| 92 |
- $this->error = |
|
| 93 |
- array("error" => "Already connected to a server");
|
|
| 94 |
- return false; |
|
| 95 |
- } |
|
| 96 |
- |
|
| 97 |
- if(empty($port)) {
|
|
| 98 |
- $port = $this->SMTP_PORT; |
|
| 99 |
- } |
|
| 100 |
- |
|
| 101 |
- #connect to the smtp server |
|
| 102 |
- $this->smtp_conn = fsockopen($host, # the host of the server |
|
| 103 |
- $port, # the port to use |
|
| 104 |
- $errno, # error number if any |
|
| 105 |
- $errstr, # error message if any |
|
| 106 |
- $tval); # give up after ? secs |
|
| 107 |
- # verify we connected properly |
|
| 108 |
- if(empty($this->smtp_conn)) {
|
|
| 109 |
- $this->error = array("error" => "Failed to connect to server",
|
|
| 110 |
- "errno" => $errno, |
|
| 111 |
- "errstr" => $errstr); |
|
| 112 |
- if($this->do_debug >= 1) {
|
|
| 113 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 114 |
- ": $errstr ($errno)" . $this->CRLF; |
|
| 115 |
- } |
|
| 116 |
- return false; |
|
| 117 |
- } |
|
| 118 |
- |
|
| 119 |
- # sometimes the SMTP server takes a little longer to respond |
|
| 120 |
- # so we will give it a longer timeout for the first read |
|
| 121 |
- // Windows still does not have support for this timeout function |
|
| 122 |
- if(substr(PHP_OS, 0, 3) != "WIN") |
|
| 123 |
- socket_set_timeout($this->smtp_conn, $tval, 0); |
|
| 124 |
- |
|
| 125 |
- # get any announcement stuff |
|
| 126 |
- $announce = $this->get_lines(); |
|
| 127 |
- |
|
| 128 |
- # set the timeout of any socket functions at 1/10 of a second |
|
| 129 |
- //if(function_exists("socket_set_timeout"))
|
|
| 130 |
- // socket_set_timeout($this->smtp_conn, 0, 100000); |
|
| 131 |
- |
|
| 132 |
- if($this->do_debug >= 2) {
|
|
| 133 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; |
|
| 134 |
- } |
|
| 135 |
- |
|
| 136 |
- return true; |
|
| 137 |
- } |
|
| 138 |
- |
|
| 139 |
- /** |
|
| 140 |
- * Performs SMTP authentication. Must be run after running the |
|
| 141 |
- * Hello() method. Returns true if successfully authenticated. |
|
| 142 |
- * @access public |
|
| 143 |
- * @return bool |
|
| 144 |
- */ |
|
| 145 |
- function Authenticate($username, $password) {
|
|
| 146 |
- // Start authentication |
|
| 147 |
- fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); |
|
| 148 |
- |
|
| 149 |
- $rply = $this->get_lines(); |
|
| 150 |
- $code = substr($rply,0,3); |
|
| 151 |
- |
|
| 152 |
- if($code != 334) {
|
|
| 153 |
- $this->error = |
|
| 154 |
- array("error" => "AUTH not accepted from server",
|
|
| 155 |
- "smtp_code" => $code, |
|
| 156 |
- "smtp_msg" => substr($rply,4)); |
|
| 157 |
- if($this->do_debug >= 1) {
|
|
| 158 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 159 |
- ": " . $rply . $this->CRLF; |
|
| 160 |
- } |
|
| 161 |
- return false; |
|
| 162 |
- } |
|
| 163 |
- |
|
| 164 |
- // Send encoded username |
|
| 165 |
- fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); |
|
| 166 |
- |
|
| 167 |
- $rply = $this->get_lines(); |
|
| 168 |
- $code = substr($rply,0,3); |
|
| 169 |
- |
|
| 170 |
- if($code != 334) {
|
|
| 171 |
- $this->error = |
|
| 172 |
- array("error" => "Username not accepted from server",
|
|
| 173 |
- "smtp_code" => $code, |
|
| 174 |
- "smtp_msg" => substr($rply,4)); |
|
| 175 |
- if($this->do_debug >= 1) {
|
|
| 176 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 177 |
- ": " . $rply . $this->CRLF; |
|
| 178 |
- } |
|
| 179 |
- return false; |
|
| 180 |
- } |
|
| 181 |
- |
|
| 182 |
- // Send encoded password |
|
| 183 |
- fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); |
|
| 184 |
- |
|
| 185 |
- $rply = $this->get_lines(); |
|
| 186 |
- $code = substr($rply,0,3); |
|
| 187 |
- |
|
| 188 |
- if($code != 235) {
|
|
| 189 |
- $this->error = |
|
| 190 |
- array("error" => "Password not accepted from server",
|
|
| 191 |
- "smtp_code" => $code, |
|
| 192 |
- "smtp_msg" => substr($rply,4)); |
|
| 193 |
- if($this->do_debug >= 1) {
|
|
| 194 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 195 |
- ": " . $rply . $this->CRLF; |
|
| 196 |
- } |
|
| 197 |
- return false; |
|
| 198 |
- } |
|
| 199 |
- |
|
| 200 |
- return true; |
|
| 201 |
- } |
|
| 202 |
- |
|
| 203 |
- /** |
|
| 204 |
- * Returns true if connected to a server otherwise false |
|
| 205 |
- * @access private |
|
| 206 |
- * @return bool |
|
| 207 |
- */ |
|
| 208 |
- function Connected() {
|
|
| 209 |
- if(!empty($this->smtp_conn)) {
|
|
| 210 |
- $sock_status = socket_get_status($this->smtp_conn); |
|
| 211 |
- if($sock_status["eof"]) {
|
|
| 212 |
- # hmm this is an odd situation... the socket is |
|
| 213 |
- # valid but we aren't connected anymore |
|
| 214 |
- if($this->do_debug >= 1) {
|
|
| 215 |
- echo "SMTP -> NOTICE:" . $this->CRLF . |
|
| 216 |
- "EOF caught while checking if connected"; |
|
| 217 |
- } |
|
| 218 |
- $this->Close(); |
|
| 219 |
- return false; |
|
| 220 |
- } |
|
| 221 |
- return true; # everything looks good |
|
| 222 |
- } |
|
| 223 |
- return false; |
|
| 224 |
- } |
|
| 225 |
- |
|
| 226 |
- /** |
|
| 227 |
- * Closes the socket and cleans up the state of the class. |
|
| 228 |
- * It is not considered good to use this function without |
|
| 229 |
- * first trying to use QUIT. |
|
| 230 |
- * @access public |
|
| 231 |
- * @return void |
|
| 232 |
- */ |
|
| 233 |
- function Close() {
|
|
| 234 |
- $this->error = null; # so there is no confusion |
|
| 235 |
- $this->helo_rply = null; |
|
| 236 |
- if(!empty($this->smtp_conn)) {
|
|
| 237 |
- # close the connection and cleanup |
|
| 238 |
- fclose($this->smtp_conn); |
|
| 239 |
- $this->smtp_conn = 0; |
|
| 240 |
- } |
|
| 241 |
- } |
|
| 242 |
- |
|
| 243 |
- |
|
| 244 |
- /*************************************************************** |
|
| 245 |
- * SMTP COMMANDS * |
|
| 246 |
- *************************************************************/ |
|
| 247 |
- |
|
| 248 |
- /** |
|
| 249 |
- * Issues a data command and sends the msg_data to the server |
|
| 250 |
- * finializing the mail transaction. $msg_data is the message |
|
| 251 |
- * that is to be send with the headers. Each header needs to be |
|
| 252 |
- * on a single line followed by a <CRLF> with the message headers |
|
| 253 |
- * and the message body being seperated by and additional <CRLF>. |
|
| 254 |
- * |
|
| 255 |
- * Implements rfc 821: DATA <CRLF> |
|
| 256 |
- * |
|
| 257 |
- * SMTP CODE INTERMEDIATE: 354 |
|
| 258 |
- * [data] |
|
| 259 |
- * <CRLF>.<CRLF> |
|
| 260 |
- * SMTP CODE SUCCESS: 250 |
|
| 261 |
- * SMTP CODE FAILURE: 552,554,451,452 |
|
| 262 |
- * SMTP CODE FAILURE: 451,554 |
|
| 263 |
- * SMTP CODE ERROR : 500,501,503,421 |
|
| 264 |
- * @access public |
|
| 265 |
- * @return bool |
|
| 266 |
- */ |
|
| 267 |
- function Data($msg_data) {
|
|
| 268 |
- $this->error = null; # so no confusion is caused |
|
| 269 |
- |
|
| 270 |
- if(!$this->connected()) {
|
|
| 271 |
- $this->error = array( |
|
| 272 |
- "error" => "Called Data() without being connected"); |
|
| 273 |
- return false; |
|
| 274 |
- } |
|
| 275 |
- |
|
| 276 |
- fputs($this->smtp_conn,"DATA" . $this->CRLF); |
|
| 277 |
- |
|
| 278 |
- $rply = $this->get_lines(); |
|
| 279 |
- $code = substr($rply,0,3); |
|
| 280 |
- |
|
| 281 |
- if($this->do_debug >= 2) {
|
|
| 282 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 283 |
- } |
|
| 284 |
- |
|
| 285 |
- if($code != 354) {
|
|
| 286 |
- $this->error = |
|
| 287 |
- array("error" => "DATA command not accepted from server",
|
|
| 288 |
- "smtp_code" => $code, |
|
| 289 |
- "smtp_msg" => substr($rply,4)); |
|
| 290 |
- if($this->do_debug >= 1) {
|
|
| 291 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 292 |
- ": " . $rply . $this->CRLF; |
|
| 293 |
- } |
|
| 294 |
- return false; |
|
| 295 |
- } |
|
| 296 |
- |
|
| 297 |
- # the server is ready to accept data! |
|
| 298 |
- # according to rfc 821 we should not send more than 1000 |
|
| 299 |
- # including the CRLF |
|
| 300 |
- # characters on a single line so we will break the data up |
|
| 301 |
- # into lines by \r and/or \n then if needed we will break |
|
| 302 |
- # each of those into smaller lines to fit within the limit. |
|
| 303 |
- # in addition we will be looking for lines that start with |
|
| 304 |
- # a period '.' and append and additional period '.' to that |
|
| 305 |
- # line. NOTE: this does not count towards are limit. |
|
| 306 |
- |
|
| 307 |
- # normalize the line breaks so we know the explode works |
|
| 308 |
- $msg_data = str_replace("\r\n","\n",$msg_data);
|
|
| 309 |
- $msg_data = str_replace("\r","\n",$msg_data);
|
|
| 310 |
- $lines = explode("\n",$msg_data);
|
|
| 311 |
- |
|
| 312 |
- # we need to find a good way to determine is headers are |
|
| 313 |
- # in the msg_data or if it is a straight msg body |
|
| 314 |
- # currently I'm assuming rfc 822 definitions of msg headers |
|
| 315 |
- # and if the first field of the first line (':' sperated)
|
|
| 316 |
- # does not contain a space then it _should_ be a header |
|
| 317 |
- # and we can process all lines before a blank "" line as |
|
| 318 |
- # headers. |
|
| 319 |
- $field = substr($lines[0],0,strpos($lines[0],":")); |
|
| 320 |
- $in_headers = false; |
|
| 321 |
- if(!empty($field) && !strstr($field," ")) {
|
|
| 322 |
- $in_headers = true; |
|
| 323 |
- } |
|
| 324 |
- |
|
| 325 |
- $max_line_length = 998; # used below; set here for ease in change |
|
| 326 |
- |
|
| 327 |
- while(list(,$line) = @each($lines)) {
|
|
| 328 |
- $lines_out = null; |
|
| 329 |
- if($line == "" && $in_headers) {
|
|
| 330 |
- $in_headers = false; |
|
| 331 |
- } |
|
| 332 |
- # ok we need to break this line up into several |
|
| 333 |
- # smaller lines |
|
| 334 |
- while(strlen($line) > $max_line_length) {
|
|
| 335 |
- $pos = strrpos(substr($line,0,$max_line_length)," "); |
|
| 336 |
- |
|
| 337 |
- # Patch to fix DOS attack |
|
| 338 |
- if(!$pos) {
|
|
| 339 |
- $pos = $max_line_length - 1; |
|
| 340 |
- } |
|
| 341 |
- |
|
| 342 |
- $lines_out[] = substr($line,0,$pos); |
|
| 343 |
- $line = substr($line,$pos + 1); |
|
| 344 |
- # if we are processing headers we need to |
|
| 345 |
- # add a LWSP-char to the front of the new line |
|
| 346 |
- # rfc 822 on long msg headers |
|
| 347 |
- if($in_headers) {
|
|
| 348 |
- $line = "\t" . $line; |
|
| 349 |
- } |
|
| 350 |
- } |
|
| 351 |
- $lines_out[] = $line; |
|
| 352 |
- |
|
| 353 |
- # now send the lines to the server |
|
| 354 |
- while(list(,$line_out) = @each($lines_out)) {
|
|
| 355 |
- if(strlen($line_out) > 0) |
|
| 356 |
- {
|
|
| 357 |
- if(substr($line_out, 0, 1) == ".") {
|
|
| 358 |
- $line_out = "." . $line_out; |
|
| 359 |
- } |
|
| 360 |
- } |
|
| 361 |
- fputs($this->smtp_conn,$line_out . $this->CRLF); |
|
| 362 |
- } |
|
| 363 |
- } |
|
| 364 |
- |
|
| 365 |
- # ok all the message data has been sent so lets get this |
|
| 366 |
- # over with aleady |
|
| 367 |
- fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); |
|
| 368 |
- |
|
| 369 |
- $rply = $this->get_lines(); |
|
| 370 |
- $code = substr($rply,0,3); |
|
| 371 |
- |
|
| 372 |
- if($this->do_debug >= 2) {
|
|
| 373 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 374 |
- } |
|
| 375 |
- |
|
| 376 |
- if($code != 250) {
|
|
| 377 |
- $this->error = |
|
| 378 |
- array("error" => "DATA not accepted from server",
|
|
| 379 |
- "smtp_code" => $code, |
|
| 380 |
- "smtp_msg" => substr($rply,4)); |
|
| 381 |
- if($this->do_debug >= 1) {
|
|
| 382 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 383 |
- ": " . $rply . $this->CRLF; |
|
| 384 |
- } |
|
| 385 |
- return false; |
|
| 386 |
- } |
|
| 387 |
- return true; |
|
| 388 |
- } |
|
| 389 |
- |
|
| 390 |
- /** |
|
| 391 |
- * Expand takes the name and asks the server to list all the |
|
| 392 |
- * people who are members of the _list_. Expand will return |
|
| 393 |
- * back and array of the result or false if an error occurs. |
|
| 394 |
- * Each value in the array returned has the format of: |
|
| 395 |
- * [ <full-name> <sp> ] <path> |
|
| 396 |
- * The definition of <path> is defined in rfc 821 |
|
| 397 |
- * |
|
| 398 |
- * Implements rfc 821: EXPN <SP> <string> <CRLF> |
|
| 399 |
- * |
|
| 400 |
- * SMTP CODE SUCCESS: 250 |
|
| 401 |
- * SMTP CODE FAILURE: 550 |
|
| 402 |
- * SMTP CODE ERROR : 500,501,502,504,421 |
|
| 403 |
- * @access public |
|
| 404 |
- * @return string array |
|
| 405 |
- */ |
|
| 406 |
- function Expand($name) {
|
|
| 407 |
- $this->error = null; # so no confusion is caused |
|
| 408 |
- |
|
| 409 |
- if(!$this->connected()) {
|
|
| 410 |
- $this->error = array( |
|
| 411 |
- "error" => "Called Expand() without being connected"); |
|
| 412 |
- return false; |
|
| 413 |
- } |
|
| 414 |
- |
|
| 415 |
- fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF); |
|
| 416 |
- |
|
| 417 |
- $rply = $this->get_lines(); |
|
| 418 |
- $code = substr($rply,0,3); |
|
| 419 |
- |
|
| 420 |
- if($this->do_debug >= 2) {
|
|
| 421 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 422 |
- } |
|
| 423 |
- |
|
| 424 |
- if($code != 250) {
|
|
| 425 |
- $this->error = |
|
| 426 |
- array("error" => "EXPN not accepted from server",
|
|
| 427 |
- "smtp_code" => $code, |
|
| 428 |
- "smtp_msg" => substr($rply,4)); |
|
| 429 |
- if($this->do_debug >= 1) {
|
|
| 430 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 431 |
- ": " . $rply . $this->CRLF; |
|
| 432 |
- } |
|
| 433 |
- return false; |
|
| 434 |
- } |
|
| 435 |
- |
|
| 436 |
- # parse the reply and place in our array to return to user |
|
| 437 |
- $entries = explode($this->CRLF,$rply); |
|
| 438 |
- while(list(,$l) = @each($entries)) {
|
|
| 439 |
- $list[] = substr($l,4); |
|
| 440 |
- } |
|
| 441 |
- |
|
| 442 |
- return $list; |
|
| 443 |
- } |
|
| 444 |
- |
|
| 445 |
- /** |
|
| 446 |
- * Sends the HELO command to the smtp server. |
|
| 447 |
- * This makes sure that we and the server are in |
|
| 448 |
- * the same known state. |
|
| 449 |
- * |
|
| 450 |
- * Implements from rfc 821: HELO <SP> <domain> <CRLF> |
|
| 451 |
- * |
|
| 452 |
- * SMTP CODE SUCCESS: 250 |
|
| 453 |
- * SMTP CODE ERROR : 500, 501, 504, 421 |
|
| 454 |
- * @access public |
|
| 455 |
- * @return bool |
|
| 456 |
- */ |
|
| 457 |
- function Hello($host="") {
|
|
| 458 |
- $this->error = null; # so no confusion is caused |
|
| 459 |
- |
|
| 460 |
- if(!$this->connected()) {
|
|
| 461 |
- $this->error = array( |
|
| 462 |
- "error" => "Called Hello() without being connected"); |
|
| 463 |
- return false; |
|
| 464 |
- } |
|
| 465 |
- |
|
| 466 |
- # if a hostname for the HELO wasn't specified determine |
|
| 467 |
- # a suitable one to send |
|
| 468 |
- if(empty($host)) {
|
|
| 469 |
- # we need to determine some sort of appopiate default |
|
| 470 |
- # to send to the server |
|
| 471 |
- $host = "localhost"; |
|
| 472 |
- } |
|
| 473 |
- |
|
| 474 |
- // Send extended hello first (RFC 2821) |
|
| 475 |
- if(!$this->SendHello("EHLO", $host))
|
|
| 476 |
- {
|
|
| 477 |
- if(!$this->SendHello("HELO", $host))
|
|
| 478 |
- return false; |
|
| 479 |
- } |
|
| 480 |
- |
|
| 481 |
- return true; |
|
| 482 |
- } |
|
| 483 |
- |
|
| 484 |
- /** |
|
| 485 |
- * Sends a HELO/EHLO command. |
|
| 486 |
- * @access private |
|
| 487 |
- * @return bool |
|
| 488 |
- */ |
|
| 489 |
- function SendHello($hello, $host) {
|
|
| 490 |
- fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); |
|
| 491 |
- |
|
| 492 |
- $rply = $this->get_lines(); |
|
| 493 |
- $code = substr($rply,0,3); |
|
| 494 |
- |
|
| 495 |
- if($this->do_debug >= 2) {
|
|
| 496 |
- echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; |
|
| 497 |
- } |
|
| 498 |
- |
|
| 499 |
- if($code != 250) {
|
|
| 500 |
- $this->error = |
|
| 501 |
- array("error" => $hello . " not accepted from server",
|
|
| 502 |
- "smtp_code" => $code, |
|
| 503 |
- "smtp_msg" => substr($rply,4)); |
|
| 504 |
- if($this->do_debug >= 1) {
|
|
| 505 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 506 |
- ": " . $rply . $this->CRLF; |
|
| 507 |
- } |
|
| 508 |
- return false; |
|
| 509 |
- } |
|
| 510 |
- |
|
| 511 |
- $this->helo_rply = $rply; |
|
| 512 |
- |
|
| 513 |
- return true; |
|
| 514 |
- } |
|
| 515 |
- |
|
| 516 |
- /** |
|
| 517 |
- * Gets help information on the keyword specified. If the keyword |
|
| 518 |
- * is not specified then returns generic help, ussually contianing |
|
| 519 |
- * A list of keywords that help is available on. This function |
|
| 520 |
- * returns the results back to the user. It is up to the user to |
|
| 521 |
- * handle the returned data. If an error occurs then false is |
|
| 522 |
- * returned with $this->error set appropiately. |
|
| 523 |
- * |
|
| 524 |
- * Implements rfc 821: HELP [ <SP> <string> ] <CRLF> |
|
| 525 |
- * |
|
| 526 |
- * SMTP CODE SUCCESS: 211,214 |
|
| 527 |
- * SMTP CODE ERROR : 500,501,502,504,421 |
|
| 528 |
- * @access public |
|
| 529 |
- * @return string |
|
| 530 |
- */ |
|
| 531 |
- function Help($keyword="") {
|
|
| 532 |
- $this->error = null; # to avoid confusion |
|
| 533 |
- |
|
| 534 |
- if(!$this->connected()) {
|
|
| 535 |
- $this->error = array( |
|
| 536 |
- "error" => "Called Help() without being connected"); |
|
| 537 |
- return false; |
|
| 538 |
- } |
|
| 539 |
- |
|
| 540 |
- $extra = ""; |
|
| 541 |
- if(!empty($keyword)) {
|
|
| 542 |
- $extra = " " . $keyword; |
|
| 543 |
- } |
|
| 544 |
- |
|
| 545 |
- fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF); |
|
| 546 |
- |
|
| 547 |
- $rply = $this->get_lines(); |
|
| 548 |
- $code = substr($rply,0,3); |
|
| 549 |
- |
|
| 550 |
- if($this->do_debug >= 2) {
|
|
| 551 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 552 |
- } |
|
| 553 |
- |
|
| 554 |
- if($code != 211 && $code != 214) {
|
|
| 555 |
- $this->error = |
|
| 556 |
- array("error" => "HELP not accepted from server",
|
|
| 557 |
- "smtp_code" => $code, |
|
| 558 |
- "smtp_msg" => substr($rply,4)); |
|
| 559 |
- if($this->do_debug >= 1) {
|
|
| 560 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 561 |
- ": " . $rply . $this->CRLF; |
|
| 562 |
- } |
|
| 563 |
- return false; |
|
| 564 |
- } |
|
| 565 |
- |
|
| 566 |
- return $rply; |
|
| 567 |
- } |
|
| 568 |
- |
|
| 569 |
- /** |
|
| 570 |
- * Starts a mail transaction from the email address specified in |
|
| 571 |
- * $from. Returns true if successful or false otherwise. If True |
|
| 572 |
- * the mail transaction is started and then one or more Recipient |
|
| 573 |
- * commands may be called followed by a Data command. |
|
| 574 |
- * |
|
| 575 |
- * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF> |
|
| 576 |
- * |
|
| 577 |
- * SMTP CODE SUCCESS: 250 |
|
| 578 |
- * SMTP CODE SUCCESS: 552,451,452 |
|
| 579 |
- * SMTP CODE SUCCESS: 500,501,421 |
|
| 580 |
- * @access public |
|
| 581 |
- * @return bool |
|
| 582 |
- */ |
|
| 583 |
- function Mail($from) {
|
|
| 584 |
- $this->error = null; # so no confusion is caused |
|
| 585 |
- |
|
| 586 |
- if(!$this->connected()) {
|
|
| 587 |
- $this->error = array( |
|
| 588 |
- "error" => "Called Mail() without being connected"); |
|
| 589 |
- return false; |
|
| 590 |
- } |
|
| 591 |
- |
|
| 592 |
- fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF); |
|
| 593 |
- |
|
| 594 |
- $rply = $this->get_lines(); |
|
| 595 |
- $code = substr($rply,0,3); |
|
| 596 |
- |
|
| 597 |
- if($this->do_debug >= 2) {
|
|
| 598 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 599 |
- } |
|
| 600 |
- |
|
| 601 |
- if($code != 250) {
|
|
| 602 |
- $this->error = |
|
| 603 |
- array("error" => "MAIL not accepted from server",
|
|
| 604 |
- "smtp_code" => $code, |
|
| 605 |
- "smtp_msg" => substr($rply,4)); |
|
| 606 |
- if($this->do_debug >= 1) {
|
|
| 607 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 608 |
- ": " . $rply . $this->CRLF; |
|
| 609 |
- } |
|
| 610 |
- return false; |
|
| 611 |
- } |
|
| 612 |
- return true; |
|
| 613 |
- } |
|
| 614 |
- |
|
| 615 |
- /** |
|
| 616 |
- * Sends the command NOOP to the SMTP server. |
|
| 617 |
- * |
|
| 618 |
- * Implements from rfc 821: NOOP <CRLF> |
|
| 619 |
- * |
|
| 620 |
- * SMTP CODE SUCCESS: 250 |
|
| 621 |
- * SMTP CODE ERROR : 500, 421 |
|
| 622 |
- * @access public |
|
| 623 |
- * @return bool |
|
| 624 |
- */ |
|
| 625 |
- function Noop() {
|
|
| 626 |
- $this->error = null; # so no confusion is caused |
|
| 627 |
- |
|
| 628 |
- if(!$this->connected()) {
|
|
| 629 |
- $this->error = array( |
|
| 630 |
- "error" => "Called Noop() without being connected"); |
|
| 631 |
- return false; |
|
| 632 |
- } |
|
| 633 |
- |
|
| 634 |
- fputs($this->smtp_conn,"NOOP" . $this->CRLF); |
|
| 635 |
- |
|
| 636 |
- $rply = $this->get_lines(); |
|
| 637 |
- $code = substr($rply,0,3); |
|
| 638 |
- |
|
| 639 |
- if($this->do_debug >= 2) {
|
|
| 640 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 641 |
- } |
|
| 642 |
- |
|
| 643 |
- if($code != 250) {
|
|
| 644 |
- $this->error = |
|
| 645 |
- array("error" => "NOOP not accepted from server",
|
|
| 646 |
- "smtp_code" => $code, |
|
| 647 |
- "smtp_msg" => substr($rply,4)); |
|
| 648 |
- if($this->do_debug >= 1) {
|
|
| 649 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 650 |
- ": " . $rply . $this->CRLF; |
|
| 651 |
- } |
|
| 652 |
- return false; |
|
| 653 |
- } |
|
| 654 |
- return true; |
|
| 655 |
- } |
|
| 656 |
- |
|
| 657 |
- /** |
|
| 658 |
- * Sends the quit command to the server and then closes the socket |
|
| 659 |
- * if there is no error or the $close_on_error argument is true. |
|
| 660 |
- * |
|
| 661 |
- * Implements from rfc 821: QUIT <CRLF> |
|
| 662 |
- * |
|
| 663 |
- * SMTP CODE SUCCESS: 221 |
|
| 664 |
- * SMTP CODE ERROR : 500 |
|
| 665 |
- * @access public |
|
| 666 |
- * @return bool |
|
| 667 |
- */ |
|
| 668 |
- function Quit($close_on_error=true) {
|
|
| 669 |
- $this->error = null; # so there is no confusion |
|
| 670 |
- |
|
| 671 |
- if(!$this->connected()) {
|
|
| 672 |
- $this->error = array( |
|
| 673 |
- "error" => "Called Quit() without being connected"); |
|
| 674 |
- return false; |
|
| 675 |
- } |
|
| 676 |
- |
|
| 677 |
- # send the quit command to the server |
|
| 678 |
- fputs($this->smtp_conn,"quit" . $this->CRLF); |
|
| 679 |
- |
|
| 680 |
- # get any good-bye messages |
|
| 681 |
- $byemsg = $this->get_lines(); |
|
| 682 |
- |
|
| 683 |
- if($this->do_debug >= 2) {
|
|
| 684 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; |
|
| 685 |
- } |
|
| 686 |
- |
|
| 687 |
- $rval = true; |
|
| 688 |
- $e = null; |
|
| 689 |
- |
|
| 690 |
- $code = substr($byemsg,0,3); |
|
| 691 |
- if($code != 221) {
|
|
| 692 |
- # use e as a tmp var cause Close will overwrite $this->error |
|
| 693 |
- $e = array("error" => "SMTP server rejected quit command",
|
|
| 694 |
- "smtp_code" => $code, |
|
| 695 |
- "smtp_rply" => substr($byemsg,4)); |
|
| 696 |
- $rval = false; |
|
| 697 |
- if($this->do_debug >= 1) {
|
|
| 698 |
- echo "SMTP -> ERROR: " . $e["error"] . ": " . |
|
| 699 |
- $byemsg . $this->CRLF; |
|
| 700 |
- } |
|
| 701 |
- } |
|
| 702 |
- |
|
| 703 |
- if(empty($e) || $close_on_error) {
|
|
| 704 |
- $this->Close(); |
|
| 705 |
- } |
|
| 706 |
- |
|
| 707 |
- return $rval; |
|
| 708 |
- } |
|
| 709 |
- |
|
| 710 |
- /** |
|
| 711 |
- * Sends the command RCPT to the SMTP server with the TO: argument of $to. |
|
| 712 |
- * Returns true if the recipient was accepted false if it was rejected. |
|
| 713 |
- * |
|
| 714 |
- * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF> |
|
| 715 |
- * |
|
| 716 |
- * SMTP CODE SUCCESS: 250,251 |
|
| 717 |
- * SMTP CODE FAILURE: 550,551,552,553,450,451,452 |
|
| 718 |
- * SMTP CODE ERROR : 500,501,503,421 |
|
| 719 |
- * @access public |
|
| 720 |
- * @return bool |
|
| 721 |
- */ |
|
| 722 |
- function Recipient($to) {
|
|
| 723 |
- $this->error = null; # so no confusion is caused |
|
| 724 |
- |
|
| 725 |
- if(!$this->connected()) {
|
|
| 726 |
- $this->error = array( |
|
| 727 |
- "error" => "Called Recipient() without being connected"); |
|
| 728 |
- return false; |
|
| 729 |
- } |
|
| 730 |
- |
|
| 731 |
- fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); |
|
| 732 |
- |
|
| 733 |
- $rply = $this->get_lines(); |
|
| 734 |
- $code = substr($rply,0,3); |
|
| 735 |
- |
|
| 736 |
- if($this->do_debug >= 2) {
|
|
| 737 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 738 |
- } |
|
| 739 |
- |
|
| 740 |
- if($code != 250 && $code != 251) {
|
|
| 741 |
- $this->error = |
|
| 742 |
- array("error" => "RCPT not accepted from server",
|
|
| 743 |
- "smtp_code" => $code, |
|
| 744 |
- "smtp_msg" => substr($rply,4)); |
|
| 745 |
- if($this->do_debug >= 1) {
|
|
| 746 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 747 |
- ": " . $rply . $this->CRLF; |
|
| 748 |
- } |
|
| 749 |
- return false; |
|
| 750 |
- } |
|
| 751 |
- return true; |
|
| 752 |
- } |
|
| 753 |
- |
|
| 754 |
- /** |
|
| 755 |
- * Sends the RSET command to abort and transaction that is |
|
| 756 |
- * currently in progress. Returns true if successful false |
|
| 757 |
- * otherwise. |
|
| 758 |
- * |
|
| 759 |
- * Implements rfc 821: RSET <CRLF> |
|
| 760 |
- * |
|
| 761 |
- * SMTP CODE SUCCESS: 250 |
|
| 762 |
- * SMTP CODE ERROR : 500,501,504,421 |
|
| 763 |
- * @access public |
|
| 764 |
- * @return bool |
|
| 765 |
- */ |
|
| 766 |
- function Reset() {
|
|
| 767 |
- $this->error = null; # so no confusion is caused |
|
| 768 |
- |
|
| 769 |
- if(!$this->connected()) {
|
|
| 770 |
- $this->error = array( |
|
| 771 |
- "error" => "Called Reset() without being connected"); |
|
| 772 |
- return false; |
|
| 773 |
- } |
|
| 774 |
- |
|
| 775 |
- fputs($this->smtp_conn,"RSET" . $this->CRLF); |
|
| 776 |
- |
|
| 777 |
- $rply = $this->get_lines(); |
|
| 778 |
- $code = substr($rply,0,3); |
|
| 779 |
- |
|
| 780 |
- if($this->do_debug >= 2) {
|
|
| 781 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 782 |
- } |
|
| 783 |
- |
|
| 784 |
- if($code != 250) {
|
|
| 785 |
- $this->error = |
|
| 786 |
- array("error" => "RSET failed",
|
|
| 787 |
- "smtp_code" => $code, |
|
| 788 |
- "smtp_msg" => substr($rply,4)); |
|
| 789 |
- if($this->do_debug >= 1) {
|
|
| 790 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 791 |
- ": " . $rply . $this->CRLF; |
|
| 792 |
- } |
|
| 793 |
- return false; |
|
| 794 |
- } |
|
| 795 |
- |
|
| 796 |
- return true; |
|
| 797 |
- } |
|
| 798 |
- |
|
| 799 |
- /** |
|
| 800 |
- * Starts a mail transaction from the email address specified in |
|
| 801 |
- * $from. Returns true if successful or false otherwise. If True |
|
| 802 |
- * the mail transaction is started and then one or more Recipient |
|
| 803 |
- * commands may be called followed by a Data command. This command |
|
| 804 |
- * will send the message to the users terminal if they are logged |
|
| 805 |
- * in. |
|
| 806 |
- * |
|
| 807 |
- * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF> |
|
| 808 |
- * |
|
| 809 |
- * SMTP CODE SUCCESS: 250 |
|
| 810 |
- * SMTP CODE SUCCESS: 552,451,452 |
|
| 811 |
- * SMTP CODE SUCCESS: 500,501,502,421 |
|
| 812 |
- * @access public |
|
| 813 |
- * @return bool |
|
| 814 |
- */ |
|
| 815 |
- function Send($from) {
|
|
| 816 |
- $this->error = null; # so no confusion is caused |
|
| 817 |
- |
|
| 818 |
- if(!$this->connected()) {
|
|
| 819 |
- $this->error = array( |
|
| 820 |
- "error" => "Called Send() without being connected"); |
|
| 821 |
- return false; |
|
| 822 |
- } |
|
| 823 |
- |
|
| 824 |
- fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF); |
|
| 825 |
- |
|
| 826 |
- $rply = $this->get_lines(); |
|
| 827 |
- $code = substr($rply,0,3); |
|
| 828 |
- |
|
| 829 |
- if($this->do_debug >= 2) {
|
|
| 830 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 831 |
- } |
|
| 832 |
- |
|
| 833 |
- if($code != 250) {
|
|
| 834 |
- $this->error = |
|
| 835 |
- array("error" => "SEND not accepted from server",
|
|
| 836 |
- "smtp_code" => $code, |
|
| 837 |
- "smtp_msg" => substr($rply,4)); |
|
| 838 |
- if($this->do_debug >= 1) {
|
|
| 839 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 840 |
- ": " . $rply . $this->CRLF; |
|
| 841 |
- } |
|
| 842 |
- return false; |
|
| 843 |
- } |
|
| 844 |
- return true; |
|
| 845 |
- } |
|
| 846 |
- |
|
| 847 |
- /** |
|
| 848 |
- * Starts a mail transaction from the email address specified in |
|
| 849 |
- * $from. Returns true if successful or false otherwise. If True |
|
| 850 |
- * the mail transaction is started and then one or more Recipient |
|
| 851 |
- * commands may be called followed by a Data command. This command |
|
| 852 |
- * will send the message to the users terminal if they are logged |
|
| 853 |
- * in and send them an email. |
|
| 854 |
- * |
|
| 855 |
- * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF> |
|
| 856 |
- * |
|
| 857 |
- * SMTP CODE SUCCESS: 250 |
|
| 858 |
- * SMTP CODE SUCCESS: 552,451,452 |
|
| 859 |
- * SMTP CODE SUCCESS: 500,501,502,421 |
|
| 860 |
- * @access public |
|
| 861 |
- * @return bool |
|
| 862 |
- */ |
|
| 863 |
- function SendAndMail($from) {
|
|
| 864 |
- $this->error = null; # so no confusion is caused |
|
| 865 |
- |
|
| 866 |
- if(!$this->connected()) {
|
|
| 867 |
- $this->error = array( |
|
| 868 |
- "error" => "Called SendAndMail() without being connected"); |
|
| 869 |
- return false; |
|
| 870 |
- } |
|
| 871 |
- |
|
| 872 |
- fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); |
|
| 873 |
- |
|
| 874 |
- $rply = $this->get_lines(); |
|
| 875 |
- $code = substr($rply,0,3); |
|
| 876 |
- |
|
| 877 |
- if($this->do_debug >= 2) {
|
|
| 878 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 879 |
- } |
|
| 880 |
- |
|
| 881 |
- if($code != 250) {
|
|
| 882 |
- $this->error = |
|
| 883 |
- array("error" => "SAML not accepted from server",
|
|
| 884 |
- "smtp_code" => $code, |
|
| 885 |
- "smtp_msg" => substr($rply,4)); |
|
| 886 |
- if($this->do_debug >= 1) {
|
|
| 887 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 888 |
- ": " . $rply . $this->CRLF; |
|
| 889 |
- } |
|
| 890 |
- return false; |
|
| 891 |
- } |
|
| 892 |
- return true; |
|
| 893 |
- } |
|
| 894 |
- |
|
| 895 |
- /** |
|
| 896 |
- * Starts a mail transaction from the email address specified in |
|
| 897 |
- * $from. Returns true if successful or false otherwise. If True |
|
| 898 |
- * the mail transaction is started and then one or more Recipient |
|
| 899 |
- * commands may be called followed by a Data command. This command |
|
| 900 |
- * will send the message to the users terminal if they are logged |
|
| 901 |
- * in or mail it to them if they are not. |
|
| 902 |
- * |
|
| 903 |
- * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF> |
|
| 904 |
- * |
|
| 905 |
- * SMTP CODE SUCCESS: 250 |
|
| 906 |
- * SMTP CODE SUCCESS: 552,451,452 |
|
| 907 |
- * SMTP CODE SUCCESS: 500,501,502,421 |
|
| 908 |
- * @access public |
|
| 909 |
- * @return bool |
|
| 910 |
- */ |
|
| 911 |
- function SendOrMail($from) {
|
|
| 912 |
- $this->error = null; # so no confusion is caused |
|
| 913 |
- |
|
| 914 |
- if(!$this->connected()) {
|
|
| 915 |
- $this->error = array( |
|
| 916 |
- "error" => "Called SendOrMail() without being connected"); |
|
| 917 |
- return false; |
|
| 918 |
- } |
|
| 919 |
- |
|
| 920 |
- fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF); |
|
| 921 |
- |
|
| 922 |
- $rply = $this->get_lines(); |
|
| 923 |
- $code = substr($rply,0,3); |
|
| 924 |
- |
|
| 925 |
- if($this->do_debug >= 2) {
|
|
| 926 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 927 |
- } |
|
| 928 |
- |
|
| 929 |
- if($code != 250) {
|
|
| 930 |
- $this->error = |
|
| 931 |
- array("error" => "SOML not accepted from server",
|
|
| 932 |
- "smtp_code" => $code, |
|
| 933 |
- "smtp_msg" => substr($rply,4)); |
|
| 934 |
- if($this->do_debug >= 1) {
|
|
| 935 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 936 |
- ": " . $rply . $this->CRLF; |
|
| 937 |
- } |
|
| 938 |
- return false; |
|
| 939 |
- } |
|
| 940 |
- return true; |
|
| 941 |
- } |
|
| 942 |
- |
|
| 943 |
- /** |
|
| 944 |
- * This is an optional command for SMTP that this class does not |
|
| 945 |
- * support. This method is here to make the RFC821 Definition |
|
| 946 |
- * complete for this class and __may__ be implimented in the future |
|
| 947 |
- * |
|
| 948 |
- * Implements from rfc 821: TURN <CRLF> |
|
| 949 |
- * |
|
| 950 |
- * SMTP CODE SUCCESS: 250 |
|
| 951 |
- * SMTP CODE FAILURE: 502 |
|
| 952 |
- * SMTP CODE ERROR : 500, 503 |
|
| 953 |
- * @access public |
|
| 954 |
- * @return bool |
|
| 955 |
- */ |
|
| 956 |
- function Turn() {
|
|
| 957 |
- $this->error = array("error" => "This method, TURN, of the SMTP ".
|
|
| 958 |
- "is not implemented"); |
|
| 959 |
- if($this->do_debug >= 1) {
|
|
| 960 |
- echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; |
|
| 961 |
- } |
|
| 962 |
- return false; |
|
| 963 |
- } |
|
| 964 |
- |
|
| 965 |
- /** |
|
| 966 |
- * Verifies that the name is recognized by the server. |
|
| 967 |
- * Returns false if the name could not be verified otherwise |
|
| 968 |
- * the response from the server is returned. |
|
| 969 |
- * |
|
| 970 |
- * Implements rfc 821: VRFY <SP> <string> <CRLF> |
|
| 971 |
- * |
|
| 972 |
- * SMTP CODE SUCCESS: 250,251 |
|
| 973 |
- * SMTP CODE FAILURE: 550,551,553 |
|
| 974 |
- * SMTP CODE ERROR : 500,501,502,421 |
|
| 975 |
- * @access public |
|
| 976 |
- * @return int |
|
| 977 |
- */ |
|
| 978 |
- function Verify($name) {
|
|
| 979 |
- $this->error = null; # so no confusion is caused |
|
| 980 |
- |
|
| 981 |
- if(!$this->connected()) {
|
|
| 982 |
- $this->error = array( |
|
| 983 |
- "error" => "Called Verify() without being connected"); |
|
| 984 |
- return false; |
|
| 985 |
- } |
|
| 986 |
- |
|
| 987 |
- fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF); |
|
| 988 |
- |
|
| 989 |
- $rply = $this->get_lines(); |
|
| 990 |
- $code = substr($rply,0,3); |
|
| 991 |
- |
|
| 992 |
- if($this->do_debug >= 2) {
|
|
| 993 |
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; |
|
| 994 |
- } |
|
| 995 |
- |
|
| 996 |
- if($code != 250 && $code != 251) {
|
|
| 997 |
- $this->error = |
|
| 998 |
- array("error" => "VRFY failed on name '$name'",
|
|
| 999 |
- "smtp_code" => $code, |
|
| 1000 |
- "smtp_msg" => substr($rply,4)); |
|
| 1001 |
- if($this->do_debug >= 1) {
|
|
| 1002 |
- echo "SMTP -> ERROR: " . $this->error["error"] . |
|
| 1003 |
- ": " . $rply . $this->CRLF; |
|
| 1004 |
- } |
|
| 1005 |
- return false; |
|
| 1006 |
- } |
|
| 1007 |
- return $rply; |
|
| 1008 |
- } |
|
| 1009 |
- |
|
| 1010 |
- /******************************************************************* |
|
| 1011 |
- * INTERNAL FUNCTIONS * |
|
| 1012 |
- ******************************************************************/ |
|
| 1013 |
- |
|
| 1014 |
- /** |
|
| 1015 |
- * Read in as many lines as possible |
|
| 1016 |
- * either before eof or socket timeout occurs on the operation. |
|
| 1017 |
- * With SMTP we can tell if we have more lines to read if the |
|
| 1018 |
- * 4th character is '-' symbol. If it is a space then we don't |
|
| 1019 |
- * need to read anything else. |
|
| 1020 |
- * @access private |
|
| 1021 |
- * @return string |
|
| 1022 |
- */ |
|
| 1023 |
- function get_lines() {
|
|
| 1024 |
- $data = ""; |
|
| 1025 |
- while($str = fgets($this->smtp_conn,515)) {
|
|
| 1026 |
- if($this->do_debug >= 4) {
|
|
| 1027 |
- echo "SMTP -> get_lines(): \$data was \"$data\"" . |
|
| 1028 |
- $this->CRLF; |
|
| 1029 |
- echo "SMTP -> get_lines(): \$str is \"$str\"" . |
|
| 1030 |
- $this->CRLF; |
|
| 1031 |
- } |
|
| 1032 |
- $data .= $str; |
|
| 1033 |
- if($this->do_debug >= 4) {
|
|
| 1034 |
- echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; |
|
| 1035 |
- } |
|
| 1036 |
- # if the 4th character is a space then we are done reading |
|
| 1037 |
- # so just break the loop |
|
| 1038 |
- if(substr($str,3,1) == " ") { break; }
|
|
| 1039 |
- } |
|
| 1040 |
- return $data; |
|
| 1041 |
- } |
|
| 1042 |
- |
|
| 1043 |
-} |
|
| 1044 |
- |
|
| 1045 |
- |
|
| 1046 |
- ?> |
|
| 1047 | 0 |
\ No newline at end of file |
| 1048 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Armenian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Hrayr Grigoryan <hrayr@bits.am> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP -ի սխալ: չհաջողվեց ստուգել իսկությունը.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP -ի սխալ: չհաջողվեց կապ հաստատել SMTP սերվերի հետ.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP -ի սխալ: տվյալները ընդունված չեն.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Հաղորդագրությունը դատարկ է'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Կոդավորման անհայտ տեսակ: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Չհաջողվեց իրականացնել հրամանը: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Ֆայլը հասանելի չէ: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Ֆայլի սխալ: ֆայլը չհաջողվեց բացել: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Ուղարկողի հետևյալ հասցեն սխալ է: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Հնարավոր չէ կանչել mail ֆունկցիան.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Հասցեն սխալ է: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' փոստային սերվերի հետ չի աշխատում.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Անհրաժեշտ է տրամադրել գոնե մեկ ստացողի e-mail հասցե.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP -ի սխալ: չի հաջողվել ուղարկել հետևյալ ստացողների հասցեներին: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Ստորագրման սխալ: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP -ի connect() ֆունկցիան չի հաջողվել'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP սերվերի սխալ: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Չի հաջողվում ստեղծել կամ վերափոխել փոփոխականը: '; |
|
| 26 |
+$PHPMAILER_LANG['extension_missing'] = 'Հավելվածը բացակայում է: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Arabic PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author bahjat al mostafa <bahjat983@hotmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'خطأ SMTP : لا يمكن تأكيد الهوية.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'خطأ SMTP: لا يمكن الاتصال بالخادم SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'خطأ SMTP: لم يتم قبول المعلومات .'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'نص الرسالة فارغ'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'ترميز غير معروف: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'لا يمكن تنفيذ : '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'لا يمكن الوصول للملف: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'خطأ في الملف: لا يمكن فتحه: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'خطأ على مستوى عنوان المرسل : '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'لا يمكن توفير خدمة البريد.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالح: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية ' . |
|
| 22 |
+ 'فشل في الارسال لكل من : '; |
|
| 23 |
+$PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: '; |
|
| 24 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.'; |
|
| 25 |
+$PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: '; |
|
| 26 |
+$PHPMAILER_LANG['variable_set'] = 'لا يمكن تعيين أو إعادة تعيين متغير: '; |
|
| 27 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Azerbaijani PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author @mirjalal |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP xətası: Giriş uğursuz oldu.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP xətası: SMTP serverinə qoşulma uğursuz oldu.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP xətası: Verilənlər qəbul edilməyib.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Boş mesaj göndərilə bilməz.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Qeyri-müəyyən kodlaşdırma: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Əmr yerinə yetirilmədi: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Fayla giriş yoxdur: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Fayl xətası: Fayl açıla bilmədi: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Göstərilən poçtlara göndərmə uğursuz oldu: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Mail funksiyası işə salına bilmədi.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Düzgün olmayan e-mail adresi: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' - e-mail kitabxanası dəstəklənmir.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Ən azı bir e-mail adresi daxil edilməlidir.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP xətası: Aşağıdakı ünvanlar üzrə alıcılara göndərmə uğursuzdur: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'İmzalama xətası: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP serverinə qoşulma uğursuz oldu.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri xətası: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Dəyişənin quraşdırılması uğursuz oldu: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Belarusian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Aleksander Maksymiuk <info@setpro.pl> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Памылка SMTP: памылка ідэнтыфікацыі.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Памылка SMTP: нельга ўстанавіць сувязь з SMTP-серверам.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Памылка SMTP: звесткі непрынятыя.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Пустое паведамленне.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Невядомая кадыроўка тэксту: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Нельга выканаць каманду: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Няма доступу да файла: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Нельга адкрыць файл: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Няправільны адрас адпраўніка: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Нельга прымяніць функцыю mail().'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Нельга даслаць паведамленне, няправільны email атрымальніка: '; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Запоўніце, калі ласка, правільны email атрымальніка.'; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' - паштовы сервер не падтрымліваецца.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Памылка SMTP: няправільныя атрымальнікі: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Памылка подпісу паведамлення: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Памылка сувязі з SMTP-серверам.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Памылка SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Нельга ўстанавіць або перамяніць значэнне пераменнай: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Bulgarian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Mikhail Kyosev <mialygk@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: Не може да се удостовери пред сървъра.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: Не може да се свърже с SMTP хоста.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: данните не са приети.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Съдържанието на съобщението е празно'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Неизвестно кодиране: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Не може да се изпълни: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Няма достъп до файл: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Файлова грешка: Не може да се отвори файл: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Следните адреси за подател са невалидни: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Не може да се инстанцира функцията mail.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Невалиден адрес: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' - пощенски сървър не се поддържа.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Трябва да предоставите поне един email адрес за получател.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: Следните адреси за Получател са невалидни: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Грешка при подписване: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP провален connect().'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP сървърна грешка: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Не може да се установи или възстанови променлива: '; |
|
| 26 |
+$PHPMAILER_LANG['extension_missing'] = 'Липсва разширение: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,28 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Brazilian Portuguese PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Paulo Henrique Garcia <paulo@controllerweb.com.br> |
|
| 6 |
+ * @author Lucas Guimarães <lucas@lucasguimaraes.com> |
|
| 7 |
+ * @author Phelipe Alves <phelipealvesdesouza@gmail.com> |
|
| 8 |
+ */ |
|
| 9 |
+ |
|
| 10 |
+$PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.'; |
|
| 11 |
+$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.'; |
|
| 12 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados rejeitados.'; |
|
| 13 |
+$PHPMAILER_LANG['empty_message'] = 'Corpo da mensagem vazio'; |
|
| 14 |
+$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; |
|
| 15 |
+$PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; |
|
| 16 |
+$PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: '; |
|
| 17 |
+$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: '; |
|
| 18 |
+$PHPMAILER_LANG['from_failed'] = 'Os endereços dos remententes a seguir falharam: '; |
|
| 19 |
+$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.'; |
|
| 20 |
+$PHPMAILER_LANG['invalid_address'] = 'Não enviando, endereço de e-mail inválido: '; |
|
| 21 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; |
|
| 22 |
+$PHPMAILER_LANG['provide_address'] = 'Você deve fornecer pelo menos um endereço de destinatário de e-mail.'; |
|
| 23 |
+$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: '; |
|
| 24 |
+$PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; |
|
| 25 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; |
|
| 26 |
+$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; |
|
| 27 |
+$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou resetar a variável: '; |
|
| 28 |
+$PHPMAILER_LANG['extension_missing'] = 'Extensão ausente: '; |
| 0 | 29 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Catalan PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Ivan <web AT microstudi DOT com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No s’ha pogut autenticar.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No es pot connectar al servidor SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Dades no acceptades.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'El cos del missatge està buit.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Codificació desconeguda: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'No es pot executar: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'No es pot accedir a l’arxiu: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Error d’Arxiu: No es pot obrir l’arxiu: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'La(s) següent(s) adreces de remitent han fallat: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'No s’ha pogut crear una instància de la funció Mail.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Adreça d’email invalida: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no està suportat'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'S’ha de proveir almenys una adreça d’email com a destinatari.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Els següents destinataris han fallat: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Error al signar: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Ha fallat el SMTP Connect().'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'No s’ha pogut establir o restablir la variable: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Chinese PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author LiuXin <http://www.80x86.cn/blog/> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验证失败。'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: 不能连接SMTP主机。'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: 数据不可接受。'; |
|
| 11 |
+//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = '未知编码:'; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = '不能执行: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = '不能访问文件:'; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = '文件错误:不能打开文件:'; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = '下面的发送地址邮件发送失败了: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = '不能实现mail方法。'; |
|
| 18 |
+//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的发送邮件的方法并不支持。'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = '您必须提供至少一个 收信人的email地址。'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下面的 收件人失败了: '; |
|
| 22 |
+//$PHPMAILER_LANG['signing'] = 'Signing Error: '; |
|
| 23 |
+//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
|
| 24 |
+//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; |
|
| 25 |
+//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,25 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Czech PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ */ |
|
| 6 |
+ |
|
| 7 |
+$PHPMAILER_LANG['authenticate'] = 'Chyba SMTP: Autentizace selhala.'; |
|
| 8 |
+$PHPMAILER_LANG['connect_host'] = 'Chyba SMTP: Nelze navázat spojení se SMTP serverem.'; |
|
| 9 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Chyba SMTP: Data nebyla přijata.'; |
|
| 10 |
+$PHPMAILER_LANG['empty_message'] = 'Prázdné tělo zprávy'; |
|
| 11 |
+$PHPMAILER_LANG['encoding'] = 'Neznámé kódování: '; |
|
| 12 |
+$PHPMAILER_LANG['execute'] = 'Nelze provést: '; |
|
| 13 |
+$PHPMAILER_LANG['file_access'] = 'Nelze získat přístup k souboru: '; |
|
| 14 |
+$PHPMAILER_LANG['file_open'] = 'Chyba souboru: Nelze otevřít soubor pro čtení: '; |
|
| 15 |
+$PHPMAILER_LANG['from_failed'] = 'Následující adresa odesílatele je nesprávná: '; |
|
| 16 |
+$PHPMAILER_LANG['instantiate'] = 'Nelze vytvořit instanci emailové funkce.'; |
|
| 17 |
+$PHPMAILER_LANG['invalid_address'] = 'Neplatná adresa: '; |
|
| 18 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer není podporován.'; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Musíte zadat alespoň jednu emailovou adresu příjemce.'; |
|
| 20 |
+$PHPMAILER_LANG['recipients_failed'] = 'Chyba SMTP: Následující adresy příjemců nejsou správně: '; |
|
| 21 |
+$PHPMAILER_LANG['signing'] = 'Chyba přihlašování: '; |
|
| 22 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() selhal.'; |
|
| 23 |
+$PHPMAILER_LANG['smtp_error'] = 'Chyba SMTP serveru: '; |
|
| 24 |
+$PHPMAILER_LANG['variable_set'] = 'Nelze nastavit nebo změnit proměnnou: '; |
|
| 25 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 26 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,25 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * German PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ */ |
|
| 6 |
+ |
|
| 7 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.'; |
|
| 8 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.'; |
|
| 9 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Fehler: Daten werden nicht akzeptiert.'; |
|
| 10 |
+$PHPMAILER_LANG['empty_message'] = 'E-Mail Inhalt ist leer.'; |
|
| 11 |
+$PHPMAILER_LANG['encoding'] = 'Unbekanntes Encoding-Format: '; |
|
| 12 |
+$PHPMAILER_LANG['execute'] = 'Konnte folgenden Befehl nicht ausführen: '; |
|
| 13 |
+$PHPMAILER_LANG['file_access'] = 'Zugriff auf folgende Datei fehlgeschlagen: '; |
|
| 14 |
+$PHPMAILER_LANG['file_open'] = 'Datei Fehler: konnte folgende Datei nicht öffnen: '; |
|
| 15 |
+$PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: '; |
|
| 16 |
+$PHPMAILER_LANG['instantiate'] = 'Mail Funktion konnte nicht initialisiert werden.'; |
|
| 17 |
+$PHPMAILER_LANG['invalid_address'] = 'E-Mail wird nicht gesendet, die Adresse ist ungültig: '; |
|
| 18 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.'; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfänger E-Mailadresse an.'; |
|
| 20 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Fehler: Die folgenden Empfänger sind nicht korrekt: '; |
|
| 21 |
+$PHPMAILER_LANG['signing'] = 'Fehler beim Signieren: '; |
|
| 22 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Verbindung zu SMTP Server fehlgeschlagen.'; |
|
| 23 |
+$PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP Server: '; |
|
| 24 |
+$PHPMAILER_LANG['variable_set'] = 'Kann Variable nicht setzen oder zurücksetzen: '; |
|
| 25 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 26 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Danish PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Mikael Stokkebro <info@stokkebro.dk> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge på.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.'; |
|
| 11 |
+//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.'; |
|
| 18 |
+//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: '; |
|
| 22 |
+//$PHPMAILER_LANG['signing'] = 'Signing Error: '; |
|
| 23 |
+//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
|
| 24 |
+//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; |
|
| 25 |
+//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,25 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Greek PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ */ |
|
| 6 |
+ |
|
| 7 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Σφάλμα: Αδυναμία πιστοποίησης (authentication).'; |
|
| 8 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Σφάλμα: Αδυναμία σύνδεσης στον SMTP-Host.'; |
|
| 9 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Σφάλμα: Τα δεδομένα δεν έγιναν αποδεκτά.'; |
|
| 10 |
+$PHPMAILER_LANG['empty_message'] = 'Το E-Mail δεν έχει περιεχόμενο .'; |
|
| 11 |
+$PHPMAILER_LANG['encoding'] = 'Αγνωστο Encoding-Format: '; |
|
| 12 |
+$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτέλεσης ακόλουθης εντολής: '; |
|
| 13 |
+$PHPMAILER_LANG['file_access'] = 'Αδυναμία προσπέλασης του αρχείου: '; |
|
| 14 |
+$PHPMAILER_LANG['file_open'] = 'Σφάλμα Αρχείου: Δεν είναι δυνατό το άνοιγμα του ακόλουθου αρχείου: '; |
|
| 15 |
+$PHPMAILER_LANG['from_failed'] = 'Η παρακάτω διεύθυνση αποστολέα δεν είναι σωστή: '; |
|
| 16 |
+$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης Mail function.'; |
|
| 17 |
+$PHPMAILER_LANG['invalid_address'] = 'Το μήνυμα δεν εστάλη, η διεύθυνση δεν είναι έγκυρη: '; |
|
| 18 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer δεν υποστηρίζεται.'; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Παρακαλούμε δώστε τουλάχιστον μια e-mail διεύθυνση παραλήπτη.'; |
|
| 20 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Σφάλμα: Οι παρακάτω διευθύνσεις παραλήπτη δεν είναι έγκυρες: '; |
|
| 21 |
+$PHPMAILER_LANG['signing'] = 'Σφάλμα υπογραφής: '; |
|
| 22 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σύνδεσης στον SMTP Server.'; |
|
| 23 |
+$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα από τον SMTP Server: '; |
|
| 24 |
+$PHPMAILER_LANG['variable_set'] = 'Αδυναμία ορισμού ή αρχικοποίησης μεταβλητής: '; |
|
| 25 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 26 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,25 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Esperanto PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ */ |
|
| 6 |
+ |
|
| 7 |
+$PHPMAILER_LANG['authenticate'] = 'Eraro de servilo SMTP : aŭtentigo malsukcesis.'; |
|
| 8 |
+$PHPMAILER_LANG['connect_host'] = 'Eraro de servilo SMTP : konektado al servilo malsukcesis.'; |
|
| 9 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Eraro de servilo SMTP : neĝustaj datumoj.'; |
|
| 10 |
+$PHPMAILER_LANG['empty_message'] = 'Teksto de mesaĝo mankas.'; |
|
| 11 |
+$PHPMAILER_LANG['encoding'] = 'Nekonata kodoprezento: '; |
|
| 12 |
+$PHPMAILER_LANG['execute'] = 'Lanĉi rulumadon ne eblis: '; |
|
| 13 |
+$PHPMAILER_LANG['file_access'] = 'Aliro al dosiero ne sukcesis: '; |
|
| 14 |
+$PHPMAILER_LANG['file_open'] = 'Eraro de dosiero: malfermo neeblas: '; |
|
| 15 |
+$PHPMAILER_LANG['from_failed'] = 'Jena adreso de sendinto malsukcesis: '; |
|
| 16 |
+$PHPMAILER_LANG['instantiate'] = 'Genero de retmesaĝa funkcio neeblis.'; |
|
| 17 |
+$PHPMAILER_LANG['invalid_address'] = 'Retadreso ne validas: '; |
|
| 18 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mesaĝilo ne subtenata.'; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Vi devas tajpi almenaŭ unu recevontan retadreson.'; |
|
| 20 |
+$PHPMAILER_LANG['recipients_failed'] = 'Eraro de servilo SMTP : la jenaj poŝtrecivuloj kaŭzis eraron: '; |
|
| 21 |
+$PHPMAILER_LANG['signing'] = 'Eraro de subskribo: '; |
|
| 22 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP konektado malsukcesis.'; |
|
| 23 |
+$PHPMAILER_LANG['smtp_error'] = 'Eraro de servilo SMTP : '; |
|
| 24 |
+$PHPMAILER_LANG['variable_set'] = 'Variablo ne pravalorizeblas aŭ ne repravalorizeblas: '; |
|
| 25 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 26 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Spanish PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Matt Sturdy <matt.sturdy@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Error SMTP: Imposible conectar al servidor SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacío'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Codificación desconocida: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Imposible ejecutar: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Imposible acceder al archivo: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Error de Archivo: Imposible abrir el archivo: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Imposible crear una instancia de la función Mail.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Imposible enviar: dirección de email inválido: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no está soportado.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Debe proporcionar al menos una dirección de email de destino.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Los siguientes destinos fallaron: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Error al firmar: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falló.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Estonian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Indrek Päri |
|
| 6 |
+ * @author Elan Ruusamäe <glen@delfi.ee> |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Viga: Autoriseerimise viga.'; |
|
| 10 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.'; |
|
| 11 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Viga: Vigased andmed.'; |
|
| 12 |
+$PHPMAILER_LANG['empty_message'] = 'Tühi kirja sisu'; |
|
| 13 |
+$PHPMAILER_LANG["encoding"] = 'Tundmatu kodeering: '; |
|
| 14 |
+$PHPMAILER_LANG['execute'] = 'Tegevus ebaõnnestus: '; |
|
| 15 |
+$PHPMAILER_LANG['file_access'] = 'Pole piisavalt õiguseid järgneva faili avamiseks: '; |
|
| 16 |
+$PHPMAILER_LANG['file_open'] = 'Faili Viga: Faili avamine ebaõnnestus: '; |
|
| 17 |
+$PHPMAILER_LANG['from_failed'] = 'Järgnev saatja e-posti aadress on vigane: '; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = 'mail funktiooni käivitamine ebaõnnestus.'; |
|
| 19 |
+$PHPMAILER_LANG['invalid_address'] = 'Saatmine peatatud, e-posti address vigane: '; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.'; |
|
| 21 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' maileri tugi puudub.'; |
|
| 22 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: '; |
|
| 23 |
+$PHPMAILER_LANG["signing"] = 'Viga allkirjastamisel: '; |
|
| 24 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() ebaõnnestus.'; |
|
| 25 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri viga: '; |
|
| 26 |
+$PHPMAILER_LANG['variable_set'] = 'Ei õnnestunud määrata või lähtestada muutujat: '; |
|
| 27 |
+$PHPMAILER_LANG['extension_missing'] = 'Nõutud laiendus on puudu: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Persian/Farsi PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Ali Jazayeri <jaza.ali@gmail.com> |
|
| 6 |
+ * @author Mohammad Hossein Mojtahedi <mhm5000@gmail.com> |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+$PHPMAILER_LANG['authenticate'] = 'خطای SMTP: احراز هویت با شکست مواجه شد.'; |
|
| 10 |
+$PHPMAILER_LANG['connect_host'] = 'خطای SMTP: اتصال به سرور SMTP برقرار نشد.'; |
|
| 11 |
+$PHPMAILER_LANG['data_not_accepted'] = 'خطای SMTP: دادهها نادرست هستند.'; |
|
| 12 |
+$PHPMAILER_LANG['empty_message'] = 'بخش متن پیام خالی است.'; |
|
| 13 |
+$PHPMAILER_LANG['encoding'] = 'کدگذاری ناشناخته: '; |
|
| 14 |
+$PHPMAILER_LANG['execute'] = 'امکان اجرا وجود ندارد: '; |
|
| 15 |
+$PHPMAILER_LANG['file_access'] = 'امکان دسترسی به فایل وجود ندارد: '; |
|
| 16 |
+$PHPMAILER_LANG['file_open'] = 'خطای File: امکان بازکردن فایل وجود ندارد: '; |
|
| 17 |
+$PHPMAILER_LANG['from_failed'] = 'آدرس فرستنده اشتباه است: '; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = 'امکان معرفی تابع ایمیل وجود ندارد.'; |
|
| 19 |
+$PHPMAILER_LANG['invalid_address'] = 'آدرس ایمیل معتبر نیست: '; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer پشتیبانی نمیشود.'; |
|
| 21 |
+$PHPMAILER_LANG['provide_address'] = 'باید حداقل یک آدرس گیرنده وارد کنید.'; |
|
| 22 |
+$PHPMAILER_LANG['recipients_failed'] = 'خطای SMTP: ارسال به آدرس گیرنده با خطا مواجه شد: '; |
|
| 23 |
+$PHPMAILER_LANG['signing'] = 'خطا در امضا: '; |
|
| 24 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'خطا در اتصال به SMTP.'; |
|
| 25 |
+$PHPMAILER_LANG['smtp_error'] = 'خطا در SMTP Server: '; |
|
| 26 |
+$PHPMAILER_LANG['variable_set'] = 'امکان ارسال یا ارسال مجدد متغیرها وجود ندارد: '; |
|
| 27 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Finnish PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Jyry Kuukanen |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP-virhe: käyttäjätunnistus epäonnistui.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP-virhe: yhteys palvelimeen ei onnistu.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-virhe: data on virheellinen.'; |
|
| 11 |
+//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Suoritus epäonnistui: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Seuraavaan tiedostoon ei ole oikeuksia: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Tiedostovirhe: Ei voida avata tiedostoa: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Seuraava lähettäjän osoite on virheellinen: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.'; |
|
| 18 |
+//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähköpostiosoite.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.'; |
|
| 22 |
+$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: '; |
|
| 23 |
+//$PHPMAILER_LANG['signing'] = 'Signing Error: '; |
|
| 24 |
+//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
|
| 25 |
+//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; |
|
| 26 |
+//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; |
|
| 27 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Faroese PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Dávur Sørensen <http://www.profo-webdesign.dk> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP feilur: Kundi ikki góðkenna.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP feilur: Kundi ikki knýta samband við SMTP vert.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP feilur: Data ikki góðkent.'; |
|
| 11 |
+//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Ókend encoding: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Kundi ikki útføra: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Kundi ikki tilganga fílu: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Fílu feilur: Kundi ikki opna fílu: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'fylgjandi Frá/From adressa miseydnaðist: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Kuni ikki instantiera mail funktión.'; |
|
| 18 |
+//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' er ikki supporterað.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Tú skal uppgeva minst móttakara-emailadressu(r).'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feilur: Fylgjandi móttakarar miseydnaðust: '; |
|
| 22 |
+//$PHPMAILER_LANG['signing'] = 'Signing Error: '; |
|
| 23 |
+//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
|
| 24 |
+//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; |
|
| 25 |
+//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,29 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * French PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * Some French punctuation requires a thin non-breaking space (U+202F) character before it, |
|
| 6 |
+ * for example before a colon or exclamation mark. |
|
| 7 |
+ * There is one of these characters between these quotes: " " |
|
| 8 |
+ * @link http://unicode.org/udhr/n/notes_fra.html |
|
| 9 |
+ */ |
|
| 10 |
+ |
|
| 11 |
+$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l\'authentification.'; |
|
| 12 |
+$PHPMAILER_LANG['connect_host'] = 'Erreur SMTP : impossible de se connecter au serveur SMTP.'; |
|
| 13 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Erreur SMTP : données incorrectes.'; |
|
| 14 |
+$PHPMAILER_LANG['empty_message'] = 'Corps du message vide.'; |
|
| 15 |
+$PHPMAILER_LANG['encoding'] = 'Encodage inconnu : '; |
|
| 16 |
+$PHPMAILER_LANG['execute'] = 'Impossible de lancer l\'exécution : '; |
|
| 17 |
+$PHPMAILER_LANG['file_access'] = 'Impossible d\'accéder au fichier : '; |
|
| 18 |
+$PHPMAILER_LANG['file_open'] = 'Ouverture du fichier impossible : '; |
|
| 19 |
+$PHPMAILER_LANG['from_failed'] = 'L\'adresse d\'expéditeur suivante a échoué : '; |
|
| 20 |
+$PHPMAILER_LANG['instantiate'] = 'Impossible d\'instancier la fonction mail.'; |
|
| 21 |
+$PHPMAILER_LANG['invalid_address'] = 'L\'adresse courriel n\'est pas valide : '; |
|
| 22 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' client de messagerie non supporté.'; |
|
| 23 |
+$PHPMAILER_LANG['provide_address'] = 'Vous devez fournir au moins une adresse de destinataire.'; |
|
| 24 |
+$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants sont en erreur : '; |
|
| 25 |
+$PHPMAILER_LANG['signing'] = 'Erreur de signature : '; |
|
| 26 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Échec de la connexion SMTP.'; |
|
| 27 |
+$PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : '; |
|
| 28 |
+$PHPMAILER_LANG['variable_set'] = 'Impossible d\'initialiser ou de réinitialiser une variable : '; |
|
| 29 |
+$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : '; |
| 0 | 30 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Galician PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author by Donato Rouco <donatorouco@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Erro SMTP: Non puido ser autentificado.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Erro SMTP: Non puido conectar co servidor SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Erro SMTP: Datos non aceptados.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Corpo da mensaxe vacía'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Codificación descoñecida: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Non puido ser executado: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Nob puido acceder ó arquivo: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: No puido abrir o arquivo: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'A(s) seguinte(s) dirección(s) de remitente(s) deron erro: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Non puido crear unha instancia da función Mail.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Non puido envia-lo correo: dirección de email inválida: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer non está soportado.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Debe engadir polo menos unha dirección de email coma destino.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Erro SMTP: Os seguintes destinos fallaron: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Erro ó firmar: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallou.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Erro do servidor SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Non puidemos axustar ou reaxustar a variábel: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Hebrew PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Ronny Sherer <ronny@hoojima.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'שגיאת SMTP: פעולת האימות נכשלה.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'שגיאת SMTP: לא הצלחתי להתחבר לשרת SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'שגיאת SMTP: מידע לא התקבל.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'גוף ההודעה ריק'; |
|
| 12 |
+$PHPMAILER_LANG['invalid_address'] = 'כתובת שגויה: '; |
|
| 13 |
+$PHPMAILER_LANG['encoding'] = 'קידוד לא מוכר: '; |
|
| 14 |
+$PHPMAILER_LANG['execute'] = 'לא הצלחתי להפעיל את: '; |
|
| 15 |
+$PHPMAILER_LANG['file_access'] = 'לא ניתן לגשת לקובץ: '; |
|
| 16 |
+$PHPMAILER_LANG['file_open'] = 'שגיאת קובץ: לא ניתן לגשת לקובץ: '; |
|
| 17 |
+$PHPMAILER_LANG['from_failed'] = 'כתובות הנמענים הבאות נכשלו: '; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = 'לא הצלחתי להפעיל את פונקציית המייל.'; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' אינה נתמכת.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'חובה לספק לפחות כתובת אחת של מקבל המייל.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'שגיאת SMTP: הנמענים הבאים נכשלו: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'שגיאת חתימה: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'שגיאת שרת SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'לא ניתן לקבוע או לשנות את המשתנה: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Croatian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Hrvoj3e <hrvoj3e@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Greška: Neuspjela autentikacija.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Greška: Ne mogu se spojiti na SMTP poslužitelj.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Greška: Podatci nisu prihvaćeni.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Nepoznati encoding: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Nije moguće izvršiti naredbu: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'SMTP Greška: Slanje s navedenih e-mail adresa nije uspjelo: '; |
|
| 17 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Greška: Slanje na navedenih e-mail adresa nije uspjelo: '; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.'; |
|
| 19 |
+$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: '; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.'; |
|
| 21 |
+$PHPMAILER_LANG['provide_address'] = 'Definirajte barem jednu adresu primatelja.'; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Greška prilikom prijave: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP poslužitelj nije uspjelo.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Greška SMTP poslužitelja: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Ne mogu postaviti varijablu niti ju vratiti nazad: '; |
|
| 26 |
+$PHPMAILER_LANG['extension_missing'] = 'Nedostaje proširenje: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Hungarian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author @dominicus-75 |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP hiba: az azonosítás sikertelen.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP hiba: nem lehet kapcsolódni az SMTP-szerverhez.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP hiba: adatok visszautasítva.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Üres az üzenettörzs.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Ismeretlen kódolás: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Nem lehet végrehajtani: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'A következő fájl nem elérhető: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Fájl hiba: a következő fájlt nem lehet megnyitni: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'A feladóként megadott következő cím hibás: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'A PHP mail() függvényt nem sikerült végrehajtani.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Érvénytelen cím: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' a mailer-osztály nem támogatott.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Legalább egy címzettet fel kell tüntetni.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP hiba: a címzettként megadott következő címek hibásak: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Hibás aláírás: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Hiba az SMTP-kapcsolatban.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP-szerver hiba: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'A következő változók beállítása nem sikerült: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Indonesian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Cecep Prawiro <cecep.prawiro@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Kesalahan SMTP: Tidak dapat mengautentikasi.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Kesalahan SMTP: Tidak dapat terhubung ke host SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Kesalahan SMTP: Data tidak diterima peladen.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Isi pesan kosong'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Pengkodean karakter tidak dikenali: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Tidak dapat menjalankan proses : '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses berkas : '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Kesalahan File: Berkas tidak bisa dibuka : '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Alamat pengirim berikut mengakibatkan error : '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Tidak dapat menginisialisasi fungsi email'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Gagal terkirim, alamat email tidak valid : '; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Harus disediakan minimal satu alamat tujuan'; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer tidak didukung'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Kesalahan SMTP: Alamat tujuan berikut menghasilkan error : '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Kesalahan dalam tanda tangan : '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() gagal.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Kesalahan peladen SMTP : '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Tidak berhasil mengatur atau mengatur ulang variable : '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Italian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Ilias Bartolini <brain79@inwind.it> |
|
| 6 |
+ * @author Stefano Sabatini <sabas88@gmail.com> |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Impossibile autenticarsi.'; |
|
| 10 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Impossibile connettersi all\'host SMTP.'; |
|
| 11 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dati non accettati dal server.'; |
|
| 12 |
+$PHPMAILER_LANG['empty_message'] = 'Il corpo del messaggio è vuoto'; |
|
| 13 |
+$PHPMAILER_LANG['encoding'] = 'Codifica dei caratteri sconosciuta: '; |
|
| 14 |
+$PHPMAILER_LANG['execute'] = 'Impossibile eseguire l\'operazione: '; |
|
| 15 |
+$PHPMAILER_LANG['file_access'] = 'Impossibile accedere al file: '; |
|
| 16 |
+$PHPMAILER_LANG['file_open'] = 'File Error: Impossibile aprire il file: '; |
|
| 17 |
+$PHPMAILER_LANG['from_failed'] = 'I seguenti indirizzi mittenti hanno generato errore: '; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = 'Impossibile istanziare la funzione mail'; |
|
| 19 |
+$PHPMAILER_LANG['invalid_address'] = 'Impossibile inviare, l\'indirizzo email non è valido: '; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Deve essere fornito almeno un indirizzo ricevente'; |
|
| 21 |
+$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer non supportato'; |
|
| 22 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: I seguenti indirizzi destinatari hanno generato un errore: '; |
|
| 23 |
+$PHPMAILER_LANG['signing'] = 'Errore nella firma: '; |
|
| 24 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallita.'; |
|
| 25 |
+$PHPMAILER_LANG['smtp_error'] = 'Errore del server SMTP: '; |
|
| 26 |
+$PHPMAILER_LANG['variable_set'] = 'Impossibile impostare o resettare la variabile: '; |
|
| 27 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Japanese PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Mitsuhiro Yoshida <http://mitstek.com/> |
|
| 6 |
+ * @author Yoshi Sakai <http://bluemooninc.jp/> |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+$PHPMAILER_LANG['authenticate'] = 'SMTPエラー: 認証できませんでした。'; |
|
| 10 |
+$PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPホストに接続できませんでした。'; |
|
| 11 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データが受け付けられませんでした。'; |
|
| 12 |
+//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; |
|
| 13 |
+$PHPMAILER_LANG['encoding'] = '不明なエンコーディング: '; |
|
| 14 |
+$PHPMAILER_LANG['execute'] = '実行できませんでした: '; |
|
| 15 |
+$PHPMAILER_LANG['file_access'] = 'ファイルにアクセスできません: '; |
|
| 16 |
+$PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開けません: '; |
|
| 17 |
+$PHPMAILER_LANG['from_failed'] = 'Fromアドレスを登録する際にエラーが発生しました: '; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = 'メール関数が正常に動作しませんでした。'; |
|
| 19 |
+//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = '少なくとも1つメールアドレスを 指定する必要があります。'; |
|
| 21 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーがサポートされていません。'; |
|
| 22 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次の受信者アドレスに 間違いがあります: '; |
|
| 23 |
+//$PHPMAILER_LANG['signing'] = 'Signing Error: '; |
|
| 24 |
+//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
|
| 25 |
+//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; |
|
| 26 |
+//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; |
|
| 27 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Georgian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP შეცდომა: ავტორიზაცია შეუძლებელია.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP შეცდომა: SMTP სერვერთან დაკავშირება შეუძლებელია.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP შეცდომა: მონაცემები არ იქნა მიღებული.'; |
|
| 11 |
+$PHPMAILER_LANG['encoding'] = 'კოდირების უცნობი ტიპი: '; |
|
| 12 |
+$PHPMAILER_LANG['execute'] = 'შეუძლებელია შემდეგი ბრძანების შესრულება: '; |
|
| 13 |
+$PHPMAILER_LANG['file_access'] = 'შეუძლებელია წვდომა ფაილთან: '; |
|
| 14 |
+$PHPMAILER_LANG['file_open'] = 'ფაილური სისტემის შეცდომა: არ იხსნება ფაილი: '; |
|
| 15 |
+$PHPMAILER_LANG['from_failed'] = 'გამგზავნის არასწორი მისამართი: '; |
|
| 16 |
+$PHPMAILER_LANG['instantiate'] = 'mail ფუნქციის გაშვება ვერ ხერხდება.'; |
|
| 17 |
+$PHPMAILER_LANG['provide_address'] = 'გთხოვთ მიუთითოთ ერთი ადრესატის e-mail მისამართი მაინც.'; |
|
| 18 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' - საფოსტო სერვერის მხარდაჭერა არ არის.'; |
|
| 19 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP შეცდომა: შემდეგ მისამართებზე გაგზავნა ვერ მოხერხდა: '; |
|
| 20 |
+$PHPMAILER_LANG['empty_message'] = 'შეტყობინება ცარიელია'; |
|
| 21 |
+$PHPMAILER_LANG['invalid_address'] = 'არ გაიგზავნა, e-mail მისამართის არასწორი ფორმატი: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'ხელმოწერის შეცდომა: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'შეცდომა SMTP სერვერთან დაკავშირებისას'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP სერვერის შეცდომა: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'შეუძლებელია შემდეგი ცვლადის შექმნა ან შეცვლა: '; |
|
| 26 |
+$PHPMAILER_LANG['extension_missing'] = 'ბიბლიოთეკა არ არსებობს: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Korean PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author ChalkPE <amato0617@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP 오류: 인증할 수 없습니다.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP 오류: SMTP 호스트에 접속할 수 없습니다.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 오류: 데이터가 받아들여지지 않았습니다.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = '메세지 내용이 없습니다'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = '알 수 없는 인코딩: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = '실행 불가: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = '파일 접근 불가: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = '파일 오류: 파일을 열 수 없습니다: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = '다음 From 주소에서 오류가 발생했습니다: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'mail 함수를 인스턴스화할 수 없습니다'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = '잘못된 주소: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' 메일러는 지원되지 않습니다.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = '적어도 한 개 이상의 수신자 메일 주소를 제공해야 합니다.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP 오류: 다음 수신자에서 오류가 발생했습니다: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = '서명 오류: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP 연결을 실패하였습니다.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP 서버 오류: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = '변수 설정 및 초기화 불가: '; |
|
| 26 |
+$PHPMAILER_LANG['extension_missing'] = '확장자 없음: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Lithuanian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Dainius Kaupaitis <dk@sum.lt> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP klaida: autentifikacija nepavyko.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP klaida: nepavyksta prisijungti prie SMTP stoties.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP klaida: duomenys nepriimti.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Laiško turinys tuščias'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Neatpažinta koduotė: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Nepavyko įvykdyti komandos: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Byla nepasiekiama: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Bylos klaida: Nepavyksta atidaryti: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Neteisingas siuntėjo adresas: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Nepavyko paleisti mail funkcijos.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Neteisingas adresas: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' pašto stotis nepalaikoma.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Nurodykite bent vieną gavėjo adresą.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP klaida: nepavyko išsiųsti šiems gavėjams: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Prisijungimo klaida: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP susijungimo klaida'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP stoties klaida: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Nepavyko priskirti reikšmės kintamajam: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Latvian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Eduards M. <e@npd.lv> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP kļūda: Autorizācija neizdevās.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Kļūda: Nevar izveidot savienojumu ar SMTP serveri.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Kļūda: Nepieņem informāciju.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Ziņojuma teksts ir tukšs'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Neatpazīts kodējums: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Neizdevās izpildīt komandu: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Fails nav pieejams: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Faila kļūda: Nevar atvērt failu: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Nepareiza sūtītāja adrese: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Nevar palaist sūtīšanas funkciju.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Nepareiza adrese: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' sūtītājs netiek atbalstīts.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Lūdzu, norādiet vismaz vienu adresātu.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP kļūda: neizdevās nosūtīt šādiem saņēmējiem: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Autorizācijas kļūda: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP savienojuma kļūda'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP servera kļūda: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Nevar piešķirt mainīgā vērtību: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Malaysian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Nawawi Jamili <nawawi@rutweb.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Ralat SMTP: Tidak dapat pengesahan.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Ralat SMTP: Tidak dapat menghubungi hos pelayan SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Ralat SMTP: Data tidak diterima oleh pelayan.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Tiada isi untuk mesej'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Pengekodan tidak diketahui: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Tidak dapat melaksanakan: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses fail: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Ralat Fail: Tidak dapat membuka fail: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Berikut merupakan ralat dari alamat e-mel: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Tidak dapat memberi contoh fungsi e-mel.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Alamat emel tidak sah: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' jenis penghantar emel tidak disokong.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Anda perlu menyediakan sekurang-kurangnya satu alamat e-mel penerima.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Ralat SMTP: Penerima e-mel berikut telah gagal: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Ralat pada tanda tangan: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() telah gagal.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Ralat pada pelayan SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Tidak boleh menetapkan atau menetapkan semula pembolehubah: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Dutch PHPMailer language file: refer to class.phpmailer.php for definitive list. |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Tuxion <team@tuxion.nl> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: authenticatie mislukt.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon niet verbinden met SMTP-host.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data niet geaccepteerd.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Berichttekst is leeg'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Onbekende codering: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Kon niet uitvoeren: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Kreeg geen toegang tot bestand: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Bestandsfout: kon bestand niet openen: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Er moet minstens één ontvanger worden opgegeven.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Signeerfout: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Verbinding mislukt.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variabele niet instellen of resetten: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,25 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Norwegian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ */ |
|
| 6 |
+ |
|
| 7 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke autentisere.'; |
|
| 8 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP tjener.'; |
|
| 9 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Data ble ikke akseptert.'; |
|
| 10 |
+$PHPMAILER_LANG['empty_message'] = 'Meldingsinnholdet er tomt'; |
|
| 11 |
+$PHPMAILER_LANG['encoding'] = 'Ukjent tegnkoding: '; |
|
| 12 |
+$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: '; |
|
| 13 |
+$PHPMAILER_LANG['file_access'] = 'Får ikke tilgang til filen: '; |
|
| 14 |
+$PHPMAILER_LANG['file_open'] = 'Fil feil: Kunne ikke åpne filen: '; |
|
| 15 |
+$PHPMAILER_LANG['from_failed'] = 'Følgende avsenderadresse feilet: '; |
|
| 16 |
+$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere mailfunksjonen.'; |
|
| 17 |
+$PHPMAILER_LANG['invalid_address'] = 'Meldingen ble ikke sendt, følgende adresse er ugyldig: '; |
|
| 18 |
+$PHPMAILER_LANG['provide_address'] = 'Du må angi minst en mottakeradresse.'; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer er ikke supportert.'; |
|
| 20 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottagere feilet: '; |
|
| 21 |
+$PHPMAILER_LANG['signing'] = 'Signeringsfeil: '; |
|
| 22 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() feilet.'; |
|
| 23 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: '; |
|
| 24 |
+$PHPMAILER_LANG['variable_set'] = 'Kan ikke sette eller resette variabelen: '; |
|
| 25 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 26 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Polish PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ */ |
|
| 6 |
+ |
|
| 7 |
+$PHPMAILER_LANG['authenticate'] = 'Błąd SMTP: Nie można przeprowadzić uwierzytelnienia.'; |
|
| 8 |
+$PHPMAILER_LANG['connect_host'] = 'Błąd SMTP: Nie można połączyć się z wybranym hostem.'; |
|
| 9 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Błąd SMTP: Dane nie zostały przyjęte.'; |
|
| 10 |
+$PHPMAILER_LANG['empty_message'] = 'Wiadomość jest pusta.'; |
|
| 11 |
+$PHPMAILER_LANG['encoding'] = 'Nieznany sposób kodowania znaków: '; |
|
| 12 |
+$PHPMAILER_LANG['execute'] = 'Nie można uruchomić: '; |
|
| 13 |
+$PHPMAILER_LANG['file_access'] = 'Brak dostępu do pliku: '; |
|
| 14 |
+$PHPMAILER_LANG['file_open'] = 'Nie można otworzyć pliku: '; |
|
| 15 |
+$PHPMAILER_LANG['from_failed'] = 'Następujący adres Nadawcy jest nieprawidłowy: '; |
|
| 16 |
+$PHPMAILER_LANG['instantiate'] = 'Nie można wywołać funkcji mail(). Sprawdź konfigurację serwera.'; |
|
| 17 |
+$PHPMAILER_LANG['invalid_address'] = 'Nie można wysłać wiadomości, '. |
|
| 18 |
+ 'następujący adres Odbiorcy jest nieprawidłowy: '; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Należy podać prawidłowy adres email Odbiorcy.'; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = 'Wybrana metoda wysyłki wiadomości nie jest obsługiwana.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Błąd SMTP: Następujący odbiorcy są nieprawidłowi: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Błąd podpisywania wiadomości: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zakończone niepowodzeniem.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Błąd SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Nie można ustawić lub zmodyfikować zmiennej: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Portuguese (European) PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Jonadabe <jonadabe@hotmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Erro do SMTP: Não foi possível realizar a autenticação.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Erro do SMTP: Não foi possível realizar ligação com o servidor SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Erro do SMTP: Os dados foram rejeitados.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'A mensagem no e-mail está vazia.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Não foi possível aceder o ficheiro: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Abertura do ficheiro: Não foi possível abrir o ficheiro: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Ocorreram falhas nos endereços dos seguintes remententes: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Não foi enviado nenhum e-mail para o endereço de e-mail inválido: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Tem de fornecer pelo menos um endereço como destinatário do e-mail.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Erro do SMTP: O endereço do seguinte destinatário falhou: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; |
|
| 26 |
+$PHPMAILER_LANG['extension_missing'] = 'Extensão em falta: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Romanian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Catalin Constantin <catalin@dazoot.ro> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Nu a functionat autentificarea.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Mesajul este gol.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Encodare necunoscuta: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Nu pot executa: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Nu pot accesa fisierul: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Eroare de fisier: Nu pot deschide fisierul: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Urmatoarele adrese From au dat eroare: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Nu am putut instantia functia mail.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este valida: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'A aparut o problema la semnarea emailului. '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a esuat.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'A aparut o eroare la serverul SMTP. '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Nu se poate seta/reseta variabila. '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Russian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Alexey Chumakov <alex@chumakov.ru> |
|
| 6 |
+ * @author Foster Snowhill <i18n@forstwoof.ru> |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.'; |
|
| 10 |
+$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к серверу SMTP.'; |
|
| 11 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не приняты.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Неизвестный вид кодировки: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Невозможно выполнить команду: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Нет доступа к файлу: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удается открыть файл: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Неверный адрес отправителя: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail.'; |
|
| 18 |
+$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один адрес e-mail получателя.'; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' — почтовый сервер не поддерживается.'; |
|
| 20 |
+$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: отправка по следующим адресам получателей не удалась: '; |
|
| 21 |
+$PHPMAILER_LANG['empty_message'] = 'Пустое тело сообщения'; |
|
| 22 |
+$PHPMAILER_LANG['invalid_address'] = 'Не отослано, неправильный формат email адреса: '; |
|
| 23 |
+$PHPMAILER_LANG['signing'] = 'Ошибка подписывания: '; |
|
| 24 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером'; |
|
| 25 |
+$PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-сервера: '; |
|
| 26 |
+$PHPMAILER_LANG['variable_set'] = 'Невозможно установить или переустановить переменную: '; |
|
| 27 |
+$PHPMAILER_LANG['extension_missing'] = 'Расширение отсутствует: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Swedish PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Johan Linnér <johan@linner.biz> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.'; |
|
| 11 |
+//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Okänt encode-format: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Kunde inte köra: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Ingen åtkomst till fil: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.'; |
|
| 18 |
+//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; |
|
| 19 |
+$PHPMAILER_LANG['provide_address'] = 'Du måste ange minst en mottagares e-postadress.'; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: '; |
|
| 22 |
+//$PHPMAILER_LANG['signing'] = 'Signing Error: '; |
|
| 23 |
+//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
|
| 24 |
+//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; |
|
| 25 |
+//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Sinhala PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Senasum Rajapalsha <senasum@live.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP fodihls: l%shd lrúh fkdyl .'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP fodihls: iïnkao l, fkdyl.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fodihls: o;a; Ndr .; fkdyl.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'ysia mksúvhls'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'iqrlaYs; njg m;a lrï: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'l%shd lrúh fkdyl: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'f.dkqj fj; ,.d úh fkdyl: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'f.dkqj újD; fkdfj: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'f*d¾uh jrÈh: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'jyd l, hq;= fj.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'smskh jrÈh: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mksúv lre fkd.,mS.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = ',smskh w;=,a lrkak.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP fodihls: mksúvh ,.d l, fkdyl: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'w;=,a úh fkdyl: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP iïnkao l, fkdyl.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP fodihls:: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'úp,h ilia lr fkdu;: '; |
|
| 26 |
+$PHPMAILER_LANG['extension_missing'] = 'l%shd lrúh fkdyl: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Slovak PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Michal Tinka <michaltinka@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentifikácie.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Nebolo možné nadviazať spojenie so SMTP serverom.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dáta neboli prijaté'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Prázdne telo správy.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Neznáme kódovanie: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Nedá sa vykonať: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Súbor nebol nájdený: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'File Error: Súbor sa otvoriť pre čítanie: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriť inštancia emailovej funkcie.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Musíte zadať aspoň jednu emailovú adresu príjemcu.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy príjemcov niesu správne '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Chyba prihlasovania: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zlyhalo.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP chyba serveru: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Nemožno nastaviť alebo resetovať premennú: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Slovene PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Klemen Tušar <techouse@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP napaka: Avtentikacija ni uspela.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP napaka: Ne morem vzpostaviti povezave s SMTP gostiteljem.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP napaka: Strežnik zavrača podatke.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'E-poštno sporočilo nima vsebine.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Nepoznan tip kodiranja: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Operacija ni uspela: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Nimam dostopa do datoteke: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Ne morem odpreti datoteke: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Neveljaven e-naslov pošiljatelja: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Ne morem inicializirati mail funkcije.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'E-poštno sporočilo ni bilo poslano. E-naslov je neveljaven: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer ni podprt.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Prosim vnesite vsaj enega naslovnika.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP napaka: Sledeči naslovniki so neveljavni: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Napaka pri podpisovanju: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Ne morem vzpostaviti povezave s SMTP strežnikom.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Napaka SMTP strežnika: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Ne morem nastaviti oz. ponastaviti spremenljivke: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Serbian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Александар Јевремовић <ajevremovic@gmail.com> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: аутентификација није успела.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: није могуће повезивање са SMTP сервером.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: подаци нису прихваћени.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Садржај поруке је празан.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Непознато кодовање: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Није могуће извршити наредбу: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Није могуће приступити датотеци: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Није могуће отворити датотеку: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'SMTP грешка: слање са следећих адреса није успело: '; |
|
| 17 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: слање на следеће адресе није успело: '; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = 'Није могуће покренути mail функцију.'; |
|
| 19 |
+$PHPMAILER_LANG['invalid_address'] = 'Порука није послата због неисправне адресе: '; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' мејлер није подржан.'; |
|
| 21 |
+$PHPMAILER_LANG['provide_address'] = 'Потребно је задати најмање једну адресу.'; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Грешка приликом пријављивања: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Повезивање са SMTP сервером није успело.'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Грешка SMTP сервера: '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Није могуће задати променљиву, нити је вратити уназад: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,29 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Turkish PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Elçin Özel |
|
| 6 |
+ * @author Can Yılmaz |
|
| 7 |
+ * @author Mehmet Benlioğlu |
|
| 8 |
+ * @author @yasinaydin |
|
| 9 |
+ */ |
|
| 10 |
+ |
|
| 11 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Oturum açılamadı.'; |
|
| 12 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP Hatası: SMTP sunucusuna bağlanılamadı.'; |
|
| 13 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Hatası: Veri kabul edilmedi.'; |
|
| 14 |
+$PHPMAILER_LANG['empty_message'] = 'Mesajın içeriği boş'; |
|
| 15 |
+$PHPMAILER_LANG['encoding'] = 'Bilinmeyen karakter kodlama: '; |
|
| 16 |
+$PHPMAILER_LANG['execute'] = 'Çalıştırılamadı: '; |
|
| 17 |
+$PHPMAILER_LANG['file_access'] = 'Dosyaya erişilemedi: '; |
|
| 18 |
+$PHPMAILER_LANG['file_open'] = 'Dosya Hatası: Dosya açılamadı: '; |
|
| 19 |
+$PHPMAILER_LANG['from_failed'] = 'Belirtilen adreslere gönderme başarısız: '; |
|
| 20 |
+$PHPMAILER_LANG['instantiate'] = 'Örnek e-posta fonksiyonu oluşturulamadı.'; |
|
| 21 |
+$PHPMAILER_LANG['invalid_address'] = 'Geçersiz e-posta adresi: '; |
|
| 22 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' e-posta kütüphanesi desteklenmiyor.'; |
|
| 23 |
+$PHPMAILER_LANG['provide_address'] = 'En az bir alıcı e-posta adresi belirtmelisiniz.'; |
|
| 24 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP Hatası: Belirtilen alıcılara ulaşılamadı: '; |
|
| 25 |
+$PHPMAILER_LANG['signing'] = 'İmzalama hatası: '; |
|
| 26 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() fonksiyonu başarısız.'; |
|
| 27 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: '; |
|
| 28 |
+$PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: '; |
|
| 29 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 30 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Ukrainian PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author Yuriy Rudyy <yrudyy@prs.net.ua> |
|
| 6 |
+ * @fixed by Boris Yurchenko <boris@yurchenko.pp.ua> |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+$PHPMAILER_LANG['authenticate'] = 'Помилка SMTP: помилка авторизації.'; |
|
| 10 |
+$PHPMAILER_LANG['connect_host'] = 'Помилка SMTP: не вдається під\'єднатися до серверу SMTP.'; |
|
| 11 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Помилка SMTP: дані не прийняті.'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Невідомий тип кодування: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Неможливо виконати команду: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Немає доступу до файлу: '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Помилка файлової системи: не вдається відкрити файл: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Невірна адреса відправника: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Неможливо запустити функцію mail.'; |
|
| 18 |
+$PHPMAILER_LANG['provide_address'] = 'Будь-ласка, введіть хоча б одну адресу e-mail отримувача.'; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' - поштовий сервер не підтримується.'; |
|
| 20 |
+$PHPMAILER_LANG['recipients_failed'] = 'Помилка SMTP: відправлення наступним отримувачам не вдалося: '; |
|
| 21 |
+$PHPMAILER_LANG['empty_message'] = 'Пусте тіло повідомлення'; |
|
| 22 |
+$PHPMAILER_LANG['invalid_address'] = 'Не відправлено, невірний формат адреси e-mail: '; |
|
| 23 |
+$PHPMAILER_LANG['signing'] = 'Помилка підпису: '; |
|
| 24 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Помилка з\'єднання із SMTP-сервером'; |
|
| 25 |
+$PHPMAILER_LANG['smtp_error'] = 'Помилка SMTP-сервера: '; |
|
| 26 |
+$PHPMAILER_LANG['variable_set'] = 'Неможливо встановити або перевстановити змінну: '; |
|
| 27 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Vietnamese (Tiếng Việt) PHPMailer language file: refer to English translation for definitive list. |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author VINADES.,JSC <contact@vinades.vn> |
|
| 6 |
+ */ |
|
| 7 |
+ |
|
| 8 |
+$PHPMAILER_LANG['authenticate'] = 'Lỗi SMTP: Không thể xác thực.'; |
|
| 9 |
+$PHPMAILER_LANG['connect_host'] = 'Lỗi SMTP: Không thể kết nối máy chủ SMTP.'; |
|
| 10 |
+$PHPMAILER_LANG['data_not_accepted'] = 'Lỗi SMTP: Dữ liệu không được chấp nhận.'; |
|
| 11 |
+$PHPMAILER_LANG['empty_message'] = 'Không có nội dung'; |
|
| 12 |
+$PHPMAILER_LANG['encoding'] = 'Mã hóa không xác định: '; |
|
| 13 |
+$PHPMAILER_LANG['execute'] = 'Không thực hiện được: '; |
|
| 14 |
+$PHPMAILER_LANG['file_access'] = 'Không thể truy cập tệp tin '; |
|
| 15 |
+$PHPMAILER_LANG['file_open'] = 'Lỗi Tập tin: Không thể mở tệp tin: '; |
|
| 16 |
+$PHPMAILER_LANG['from_failed'] = 'Lỗi địa chỉ gửi đi: '; |
|
| 17 |
+$PHPMAILER_LANG['instantiate'] = 'Không dùng được các hàm gửi thư.'; |
|
| 18 |
+$PHPMAILER_LANG['invalid_address'] = 'Đại chỉ emai không đúng: '; |
|
| 19 |
+$PHPMAILER_LANG['mailer_not_supported'] = ' trình gửi thư không được hỗ trợ.'; |
|
| 20 |
+$PHPMAILER_LANG['provide_address'] = 'Bạn phải cung cấp ít nhất một địa chỉ người nhận.'; |
|
| 21 |
+$PHPMAILER_LANG['recipients_failed'] = 'Lỗi SMTP: lỗi địa chỉ người nhận: '; |
|
| 22 |
+$PHPMAILER_LANG['signing'] = 'Lỗi đăng nhập: '; |
|
| 23 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'Lỗi kết nối với SMTP'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_error'] = 'Lỗi máy chủ smtp '; |
|
| 25 |
+$PHPMAILER_LANG['variable_set'] = 'Không thể thiết lập hoặc thiết lập lại biến: '; |
|
| 26 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |
| 0 | 27 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,28 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Traditional Chinese PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author liqwei <liqwei@liqwei.com> |
|
| 6 |
+ * @author Peter Dave Hello <@PeterDaveHello/> |
|
| 7 |
+ * @author Jason Chiang <xcojad@gmail.com> |
|
| 8 |
+ */ |
|
| 9 |
+ |
|
| 10 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP 錯誤:登入失敗。'; |
|
| 11 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP 錯誤:無法連線到 SMTP 主機。'; |
|
| 12 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 錯誤:無法接受的資料。'; |
|
| 13 |
+$PHPMAILER_LANG['empty_message'] = '郵件內容為空'; |
|
| 14 |
+$PHPMAILER_LANG['encoding'] = '未知編碼: '; |
|
| 15 |
+$PHPMAILER_LANG['execute'] = '無法執行:'; |
|
| 16 |
+$PHPMAILER_LANG['file_access'] = '無法存取檔案:'; |
|
| 17 |
+$PHPMAILER_LANG['file_open'] = '檔案錯誤:無法開啟檔案:'; |
|
| 18 |
+$PHPMAILER_LANG['from_failed'] = '發送地址錯誤:'; |
|
| 19 |
+$PHPMAILER_LANG['instantiate'] = '未知函數呼叫。'; |
|
| 20 |
+$PHPMAILER_LANG['invalid_address'] = '因為電子郵件地址無效,無法傳送: '; |
|
| 21 |
+$PHPMAILER_LANG['mailer_not_supported'] = '不支援的發信客戶端。'; |
|
| 22 |
+$PHPMAILER_LANG['provide_address'] = '必須提供至少一個收件人地址。'; |
|
| 23 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP 錯誤:以下收件人地址錯誤:'; |
|
| 24 |
+$PHPMAILER_LANG['signing'] = '電子簽章錯誤: '; |
|
| 25 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP 連線失敗'; |
|
| 26 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP 伺服器錯誤: '; |
|
| 27 |
+$PHPMAILER_LANG['variable_set'] = '無法設定或重設變數: '; |
|
| 28 |
+$PHPMAILER_LANG['extension_missing'] = '遺失模組 Extension: '; |
| 0 | 29 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Simplified Chinese PHPMailer language file: refer to English translation for definitive list |
|
| 4 |
+ * @package PHPMailer |
|
| 5 |
+ * @author liqwei <liqwei@liqwei.com> |
|
| 6 |
+ * @author young <masxy@foxmail.com> |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; |
|
| 10 |
+$PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; |
|
| 11 |
+$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。'; |
|
| 12 |
+$PHPMAILER_LANG['empty_message'] = '邮件正文为空。'; |
|
| 13 |
+$PHPMAILER_LANG['encoding'] = '未知编码: '; |
|
| 14 |
+$PHPMAILER_LANG['execute'] = '无法执行:'; |
|
| 15 |
+$PHPMAILER_LANG['file_access'] = '无法访问文件:'; |
|
| 16 |
+$PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; |
|
| 17 |
+$PHPMAILER_LANG['from_failed'] = '发送地址错误:'; |
|
| 18 |
+$PHPMAILER_LANG['instantiate'] = '未知函数调用。'; |
|
| 19 |
+$PHPMAILER_LANG['invalid_address'] = '发送失败,电子邮箱地址是无效的:'; |
|
| 20 |
+$PHPMAILER_LANG['mailer_not_supported'] = '发信客户端不被支持。'; |
|
| 21 |
+$PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地址。'; |
|
| 22 |
+$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:'; |
|
| 23 |
+$PHPMAILER_LANG['signing'] = '登录失败:'; |
|
| 24 |
+$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP服务器连接失败。'; |
|
| 25 |
+$PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错: '; |
|
| 26 |
+$PHPMAILER_LANG['variable_set'] = '无法设置或重置变量:'; |
|
| 27 |
+//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; |