Revision 1539
Added by Dietmar almost 13 years ago
class.phpmailer.php | ||
---|---|---|
2 | 2 |
/*~ class.phpmailer.php |
3 | 3 |
.---------------------------------------------------------------------------. |
4 | 4 |
| Software: PHPMailer - PHP email class | |
5 |
| Version: 2.0.4 |
|
|
6 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
|
|
5 |
| Version: 5.1 |
|
|
6 |
| Contact: via sourceforge.net support pages (also www.worxware.com) |
|
|
7 | 7 |
| Info: http://phpmailer.sourceforge.net | |
8 | 8 |
| Support: http://sourceforge.net/projects/phpmailer/ | |
9 | 9 |
| ------------------------------------------------------------------------- | |
10 |
| Author: Andy Prevost (project admininistrator) | |
|
11 |
| Author: Brent R. Matzelle (original founder) | |
|
12 |
| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. | |
|
10 |
| Admin: Andy Prevost (project admininistrator) | |
|
11 |
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net | |
|
12 |
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net | |
|
13 |
| Founder: Brent R. Matzelle (original founder) | |
|
14 |
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. | |
|
13 | 15 |
| Copyright (c) 2001-2003, Brent R. Matzelle | |
14 | 16 |
| ------------------------------------------------------------------------- | |
15 | 17 |
| License: Distributed under the Lesser General Public License (LGPL) | |
... | ... | |
18 | 20 |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
19 | 21 |
| FITNESS FOR A PARTICULAR PURPOSE. | |
20 | 22 |
| ------------------------------------------------------------------------- | |
21 |
| We offer a number of paid services (www.codeworxtech.com): |
|
|
23 |
| We offer a number of paid services (www.worxware.com): |
|
|
22 | 24 |
| - Web Hosting on highly optimized fast and secure servers | |
23 | 25 |
| - Technology Consulting | |
24 | 26 |
| - Oursourcing (highly qualified programmers and graphic designers) | |
25 | 27 |
'---------------------------------------------------------------------------' |
26 |
/* |
|
27 |
Ticket #783 |
|
28 |
fix Function "set_magic_quotes_runtime" is depriciated in PHP 5.3.x 2009/11/25 |
|
29 |
|
|
30 |
|
|
31 | 28 |
*/ |
32 | 29 |
|
33 |
|
|
34 | 30 |
/** |
35 | 31 |
* PHPMailer - PHP email transport class |
32 |
* NOTE: Requires PHP version 5 or later |
|
36 | 33 |
* @package PHPMailer |
37 | 34 |
* @author Andy Prevost |
35 |
* @author Marcus Bointon |
|
38 | 36 |
* @copyright 2004 - 2009 Andy Prevost |
37 |
* @version $Id: class.phpmailer.php 447 2009-05-25 01:36:38Z codeworxtech $ |
|
38 |
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
|
39 | 39 |
*/ |
40 | 40 |
|
41 |
if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n"); |
|
42 |
|
|
41 | 43 |
class PHPMailer { |
42 | 44 |
|
43 | 45 |
///////////////////////////////////////////////// |
... | ... | |
46 | 48 |
|
47 | 49 |
/** |
48 | 50 |
* Email priority (1 = High, 3 = Normal, 5 = low). |
49 |
* @var int |
|
51 |
* @var int
|
|
50 | 52 |
*/ |
51 |
var $Priority = 3;
|
|
53 |
public $Priority = 3;
|
|
52 | 54 |
|
53 | 55 |
/** |
54 | 56 |
* Sets the CharSet of the message. |
55 |
* @var string |
|
57 |
* @var string
|
|
56 | 58 |
*/ |
57 |
var $CharSet = 'iso-8859-1';
|
|
59 |
public $CharSet = 'iso-8859-1';
|
|
58 | 60 |
|
59 | 61 |
/** |
60 | 62 |
* Sets the Content-type of the message. |
61 |
* @var string |
|
63 |
* @var string
|
|
62 | 64 |
*/ |
63 |
var $ContentType = 'text/plain';
|
|
65 |
public $ContentType = 'text/plain';
|
|
64 | 66 |
|
65 | 67 |
/** |
66 |
* Sets the Encoding of the message. Options for this are "8bit",
|
|
67 |
* "7bit", "binary", "base64", and "quoted-printable". |
|
68 |
* @var string |
|
68 |
* Sets the Encoding of the message. Options for this are |
|
69 |
* "8bit", "7bit", "binary", "base64", and "quoted-printable".
|
|
70 |
* @var string
|
|
69 | 71 |
*/ |
70 |
var $Encoding = '8bit';
|
|
72 |
public $Encoding = '8bit';
|
|
71 | 73 |
|
72 | 74 |
/** |
73 | 75 |
* Holds the most recent mailer error message. |
74 |
* @var string |
|
76 |
* @var string
|
|
75 | 77 |
*/ |
76 |
var $ErrorInfo = '';
|
|
78 |
public $ErrorInfo = '';
|
|
77 | 79 |
|
78 | 80 |
/** |
79 | 81 |
* Sets the From email address for the message. |
80 |
* @var string |
|
82 |
* @var string
|
|
81 | 83 |
*/ |
82 |
var $From = 'root@localhost';
|
|
84 |
public $From = 'root@localhost';
|
|
83 | 85 |
|
84 | 86 |
/** |
85 | 87 |
* Sets the From name of the message. |
86 |
* @var string |
|
88 |
* @var string
|
|
87 | 89 |
*/ |
88 |
var $FromName = 'Root User';
|
|
90 |
public $FromName = 'Root User';
|
|
89 | 91 |
|
90 | 92 |
/** |
91 | 93 |
* Sets the Sender email (Return-Path) of the message. If not empty, |
92 | 94 |
* will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. |
93 |
* @var string |
|
95 |
* @var string
|
|
94 | 96 |
*/ |
95 |
var $Sender = '';
|
|
97 |
public $Sender = '';
|
|
96 | 98 |
|
97 | 99 |
/** |
98 | 100 |
* Sets the Subject of the message. |
99 |
* @var string |
|
101 |
* @var string
|
|
100 | 102 |
*/ |
101 |
var $Subject = '';
|
|
103 |
public $Subject = '';
|
|
102 | 104 |
|
103 | 105 |
/** |
104 | 106 |
* Sets the Body of the message. This can be either an HTML or text body. |
105 | 107 |
* If HTML then run IsHTML(true). |
106 |
* @var string |
|
108 |
* @var string
|
|
107 | 109 |
*/ |
108 |
var $Body = '';
|
|
110 |
public $Body = '';
|
|
109 | 111 |
|
110 | 112 |
/** |
111 | 113 |
* Sets the text-only body of the message. This automatically sets the |
112 | 114 |
* email to multipart/alternative. This body can be read by mail |
113 | 115 |
* clients that do not have HTML email capability such as mutt. Clients |
114 | 116 |
* that can read HTML will view the normal Body. |
115 |
* @var string |
|
117 |
* @var string
|
|
116 | 118 |
*/ |
117 |
var $AltBody = '';
|
|
119 |
public $AltBody = '';
|
|
118 | 120 |
|
119 | 121 |
/** |
120 | 122 |
* Sets word wrapping on the body of the message to a given number of |
121 | 123 |
* characters. |
122 |
* @var int |
|
124 |
* @var int
|
|
123 | 125 |
*/ |
124 |
var $WordWrap = 0;
|
|
126 |
public $WordWrap = 0;
|
|
125 | 127 |
|
126 | 128 |
/** |
127 | 129 |
* Method to send mail: ("mail", "sendmail", or "smtp"). |
128 |
* @var string |
|
130 |
* @var string
|
|
129 | 131 |
*/ |
130 |
var $Mailer = 'mail';
|
|
132 |
public $Mailer = 'mail';
|
|
131 | 133 |
|
132 | 134 |
/** |
133 | 135 |
* Sets the path of the sendmail program. |
134 |
* @var string |
|
136 |
* @var string
|
|
135 | 137 |
*/ |
136 |
var $Sendmail = '/usr/sbin/sendmail';
|
|
138 |
public $Sendmail = '/usr/sbin/sendmail';
|
|
137 | 139 |
|
138 | 140 |
/** |
139 |
* Path to PHPMailer plugins. This is now only useful if the SMTP class
|
|
141 |
* Path to PHPMailer plugins. Useful if the SMTP class
|
|
140 | 142 |
* is in a different directory than the PHP include path. |
141 |
* @var string |
|
143 |
* @var string
|
|
142 | 144 |
*/ |
143 |
var $PluginDir = '';
|
|
145 |
public $PluginDir = '';
|
|
144 | 146 |
|
145 | 147 |
/** |
146 |
* Holds PHPMailer version. |
|
147 |
* @var string |
|
148 |
*/ |
|
149 |
var $Version = "2.0.4"; |
|
150 |
|
|
151 |
/** |
|
152 | 148 |
* Sets the email address that a reading confirmation will be sent. |
153 |
* @var string |
|
149 |
* @var string
|
|
154 | 150 |
*/ |
155 |
var $ConfirmReadingTo = '';
|
|
151 |
public $ConfirmReadingTo = '';
|
|
156 | 152 |
|
157 | 153 |
/** |
158 | 154 |
* Sets the hostname to use in Message-Id and Received headers |
159 | 155 |
* and as default HELO string. If empty, the value returned |
160 | 156 |
* by SERVER_NAME is used or 'localhost.localdomain'. |
161 |
* @var string |
|
157 |
* @var string
|
|
162 | 158 |
*/ |
163 |
var $Hostname = '';
|
|
159 |
public $Hostname = '';
|
|
164 | 160 |
|
165 | 161 |
/** |
166 | 162 |
* Sets the message ID to be used in the Message-Id header. |
167 | 163 |
* If empty, a unique id will be generated. |
168 |
* @var string |
|
164 |
* @var string
|
|
169 | 165 |
*/ |
170 |
var $MessageID = '';
|
|
166 |
public $MessageID = '';
|
|
171 | 167 |
|
172 | 168 |
///////////////////////////////////////////////// |
173 | 169 |
// PROPERTIES FOR SMTP |
... | ... | |
179 | 175 |
* for each host by using this format: [hostname:port] |
180 | 176 |
* (e.g. "smtp1.example.com:25;smtp2.example.com"). |
181 | 177 |
* Hosts will be tried in order. |
182 |
* @var string |
|
178 |
* @var string
|
|
183 | 179 |
*/ |
184 |
var $Host = 'localhost';
|
|
180 |
public $Host = 'localhost';
|
|
185 | 181 |
|
186 | 182 |
/** |
187 | 183 |
* Sets the default SMTP server port. |
188 |
* @var int |
|
184 |
* @var int
|
|
189 | 185 |
*/ |
190 |
var $Port = 25;
|
|
186 |
public $Port = 25;
|
|
191 | 187 |
|
192 | 188 |
/** |
193 | 189 |
* Sets the SMTP HELO of the message (Default is $Hostname). |
194 |
* @var string |
|
190 |
* @var string
|
|
195 | 191 |
*/ |
196 |
var $Helo = '';
|
|
192 |
public $Helo = '';
|
|
197 | 193 |
|
198 | 194 |
/** |
199 | 195 |
* Sets connection prefix. |
200 | 196 |
* Options are "", "ssl" or "tls" |
201 |
* @var string |
|
197 |
* @var string
|
|
202 | 198 |
*/ |
203 |
var $SMTPSecure = "";
|
|
199 |
public $SMTPSecure = '';
|
|
204 | 200 |
|
205 | 201 |
/** |
206 | 202 |
* Sets SMTP authentication. Utilizes the Username and Password variables. |
207 |
* @var bool |
|
203 |
* @var bool
|
|
208 | 204 |
*/ |
209 |
var $SMTPAuth = false;
|
|
205 |
public $SMTPAuth = false;
|
|
210 | 206 |
|
211 | 207 |
/** |
212 | 208 |
* Sets SMTP username. |
213 |
* @var string |
|
209 |
* @var string
|
|
214 | 210 |
*/ |
215 |
var $Username = '';
|
|
211 |
public $Username = '';
|
|
216 | 212 |
|
217 | 213 |
/** |
218 | 214 |
* Sets SMTP password. |
219 |
* @var string |
|
215 |
* @var string
|
|
220 | 216 |
*/ |
221 |
var $Password = '';
|
|
217 |
public $Password = '';
|
|
222 | 218 |
|
223 | 219 |
/** |
224 |
* Sets the SMTP server timeout in seconds. This function will not
|
|
225 |
* work with the win32 version. |
|
226 |
* @var int |
|
220 |
* Sets the SMTP server timeout in seconds. |
|
221 |
* This function will not work with the win32 version.
|
|
222 |
* @var int
|
|
227 | 223 |
*/ |
228 |
var $Timeout = 10;
|
|
224 |
public $Timeout = 10;
|
|
229 | 225 |
|
230 | 226 |
/** |
231 | 227 |
* Sets SMTP class debugging on or off. |
232 |
* @var bool |
|
228 |
* @var bool
|
|
233 | 229 |
*/ |
234 |
var $SMTPDebug = false;
|
|
230 |
public $SMTPDebug = false;
|
|
235 | 231 |
|
236 | 232 |
/** |
237 | 233 |
* Prevents the SMTP connection from being closed after each mail |
238 | 234 |
* sending. If this is set to true then to close the connection |
239 | 235 |
* requires an explicit call to SmtpClose(). |
240 |
* @var bool |
|
236 |
* @var bool
|
|
241 | 237 |
*/ |
242 |
var $SMTPKeepAlive = false;
|
|
238 |
public $SMTPKeepAlive = false;
|
|
243 | 239 |
|
244 | 240 |
/** |
245 | 241 |
* Provides the ability to have the TO field process individual |
246 | 242 |
* emails, instead of sending to entire TO addresses |
247 |
* @var bool |
|
243 |
* @var bool
|
|
248 | 244 |
*/ |
249 |
var $SingleTo = false;
|
|
245 |
public $SingleTo = false;
|
|
250 | 246 |
|
247 |
/** |
|
248 |
* If SingleTo is true, this provides the array to hold the email addresses |
|
249 |
* @var bool |
|
250 |
*/ |
|
251 |
public $SingleToArray = array(); |
|
252 |
|
|
253 |
/** |
|
254 |
* Provides the ability to change the line ending |
|
255 |
* @var string |
|
256 |
*/ |
|
257 |
public $LE = "\n"; |
|
258 |
|
|
259 |
/** |
|
260 |
* Used with DKIM DNS Resource Record |
|
261 |
* @var string |
|
262 |
*/ |
|
263 |
public $DKIM_selector = 'phpmailer'; |
|
264 |
|
|
265 |
/** |
|
266 |
* Used with DKIM DNS Resource Record |
|
267 |
* optional, in format of email address 'you@yourdomain.com' |
|
268 |
* @var string |
|
269 |
*/ |
|
270 |
public $DKIM_identity = ''; |
|
271 |
|
|
272 |
/** |
|
273 |
* Used with DKIM DNS Resource Record |
|
274 |
* optional, in format of email address 'you@yourdomain.com' |
|
275 |
* @var string |
|
276 |
*/ |
|
277 |
public $DKIM_domain = ''; |
|
278 |
|
|
279 |
/** |
|
280 |
* Used with DKIM DNS Resource Record |
|
281 |
* optional, in format of email address 'you@yourdomain.com' |
|
282 |
* @var string |
|
283 |
*/ |
|
284 |
public $DKIM_private = ''; |
|
285 |
|
|
286 |
/** |
|
287 |
* Callback Action function name |
|
288 |
* the function that handles the result of the send email action. Parameters: |
|
289 |
* bool $result result of the send action |
|
290 |
* string $to email address of the recipient |
|
291 |
* string $cc cc email addresses |
|
292 |
* string $bcc bcc email addresses |
|
293 |
* string $subject the subject |
|
294 |
* string $body the email body |
|
295 |
* @var string |
|
296 |
*/ |
|
297 |
public $action_function = ''; //'callbackAction'; |
|
298 |
|
|
299 |
/** |
|
300 |
* Sets the PHPMailer Version number |
|
301 |
* @var string |
|
302 |
*/ |
|
303 |
public $Version = '5.1'; |
|
304 |
|
|
251 | 305 |
///////////////////////////////////////////////// |
252 |
// PROPERTIES, PRIVATE |
|
306 |
// PROPERTIES, PRIVATE AND PROTECTED
|
|
253 | 307 |
///////////////////////////////////////////////// |
254 | 308 |
|
255 |
var $smtp = NULL; |
|
256 |
var $to = array(); |
|
257 |
var $cc = array(); |
|
258 |
var $bcc = array(); |
|
259 |
var $ReplyTo = array(); |
|
260 |
var $attachment = array(); |
|
261 |
var $CustomHeader = array(); |
|
262 |
var $message_type = ''; |
|
263 |
var $boundary = array(); |
|
264 |
var $language = array(); |
|
265 |
var $error_count = 0; |
|
266 |
var $LE = "\n"; |
|
267 |
var $sign_cert_file = ""; |
|
268 |
var $sign_key_file = ""; |
|
269 |
var $sign_key_pass = ""; |
|
309 |
private $smtp = NULL; |
|
310 |
private $to = array(); |
|
311 |
private $cc = array(); |
|
312 |
private $bcc = array(); |
|
313 |
private $ReplyTo = array(); |
|
314 |
private $all_recipients = array(); |
|
315 |
private $attachment = array(); |
|
316 |
private $CustomHeader = array(); |
|
317 |
private $message_type = ''; |
|
318 |
private $boundary = array(); |
|
319 |
protected $language = array(); |
|
320 |
private $error_count = 0; |
|
321 |
private $sign_cert_file = ""; |
|
322 |
private $sign_key_file = ""; |
|
323 |
private $sign_key_pass = ""; |
|
324 |
private $exceptions = false; |
|
270 | 325 |
|
271 | 326 |
///////////////////////////////////////////////// |
327 |
// CONSTANTS |
|
328 |
///////////////////////////////////////////////// |
|
329 |
|
|
330 |
const STOP_MESSAGE = 0; // message only, continue processing |
|
331 |
const STOP_CONTINUE = 1; // message?, likely ok to continue processing |
|
332 |
const STOP_CRITICAL = 2; // message, plus full stop, critical error reached |
|
333 |
|
|
334 |
///////////////////////////////////////////////// |
|
272 | 335 |
// METHODS, VARIABLES |
273 | 336 |
///////////////////////////////////////////////// |
274 | 337 |
|
275 | 338 |
/** |
339 |
* Constructor |
|
340 |
* @param boolean $exceptions Should we throw external exceptions? |
|
341 |
*/ |
|
342 |
public function __construct($exceptions = false) { |
|
343 |
$this->exceptions = ($exceptions == true); |
|
344 |
} |
|
345 |
|
|
346 |
/** |
|
276 | 347 |
* Sets message type to HTML. |
277 |
* @param bool $bool
|
|
278 |
* @return void |
|
348 |
* @param bool $ishtml
|
|
349 |
* @return void
|
|
279 | 350 |
*/ |
280 |
function IsHTML($bool) {
|
|
281 |
if($bool == true) {
|
|
351 |
public function IsHTML($ishtml = true) {
|
|
352 |
if ($ishtml) {
|
|
282 | 353 |
$this->ContentType = 'text/html'; |
283 | 354 |
} else { |
284 | 355 |
$this->ContentType = 'text/plain'; |
... | ... | |
287 | 358 |
|
288 | 359 |
/** |
289 | 360 |
* Sets Mailer to send message using SMTP. |
290 |
* @return void |
|
361 |
* @return void
|
|
291 | 362 |
*/ |
292 |
function IsSMTP() { |
|
363 |
public function IsSMTP() {
|
|
293 | 364 |
$this->Mailer = 'smtp'; |
294 | 365 |
} |
295 | 366 |
|
296 | 367 |
/** |
297 | 368 |
* Sets Mailer to send message using PHP mail() function. |
298 |
* @return void |
|
369 |
* @return void
|
|
299 | 370 |
*/ |
300 |
function IsMail() { |
|
371 |
public function IsMail() {
|
|
301 | 372 |
$this->Mailer = 'mail'; |
302 | 373 |
} |
303 | 374 |
|
304 | 375 |
/** |
305 | 376 |
* Sets Mailer to send message using the $Sendmail program. |
306 |
* @return void |
|
377 |
* @return void
|
|
307 | 378 |
*/ |
308 |
function IsSendmail() { |
|
379 |
public function IsSendmail() { |
|
380 |
if (!stristr(ini_get('sendmail_path'), 'sendmail')) { |
|
381 |
$this->Sendmail = '/var/qmail/bin/sendmail'; |
|
382 |
} |
|
309 | 383 |
$this->Mailer = 'sendmail'; |
310 | 384 |
} |
311 | 385 |
|
312 | 386 |
/** |
313 | 387 |
* Sets Mailer to send message using the qmail MTA. |
314 |
* @return void |
|
388 |
* @return void
|
|
315 | 389 |
*/ |
316 |
function IsQmail() { |
|
317 |
$this->Sendmail = '/var/qmail/bin/sendmail'; |
|
390 |
public function IsQmail() { |
|
391 |
if (stristr(ini_get('sendmail_path'), 'qmail')) { |
|
392 |
$this->Sendmail = '/var/qmail/bin/sendmail'; |
|
393 |
} |
|
318 | 394 |
$this->Mailer = 'sendmail'; |
319 | 395 |
} |
320 | 396 |
|
... | ... | |
324 | 400 |
|
325 | 401 |
/** |
326 | 402 |
* Adds a "To" address. |
327 |
* @param string $address |
|
328 |
* @param string $name |
|
329 |
* @return void
|
|
403 |
* @param string $address
|
|
404 |
* @param string $name
|
|
405 |
* @return boolean true on success, false if address already used
|
|
330 | 406 |
*/ |
331 |
function AddAddress($address, $name = '') { |
|
332 |
$cur = count($this->to); |
|
333 |
$this->to[$cur][0] = trim($address); |
|
334 |
$this->to[$cur][1] = $name; |
|
407 |
public function AddAddress($address, $name = '') { |
|
408 |
return $this->AddAnAddress('to', $address, $name); |
|
335 | 409 |
} |
336 | 410 |
|
337 | 411 |
/** |
338 |
* Adds a "Cc" address. Note: this function works |
|
339 |
* with the SMTP mailer on win32, not with the "mail" |
|
340 |
* mailer. |
|
341 |
* @param string $address |
|
342 |
* @param string $name |
|
343 |
* @return void |
|
412 |
* Adds a "Cc" address. |
|
413 |
* Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. |
|
414 |
* @param string $address |
|
415 |
* @param string $name |
|
416 |
* @return boolean true on success, false if address already used |
|
344 | 417 |
*/ |
345 |
function AddCC($address, $name = '') { |
|
346 |
$cur = count($this->cc); |
|
347 |
$this->cc[$cur][0] = trim($address); |
|
348 |
$this->cc[$cur][1] = $name; |
|
418 |
public function AddCC($address, $name = '') { |
|
419 |
return $this->AddAnAddress('cc', $address, $name); |
|
349 | 420 |
} |
350 | 421 |
|
351 | 422 |
/** |
352 |
* Adds a "Bcc" address. Note: this function works |
|
353 |
* with the SMTP mailer on win32, not with the "mail" |
|
354 |
* mailer. |
|
355 |
* @param string $address |
|
356 |
* @param string $name |
|
357 |
* @return void |
|
423 |
* Adds a "Bcc" address. |
|
424 |
* Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. |
|
425 |
* @param string $address |
|
426 |
* @param string $name |
|
427 |
* @return boolean true on success, false if address already used |
|
358 | 428 |
*/ |
359 |
function AddBCC($address, $name = '') { |
|
360 |
$cur = count($this->bcc); |
|
361 |
$this->bcc[$cur][0] = trim($address); |
|
362 |
$this->bcc[$cur][1] = $name; |
|
429 |
public function AddBCC($address, $name = '') { |
|
430 |
return $this->AddAnAddress('bcc', $address, $name); |
|
363 | 431 |
} |
364 | 432 |
|
365 | 433 |
/** |
366 |
* Adds a "Reply-To" address.
|
|
367 |
* @param string $address |
|
368 |
* @param string $name |
|
369 |
* @return void
|
|
434 |
* Adds a "Reply-to" address.
|
|
435 |
* @param string $address
|
|
436 |
* @param string $name
|
|
437 |
* @return boolean
|
|
370 | 438 |
*/ |
371 |
function AddReplyTo($address, $name = '') { |
|
372 |
$cur = count($this->ReplyTo); |
|
373 |
$this->ReplyTo[$cur][0] = trim($address); |
|
374 |
$this->ReplyTo[$cur][1] = $name; |
|
439 |
public function AddReplyTo($address, $name = '') { |
|
440 |
return $this->AddAnAddress('ReplyTo', $address, $name); |
|
375 | 441 |
} |
376 | 442 |
|
443 |
/** |
|
444 |
* Adds an address to one of the recipient arrays |
|
445 |
* Addresses that have been added already return false, but do not throw exceptions |
|
446 |
* @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' |
|
447 |
* @param string $address The email address to send to |
|
448 |
* @param string $name |
|
449 |
* @return boolean true on success, false if address already used or invalid in some way |
|
450 |
* @access private |
|
451 |
*/ |
|
452 |
private function AddAnAddress($kind, $address, $name = '') { |
|
453 |
if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { |
|
454 |
echo 'Invalid recipient array: ' . kind; |
|
455 |
return false; |
|
456 |
} |
|
457 |
$address = trim($address); |
|
458 |
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim |
|
459 |
if (!self::ValidateAddress($address)) { |
|
460 |
$this->SetError($this->Lang('invalid_address').': '. $address); |
|
461 |
if ($this->exceptions) { |
|
462 |
throw new phpmailerException($this->Lang('invalid_address').': '.$address); |
|
463 |
} |
|
464 |
echo $this->Lang('invalid_address').': '.$address; |
|
465 |
return false; |
|
466 |
} |
|
467 |
if ($kind != 'ReplyTo') { |
|
468 |
if (!isset($this->all_recipients[strtolower($address)])) { |
|
469 |
array_push($this->$kind, array($address, $name)); |
|
470 |
$this->all_recipients[strtolower($address)] = true; |
|
471 |
return true; |
|
472 |
} |
|
473 |
} else { |
|
474 |
if (!array_key_exists(strtolower($address), $this->ReplyTo)) { |
|
475 |
$this->ReplyTo[strtolower($address)] = array($address, $name); |
|
476 |
return true; |
|
477 |
} |
|
478 |
} |
|
479 |
return false; |
|
480 |
} |
|
481 |
|
|
482 |
/** |
|
483 |
* Set the From and FromName properties |
|
484 |
* @param string $address |
|
485 |
* @param string $name |
|
486 |
* @return boolean |
|
487 |
*/ |
|
488 |
public function SetFrom($address, $name = '',$auto=1) { |
|
489 |
$address = trim($address); |
|
490 |
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim |
|
491 |
if (!self::ValidateAddress($address)) { |
|
492 |
$this->SetError($this->Lang('invalid_address').': '. $address); |
|
493 |
if ($this->exceptions) { |
|
494 |
throw new phpmailerException($this->Lang('invalid_address').': '.$address); |
|
495 |
} |
|
496 |
echo $this->Lang('invalid_address').': '.$address; |
|
497 |
return false; |
|
498 |
} |
|
499 |
$this->From = $address; |
|
500 |
$this->FromName = $name; |
|
501 |
if ($auto) { |
|
502 |
if (empty($this->ReplyTo)) { |
|
503 |
$this->AddAnAddress('ReplyTo', $address, $name); |
|
504 |
} |
|
505 |
if (empty($this->Sender)) { |
|
506 |
$this->Sender = $address; |
|
507 |
} |
|
508 |
} |
|
509 |
return true; |
|
510 |
} |
|
511 |
|
|
512 |
/** |
|
513 |
* Check that a string looks roughly like an email address should |
|
514 |
* Static so it can be used without instantiation |
|
515 |
* Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator |
|
516 |
* Conforms approximately to RFC2822 |
|
517 |
* @link http://www.hexillion.com/samples/#Regex Original pattern found here |
|
518 |
* @param string $address The email address to check |
|
519 |
* @return boolean |
|
520 |
* @static |
|
521 |
* @access public |
|
522 |
*/ |
|
523 |
public static function ValidateAddress($address) { |
|
524 |
if (function_exists('filter_var')) { //Introduced in PHP 5.2 |
|
525 |
if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) { |
|
526 |
return false; |
|
527 |
} else { |
|
528 |
return true; |
|
529 |
} |
|
530 |
} else { |
|
531 |
return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); |
|
532 |
} |
|
533 |
} |
|
534 |
|
|
377 | 535 |
///////////////////////////////////////////////// |
378 | 536 |
// METHODS, MAIL SENDING |
379 | 537 |
///////////////////////////////////////////////// |
... | ... | |
382 | 540 |
* Creates message and assigns Mailer. If the message is |
383 | 541 |
* not sent successfully then it returns false. Use the ErrorInfo |
384 | 542 |
* variable to view description of the error. |
385 |
* @return bool |
|
543 |
* @return bool
|
|
386 | 544 |
*/ |
387 |
function Send() { |
|
388 |
$header = ''; |
|
389 |
$body = ''; |
|
390 |
$result = true; |
|
545 |
public function Send() { |
|
546 |
try { |
|
547 |
if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { |
|
548 |
throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); |
|
549 |
} |
|
391 | 550 |
|
392 |
if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
|
|
393 |
$this->SetError($this->Lang('provide_address'));
|
|
394 |
return false;
|
|
395 |
} |
|
551 |
// Set whether the message is multipart/alternative
|
|
552 |
if(!empty($this->AltBody)) {
|
|
553 |
$this->ContentType = 'multipart/alternative';
|
|
554 |
}
|
|
396 | 555 |
|
397 |
/* Set whether the message is multipart/alternative */
|
|
398 |
if(!empty($this->AltBody)) {
|
|
399 |
$this->ContentType = 'multipart/alternative';
|
|
400 |
}
|
|
556 |
$this->error_count = 0; // reset errors
|
|
557 |
$this->SetMessageType();
|
|
558 |
$header = $this->CreateHeader();
|
|
559 |
$body = $this->CreateBody();
|
|
401 | 560 |
|
402 |
$this->error_count = 0; // reset errors |
|
403 |
$this->SetMessageType(); |
|
404 |
$header .= $this->CreateHeader(); |
|
405 |
$body = $this->CreateBody(); |
|
561 |
if (empty($this->Body)) { |
|
562 |
throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL); |
|
563 |
} |
|
406 | 564 |
|
407 |
if($body == '') { |
|
565 |
// digitally sign with DKIM if enabled |
|
566 |
if ($this->DKIM_domain && $this->DKIM_private) { |
|
567 |
$header_dkim = $this->DKIM_Add($header,$this->Subject,$body); |
|
568 |
$header = str_replace("\r\n","\n",$header_dkim) . $header; |
|
569 |
} |
|
570 |
|
|
571 |
// Choose the mailer and send through it |
|
572 |
switch($this->Mailer) { |
|
573 |
case 'sendmail': |
|
574 |
return $this->SendmailSend($header, $body); |
|
575 |
case 'smtp': |
|
576 |
return $this->SmtpSend($header, $body); |
|
577 |
default: |
|
578 |
return $this->MailSend($header, $body); |
|
579 |
} |
|
580 |
|
|
581 |
} catch (phpmailerException $e) { |
|
582 |
$this->SetError($e->getMessage()); |
|
583 |
if ($this->exceptions) { |
|
584 |
throw $e; |
|
585 |
} |
|
586 |
echo $e->getMessage()."\n"; |
|
408 | 587 |
return false; |
409 | 588 |
} |
410 |
|
|
411 |
/* Choose the mailer */ |
|
412 |
switch($this->Mailer) { |
|
413 |
case 'sendmail': |
|
414 |
$result = $this->SendmailSend($header, $body); |
|
415 |
break; |
|
416 |
case 'smtp': |
|
417 |
$result = $this->SmtpSend($header, $body); |
|
418 |
break; |
|
419 |
case 'mail': |
|
420 |
$result = $this->MailSend($header, $body); |
|
421 |
break; |
|
422 |
default: |
|
423 |
$result = $this->MailSend($header, $body); |
|
424 |
break; |
|
425 |
//$this->SetError($this->Mailer . $this->Lang('mailer_not_supported')); |
|
426 |
//$result = false; |
|
427 |
//break; |
|
428 |
} |
|
429 |
|
|
430 |
return $result; |
|
431 | 589 |
} |
432 | 590 |
|
433 | 591 |
/** |
434 | 592 |
* Sends mail using the $Sendmail program. |
435 |
* @access private |
|
436 |
* @return bool |
|
593 |
* @param string $header The message headers |
|
594 |
* @param string $body The message body |
|
595 |
* @access protected |
|
596 |
* @return bool |
|
437 | 597 |
*/ |
438 |
function SendmailSend($header, $body) { |
|
598 |
protected function SendmailSend($header, $body) {
|
|
439 | 599 |
if ($this->Sender != '') { |
440 | 600 |
$sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); |
441 | 601 |
} else { |
442 | 602 |
$sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); |
443 | 603 |
} |
444 |
|
|
445 |
if(!@$mail = popen($sendmail, 'w')) { |
|
446 |
$this->SetError($this->Lang('execute') . $this->Sendmail); |
|
447 |
return false; |
|
604 |
if ($this->SingleTo === true) { |
|
605 |
foreach ($this->SingleToArray as $key => $val) { |
|
606 |
if(!@$mail = popen($sendmail, 'w')) { |
|
607 |
throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
608 |
} |
|
609 |
fputs($mail, "To: " . $val . "\n"); |
|
610 |
fputs($mail, $header); |
|
611 |
fputs($mail, $body); |
|
612 |
$result = pclose($mail); |
|
613 |
// implement call back function if it exists |
|
614 |
$isSent = ($result == 0) ? 1 : 0; |
|
615 |
$this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body); |
|
616 |
if($result != 0) { |
|
617 |
throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
618 |
} |
|
619 |
} |
|
620 |
} else { |
|
621 |
if(!@$mail = popen($sendmail, 'w')) { |
|
622 |
throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
623 |
} |
|
624 |
fputs($mail, $header); |
|
625 |
fputs($mail, $body); |
|
626 |
$result = pclose($mail); |
|
627 |
// implement call back function if it exists |
|
628 |
$isSent = ($result == 0) ? 1 : 0; |
|
629 |
$this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body); |
|
630 |
if($result != 0) { |
|
631 |
throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
632 |
} |
|
448 | 633 |
} |
449 |
|
|
450 |
fputs($mail, $header); |
|
451 |
fputs($mail, $body); |
|
452 |
|
|
453 |
$result = pclose($mail); |
|
454 |
if (version_compare(phpversion(), '4.2.3') == -1) { |
|
455 |
$result = $result >> 8 & 0xFF; |
|
456 |
} |
|
457 |
if($result != 0) { |
|
458 |
$this->SetError($this->Lang('execute') . $this->Sendmail); |
|
459 |
return false; |
|
460 |
} |
|
461 | 634 |
return true; |
462 | 635 |
} |
463 | 636 |
|
464 | 637 |
/** |
465 | 638 |
* Sends mail using the PHP mail() function. |
466 |
* @access private |
|
467 |
* @return bool |
|
639 |
* @param string $header The message headers |
|
640 |
* @param string $body The message body |
|
641 |
* @access protected |
|
642 |
* @return bool |
|
468 | 643 |
*/ |
469 |
function MailSend($header, $body) { |
|
470 |
|
|
471 |
$to = ''; |
|
472 |
for($i = 0; $i < count($this->to); $i++) { |
|
473 |
if($i != 0) { $to .= ', '; } |
|
474 |
$to .= $this->AddrFormat($this->to[$i]); |
|
644 |
protected function MailSend($header, $body) { |
|
645 |
$toArr = array(); |
|
646 |
foreach($this->to as $t) { |
|
647 |
$toArr[] = $this->AddrFormat($t); |
|
475 | 648 |
} |
649 |
$to = implode(', ', $toArr); |
|
476 | 650 |
|
477 |
$toArr = explode(",", $to); |
|
478 |
|
|
479 | 651 |
$params = sprintf("-oi -f %s", $this->Sender); |
480 |
if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
|
|
652 |
if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { |
|
481 | 653 |
$old_from = ini_get('sendmail_from'); |
482 | 654 |
ini_set('sendmail_from', $this->Sender); |
483 | 655 |
if ($this->SingleTo === true && count($toArr) > 1) { |
484 | 656 |
foreach ($toArr as $key => $val) { |
485 | 657 |
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); |
658 |
// implement call back function if it exists |
|
659 |
$isSent = ($rt == 1) ? 1 : 0; |
|
660 |
$this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body); |
|
486 | 661 |
} |
487 | 662 |
} else { |
488 | 663 |
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); |
664 |
// implement call back function if it exists |
|
665 |
$isSent = ($rt == 1) ? 1 : 0; |
|
666 |
$this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body); |
|
489 | 667 |
} |
490 | 668 |
} else { |
491 | 669 |
if ($this->SingleTo === true && count($toArr) > 1) { |
492 | 670 |
foreach ($toArr as $key => $val) { |
493 | 671 |
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); |
672 |
// implement call back function if it exists |
|
673 |
$isSent = ($rt == 1) ? 1 : 0; |
|
674 |
$this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body); |
|
494 | 675 |
} |
495 | 676 |
} else { |
496 | 677 |
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header); |
678 |
// implement call back function if it exists |
|
679 |
$isSent = ($rt == 1) ? 1 : 0; |
|
680 |
$this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body); |
|
497 | 681 |
} |
498 | 682 |
} |
499 |
|
|
500 | 683 |
if (isset($old_from)) { |
501 | 684 |
ini_set('sendmail_from', $old_from); |
502 | 685 |
} |
503 |
|
|
504 | 686 |
if(!$rt) { |
505 |
$this->SetError($this->Lang('instantiate')); |
|
506 |
return false; |
|
687 |
throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL); |
|
507 | 688 |
} |
508 |
|
|
509 | 689 |
return true; |
510 | 690 |
} |
511 | 691 |
|
512 | 692 |
/** |
513 |
* Sends mail via SMTP using PhpSMTP (Author: |
|
514 |
* Chris Ryan). Returns bool. Returns false if there is a |
|
515 |
* bad MAIL FROM, RCPT, or DATA input. |
|
516 |
* @access private |
|
517 |
* @return bool |
|
693 |
* Sends mail via SMTP using PhpSMTP |
|
694 |
* Returns false if there is a bad MAIL FROM, RCPT, or DATA input. |
|
695 |
* @param string $header The message headers |
|
696 |
* @param string $body The message body |
|
697 |
* @uses SMTP |
|
698 |
* @access protected |
|
699 |
* @return bool |
|
518 | 700 |
*/ |
519 |
function SmtpSend($header, $body) { |
|
520 |
include_once($this->PluginDir . 'class.smtp.php'); |
|
521 |
$error = ''; |
|
701 |
protected function SmtpSend($header, $body) { |
|
702 |
require_once $this->PluginDir . 'class.smtp.php'; |
|
522 | 703 |
$bad_rcpt = array(); |
523 | 704 |
|
524 | 705 |
if(!$this->SmtpConnect()) { |
525 |
return false;
|
|
706 |
throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
|
|
526 | 707 |
} |
527 |
|
|
528 | 708 |
$smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; |
529 | 709 |
if(!$this->smtp->Mail($smtp_from)) { |
530 |
$error = $this->Lang('from_failed') . $smtp_from; |
|
531 |
$this->SetError($error); |
|
532 |
$this->smtp->Reset(); |
|
533 |
return false; |
|
710 |
throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL); |
|
534 | 711 |
} |
535 | 712 |
|
536 |
/* Attempt to send attach all recipients */ |
|
537 |
for($i = 0; $i < count($this->to); $i++) { |
|
538 |
if(!$this->smtp->Recipient($this->to[$i][0])) { |
|
539 |
$bad_rcpt[] = $this->to[$i][0]; |
|
713 |
// Attempt to send attach all recipients |
|
714 |
foreach($this->to as $to) { |
|
715 |
if (!$this->smtp->Recipient($to[0])) { |
|
716 |
$bad_rcpt[] = $to[0]; |
|
717 |
// implement call back function if it exists |
|
718 |
$isSent = 0; |
|
719 |
$this->doCallback($isSent,$to[0],'','',$this->Subject,$body); |
|
720 |
} else { |
|
721 |
// implement call back function if it exists |
|
722 |
$isSent = 1; |
|
723 |
$this->doCallback($isSent,$to[0],'','',$this->Subject,$body); |
|
540 | 724 |
} |
541 | 725 |
} |
542 |
for($i = 0; $i < count($this->cc); $i++) { |
|
543 |
if(!$this->smtp->Recipient($this->cc[$i][0])) { |
|
544 |
$bad_rcpt[] = $this->cc[$i][0]; |
|
726 |
foreach($this->cc as $cc) { |
|
727 |
if (!$this->smtp->Recipient($cc[0])) { |
|
728 |
$bad_rcpt[] = $cc[0]; |
|
729 |
// implement call back function if it exists |
|
730 |
$isSent = 0; |
|
731 |
$this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body); |
|
732 |
} else { |
|
733 |
// implement call back function if it exists |
|
734 |
$isSent = 1; |
|
735 |
$this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body); |
|
545 | 736 |
} |
546 | 737 |
} |
547 |
for($i = 0; $i < count($this->bcc); $i++) { |
|
548 |
if(!$this->smtp->Recipient($this->bcc[$i][0])) { |
|
549 |
$bad_rcpt[] = $this->bcc[$i][0]; |
|
738 |
foreach($this->bcc as $bcc) { |
|
739 |
if (!$this->smtp->Recipient($bcc[0])) { |
|
740 |
$bad_rcpt[] = $bcc[0]; |
|
741 |
// implement call back function if it exists |
|
742 |
$isSent = 0; |
|
743 |
$this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body); |
|
744 |
} else { |
|
745 |
// implement call back function if it exists |
|
746 |
$isSent = 1; |
|
747 |
$this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body); |
|
550 | 748 |
} |
551 | 749 |
} |
552 | 750 |
|
553 |
if(count($bad_rcpt) > 0) { // Create error message |
|
554 |
for($i = 0; $i < count($bad_rcpt); $i++) { |
|
555 |
if($i != 0) { |
|
556 |
$error .= ', '; |
|
557 |
} |
|
558 |
$error .= $bad_rcpt[$i]; |
|
559 |
} |
|
560 |
$error = $this->Lang('recipients_failed') . $error; |
|
561 |
$this->SetError($error); |
|
562 |
$this->smtp->Reset(); |
|
563 |
return false; |
|
751 |
|
|
752 |
if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses |
|
753 |
$badaddresses = implode(', ', $bad_rcpt); |
|
754 |
throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); |
|
564 | 755 |
} |
565 |
|
|
566 | 756 |
if(!$this->smtp->Data($header . $body)) { |
567 |
$this->SetError($this->Lang('data_not_accepted')); |
|
568 |
$this->smtp->Reset(); |
|
569 |
return false; |
|
757 |
throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); |
|
570 | 758 |
} |
571 | 759 |
if($this->SMTPKeepAlive == true) { |
572 | 760 |
$this->smtp->Reset(); |
573 |
} else { |
|
574 |
$this->SmtpClose(); |
|
575 | 761 |
} |
576 |
|
|
577 | 762 |
return true; |
578 | 763 |
} |
579 | 764 |
|
580 | 765 |
/** |
581 |
* Initiates a connection to an SMTP server. Returns false if the |
|
582 |
* operation failed. |
|
583 |
* @access private |
|
584 |
* @return bool |
|
766 |
* Initiates a connection to an SMTP server. |
|
767 |
* Returns false if the operation failed. |
|
768 |
* @uses SMTP |
|
769 |
* @access public |
|
770 |
* @return bool |
|
585 | 771 |
*/ |
586 |
function SmtpConnect() |
|
587 |
{ |
|
588 |
if($this->smtp == NULL) |
|
589 |
{ |
|
772 |
public function SmtpConnect() { |
|
773 |
if(is_null($this->smtp)) { |
|
590 | 774 |
$this->smtp = new SMTP(); |
591 | 775 |
} |
592 | 776 |
|
593 | 777 |
$this->smtp->do_debug = $this->SMTPDebug; |
594 | 778 |
$hosts = explode(';', $this->Host); |
595 | 779 |
$index = 0; |
596 |
$connection = ($this->smtp->Connected());
|
|
780 |
$connection = $this->smtp->Connected();
|
|
597 | 781 |
|
598 |
/* Retry while there is no connection */ |
|
599 |
while($index < count($hosts) && $connection == false) |
|
600 |
{ |
|
601 |
$hostinfo = array(); |
|
602 |
if(preg_match('/(.+):([0-9]+)/', $hosts[$index], $hostinfo)) |
|
603 |
{ |
|
604 |
$host = $hostinfo[1]; |
|
605 |
$port = $hostinfo[2]; |
|
606 |
} else { |
|
607 |
$host = $hosts[$index]; |
|
608 |
$port = $this->Port; |
|
609 |
} |
|
610 |
|
|
611 |
if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) { |
|
612 |
if ($this->Helo != '') { |
|
613 |
$this->smtp->Hello($this->Helo); |
|
782 |
// Retry while there is no connection |
|
783 |
try { |
|
784 |
while($index < count($hosts) && !$connection) { |
|
785 |
$hostinfo = array(); |
|
786 |
if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { |
|
787 |
$host = $hostinfo[1]; |
|
788 |
$port = $hostinfo[2]; |
|
614 | 789 |
} else { |
615 |
$this->smtp->Hello($this->ServerHostname()); |
|
790 |
$host = $hosts[$index]; |
|
791 |
$port = $this->Port; |
|
616 | 792 |
} |
617 | 793 |
|
618 |
$connection = true; |
|
619 |
if($this->SMTPAuth) { |
|
620 |
if(!$this->smtp->Authenticate($this->Username, $this->Password)) { |
|
621 |
$this->SetError($this->Lang('authenticate')); |
|
622 |
$this->smtp->Reset(); |
|
623 |
$connection = false; |
|
794 |
$tls = ($this->SMTPSecure == 'tls'); |
|
795 |
$ssl = ($this->SMTPSecure == 'ssl'); |
|
796 |
|
|
797 |
if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) { |
|
798 |
|
|
799 |
$hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname()); |
|
800 |
$this->smtp->Hello($hello); |
|
801 |
|
|
802 |
if ($tls) { |
|
803 |
if (!$this->smtp->StartTLS()) { |
|
804 |
throw new phpmailerException($this->Lang('tls')); |
|
805 |
} |
|
806 |
|
|
807 |
//We must resend HELO after tls negotiation |
|
808 |
$this->smtp->Hello($hello); |
|
624 | 809 |
} |
810 |
|
|
811 |
$connection = true; |
|
812 |
if ($this->SMTPAuth) { |
|
813 |
if (!$this->smtp->Authenticate($this->Username, $this->Password)) { |
|
814 |
throw new phpmailerException($this->Lang('authenticate')); |
|
815 |
} |
|
816 |
} |
|
625 | 817 |
} |
818 |
$index++; |
|
819 |
if (!$connection) { |
|
820 |
throw new phpmailerException($this->Lang('connect_host')); |
|
821 |
} |
|
626 | 822 |
} |
627 |
$index++; |
|
823 |
} catch (phpmailerException $e) { |
|
824 |
$this->smtp->Reset(); |
|
825 |
throw $e; |
|
628 | 826 |
} |
629 |
if(!$connection) { |
|
630 |
$this->SetError($this->Lang('connect_host')); |
|
631 |
} |
|
632 |
|
|
633 |
return $connection; |
|
827 |
return true; |
|
634 | 828 |
} |
635 | 829 |
|
636 | 830 |
/** |
637 | 831 |
* Closes the active SMTP session if one exists. |
638 |
* @return void |
|
832 |
* @return void
|
|
639 | 833 |
*/ |
640 |
function SmtpClose() { |
|
641 |
if($this->smtp != NULL) {
|
|
834 |
public function SmtpClose() {
|
|
835 |
if(!is_null($this->smtp)) {
|
|
642 | 836 |
if($this->smtp->Connected()) { |
643 | 837 |
$this->smtp->Quit(); |
644 | 838 |
$this->smtp->Close(); |
... | ... | |
647 | 841 |
} |
648 | 842 |
|
649 | 843 |
/** |
650 |
* Sets the language for all class error messages. Returns false |
|
651 |
* if it cannot load the language file. The default language type |
|
652 |
* is English. |
|
653 |
* @param string $lang_type Type of language (e.g. Portuguese: "br") |
|
844 |
* Sets the language for all class error messages. |
|
845 |
* Returns false if it cannot load the language file. The default language is English. |
|
846 |
* @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br") |
|
654 | 847 |
* @param string $lang_path Path to the language file directory |
655 | 848 |
* @access public |
656 |
* @return bool |
|
657 |
*/ |
|
658 |
function SetLanguage($lang_type, $lang_path = 'language/') { |
|
659 |
if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) { |
|
660 |
include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); |
|
661 |
} elseif (file_exists($lang_path.'phpmailer.lang-en.php')) { |
|
662 |
include($lang_path.'phpmailer.lang-en.php'); |
|
663 |
} else { |
|
664 |
$PHPMAILER_LANG = array(); |
|
665 |
$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . |
|
666 |
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.'; |
|
667 |
$PHPMAILER_LANG["execute"] = 'Could not execute: '; |
|
668 |
$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.'; |
|
669 |
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.'; |
|
670 |
$PHPMAILER_LANG["from_failed"] = 'The following From address failed: '; |
|
671 |
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . |
|
672 |
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.'; |
|
673 |
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.'; |
|
674 |
$PHPMAILER_LANG["file_access"] = 'Could not access file: '; |
|
675 |
$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: '; |
|
676 |
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: '; |
|
677 |
$PHPMAILER_LANG["signing"] = 'Signing Error: '; |
|
849 |
*/ |
|
850 |
function SetLanguage($langcode = 'en', $lang_path = 'language/') { |
|
851 |
//Define full set of translatable strings |
|
852 |
$PHPMAILER_LANG = array( |
|
853 |
'provide_address' => 'You must provide at least one recipient email address.', |
|
854 |
'mailer_not_supported' => ' mailer is not supported.', |
|
855 |
'execute' => 'Could not execute: ', |
|
856 |
'instantiate' => 'Could not instantiate mail function.', |
|
857 |
'authenticate' => 'SMTP Error: Could not authenticate.', |
|
858 |
'from_failed' => 'The following From address failed: ', |
|
859 |
'recipients_failed' => 'SMTP Error: The following recipients failed: ', |
|
860 |
'data_not_accepted' => 'SMTP Error: Data not accepted.', |
|
861 |
'connect_host' => 'SMTP Error: Could not connect to SMTP host.', |
|
862 |
'file_access' => 'Could not access file: ', |
|
863 |
'file_open' => 'File Error: Could not open file: ', |
|
864 |
'encoding' => 'Unknown encoding: ', |
|
865 |
'signing' => 'Signing Error: ', |
|
866 |
'smtp_error' => 'SMTP server error: ', |
|
867 |
'empty_message' => 'Message body empty', |
|
868 |
'invalid_address' => 'Invalid address', |
|
869 |
'variable_set' => 'Cannot set or reset variable: ' |
|
870 |
); |
|
871 |
//Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"! |
|
872 |
$l = true; |
|
873 |
if ($langcode != 'en') { //There is no English translation file |
|
874 |
$l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php'; |
|
678 | 875 |
} |
679 | 876 |
$this->language = $PHPMAILER_LANG; |
877 |
return ($l == true); //Returns false if language not found |
|
878 |
} |
|
680 | 879 |
|
681 |
return true; |
|
880 |
/** |
|
881 |
* Return the current array of language strings |
|
882 |
* @return array |
|
883 |
*/ |
|
884 |
public function GetTranslations() { |
|
885 |
return $this->language; |
|
682 | 886 |
} |
683 | 887 |
|
684 | 888 |
///////////////////////////////////////////////// |
... | ... | |
687 | 891 |
|
688 | 892 |
/** |
689 | 893 |
* Creates recipient headers. |
690 |
* @access private
|
|
691 |
* @return string |
|
894 |
* @access public
|
|
895 |
* @return string
|
|
692 | 896 |
*/ |
693 |
function AddrAppend($type, $addr) { |
|
897 |
public function AddrAppend($type, $addr) {
|
|
694 | 898 |
$addr_str = $type . ': '; |
695 |
$addr_str .= $this->AddrFormat($addr[0]); |
|
696 |
if(count($addr) > 1) { |
|
697 |
for($i = 1; $i < count($addr); $i++) { |
|
698 |
$addr_str .= ', ' . $this->AddrFormat($addr[$i]); |
|
699 |
} |
|
899 |
$addresses = array(); |
|
900 |
foreach ($addr as $a) { |
|
901 |
$addresses[] = $this->AddrFormat($a); |
|
700 | 902 |
} |
903 |
$addr_str .= implode(', ', $addresses); |
|
701 | 904 |
$addr_str .= $this->LE; |
702 | 905 |
|
703 | 906 |
return $addr_str; |
... | ... | |
705 | 908 |
|
706 | 909 |
/** |
707 | 910 |
* Formats an address correctly. |
708 |
* @access private
|
|
709 |
* @return string |
|
911 |
* @access public
|
|
912 |
* @return string
|
|
710 | 913 |
*/ |
711 |
function AddrFormat($addr) { |
|
712 |
if(empty($addr[1])) { |
|
713 |
$formatted = $this->SecureHeader($addr[0]);
|
|
914 |
public function AddrFormat($addr) {
|
|
915 |
if (empty($addr[1])) {
|
|
916 |
return $this->SecureHeader($addr[0]);
|
|
714 | 917 |
} else { |
715 |
$formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
|
|
918 |
return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
|
|
716 | 919 |
} |
717 |
|
|
718 |
return $formatted; |
|
719 | 920 |
} |
720 | 921 |
|
721 | 922 |
/** |
722 | 923 |
* Wraps message for use with mailers that do not |
723 | 924 |
* automatically perform wrapping and for quoted-printable. |
724 | 925 |
* Original written by philippe. |
725 |
* @access private |
|
726 |
* @return string |
|
926 |
* @param string $message The message to wrap |
|
927 |
* @param integer $length The line length to wrap to |
|
928 |
* @param boolean $qp_mode Whether to run in Quoted-Printable mode |
|
929 |
* @access public |
|
930 |
* @return string |
|
727 | 931 |
*/ |
728 |
function WrapText($message, $length, $qp_mode = false) { |
|
932 |
public function WrapText($message, $length, $qp_mode = false) {
|
|
729 | 933 |
$soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; |
730 | 934 |
// If utf-8 encoding is used, we will need to make sure we don't |
731 | 935 |
// split multibyte characters when we wrap |
... | ... | |
802 | 1006 |
* Finds last character boundary prior to maxLength in a utf-8 |
803 | 1007 |
* quoted (printable) encoded string. |
804 | 1008 |
* Original written by Colin Brown. |
805 |
* @access private
|
|
806 |
* @param string $encodedText utf-8 QP text |
|
807 |
* @param int $maxLength find last character boundary prior to this length |
|
808 |
* @return int |
|
1009 |
* @access public
|
|
1010 |
* @param string $encodedText utf-8 QP text
|
|
1011 |
* @param int $maxLength find last character boundary prior to this length
|
|
1012 |
* @return int
|
|
809 | 1013 |
*/ |
810 |
function UTF8CharBoundary($encodedText, $maxLength) { |
|
1014 |
public function UTF8CharBoundary($encodedText, $maxLength) {
|
|
811 | 1015 |
$foundSplitPos = false; |
812 | 1016 |
$lookBack = 3; |
813 | 1017 |
while (!$foundSplitPos) { |
... | ... | |
839 | 1043 |
return $maxLength; |
840 | 1044 |
} |
841 | 1045 |
|
1046 |
|
|
842 | 1047 |
/** |
843 | 1048 |
* Set the body wrapping. |
844 |
* @access private
|
|
845 |
* @return void |
|
1049 |
* @access public
|
|
1050 |
* @return void
|
|
846 | 1051 |
*/ |
847 |
function SetWordWrap() { |
|
1052 |
public function SetWordWrap() {
|
|
848 | 1053 |
if($this->WordWrap < 1) { |
849 | 1054 |
return; |
850 | 1055 |
} |
851 | 1056 |
|
852 | 1057 |
switch($this->message_type) { |
853 | 1058 |
case 'alt': |
854 |
/* fall through */ |
|
855 | 1059 |
case 'alt_attachments': |
856 | 1060 |
$this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); |
857 | 1061 |
break; |
... | ... | |
863 | 1067 |
|
864 | 1068 |
/** |
865 | 1069 |
* Assembles message header. |
866 |
* @access private
|
|
867 |
* @return string
|
|
1070 |
* @access public
|
|
1071 |
* @return string The assembled header
|
|
868 | 1072 |
*/ |
869 |
function CreateHeader() { |
|
1073 |
public function CreateHeader() {
|
|
870 | 1074 |
$result = ''; |
871 | 1075 |
|
872 |
/* Set the boundaries */
|
|
1076 |
// Set the boundaries
|
|
873 | 1077 |
$uniq_id = md5(uniqid(time())); |
874 | 1078 |
$this->boundary[1] = 'b1_' . $uniq_id; |
875 | 1079 |
$this->boundary[2] = 'b2_' . $uniq_id; |
876 | 1080 |
|
877 |
$result .= $this->HeaderLine('Date', $this->RFCDate());
|
|
1081 |
$result .= $this->HeaderLine('Date', self::RFCDate());
|
|
878 | 1082 |
if($this->Sender == '') { |
879 | 1083 |
$result .= $this->HeaderLine('Return-Path', trim($this->From)); |
880 | 1084 |
} else { |
881 | 1085 |
$result .= $this->HeaderLine('Return-Path', trim($this->Sender)); |
882 | 1086 |
} |
883 | 1087 |
|
884 |
/* To be created automatically by mail() */
|
|
1088 |
// To be created automatically by mail()
|
|
885 | 1089 |
if($this->Mailer != 'mail') { |
886 |
if(count($this->to) > 0) { |
|
887 |
$result .= $this->AddrAppend('To', $this->to); |
|
888 |
} elseif (count($this->cc) == 0) { |
|
889 |
$result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); |
|
1090 |
if ($this->SingleTo === true) { |
|
1091 |
foreach($this->to as $t) { |
|
1092 |
$this->SingleToArray[] = $this->AddrFormat($t); |
|
1093 |
} |
|
1094 |
} else { |
|
1095 |
if(count($this->to) > 0) { |
|
1096 |
$result .= $this->AddrAppend('To', $this->to); |
|
1097 |
} elseif (count($this->cc) == 0) { |
|
1098 |
$result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); |
|
1099 |
} |
|
890 | 1100 |
} |
891 | 1101 |
} |
892 | 1102 |
|
... | ... | |
895 | 1105 |
$from[0][1] = $this->FromName; |
896 | 1106 |
$result .= $this->AddrAppend('From', $from); |
897 | 1107 |
|
898 |
/* sendmail and mail() extract Cc from the header before sending */
|
|
899 |
if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
|
|
1108 |
// sendmail and mail() extract Cc from the header before sending
|
|
1109 |
if(count($this->cc) > 0) {
|
|
900 | 1110 |
$result .= $this->AddrAppend('Cc', $this->cc); |
901 | 1111 |
} |
902 | 1112 |
|
903 |
/* sendmail and mail() extract Bcc from the header before sending */
|
|
1113 |
// sendmail and mail() extract Bcc from the header before sending
|
|
904 | 1114 |
if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) { |
905 | 1115 |
$result .= $this->AddrAppend('Bcc', $this->bcc); |
906 | 1116 |
} |
907 | 1117 |
|
908 | 1118 |
if(count($this->ReplyTo) > 0) { |
909 |
$result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
|
|
1119 |
$result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
|
|
910 | 1120 |
} |
911 | 1121 |
|
912 |
/* mail() sets the subject itself */
|
|
1122 |
// mail() sets the subject itself
|
|
913 | 1123 |
if($this->Mailer != 'mail') { |
914 | 1124 |
$result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); |
915 | 1125 |
} |
... | ... | |
920 | 1130 |
$result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); |
921 | 1131 |
} |
922 | 1132 |
$result .= $this->HeaderLine('X-Priority', $this->Priority); |
923 |
$result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
|
|
1133 |
$result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');
|
|
924 | 1134 |
|
925 | 1135 |
if($this->ConfirmReadingTo != '') { |
926 | 1136 |
$result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); |
... | ... | |
940 | 1150 |
|
941 | 1151 |
/** |
942 | 1152 |
* Returns the message MIME. |
943 |
* @access private
|
|
944 |
* @return string |
|
1153 |
* @access public
|
|
1154 |
* @return string
|
|
945 | 1155 |
*/ |
946 |
function GetMailMIME() { |
|
1156 |
public function GetMailMIME() {
|
|
947 | 1157 |
$result = ''; |
948 | 1158 |
switch($this->message_type) { |
949 | 1159 |
case 'plain': |
... | ... | |
951 | 1161 |
$result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet); |
952 | 1162 |
break; |
953 | 1163 |
case 'attachments': |
954 |
/* fall through */ |
|
955 | 1164 |
case 'alt_attachments': |
956 | 1165 |
if($this->InlineImageExists()){ |
957 | 1166 |
$result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE); |
... | ... | |
975 | 1184 |
|
976 | 1185 |
/** |
977 | 1186 |
* Assembles the message body. Returns an empty string on failure. |
978 |
* @access private
|
|
979 |
* @return string
|
|
1187 |
* @access public
|
|
1188 |
* @return string The assembled message body
|
|
980 | 1189 |
*/ |
981 |
function CreateBody() { |
|
982 |
$result = ''; |
|
1190 |
public function CreateBody() { |
|
1191 |
$body = ''; |
|
1192 |
|
|
983 | 1193 |
if ($this->sign_key_file) { |
984 |
$result .= $this->GetMailMIME();
|
|
1194 |
$body .= $this->GetMailMIME();
|
|
985 | 1195 |
} |
986 | 1196 |
|
987 | 1197 |
$this->SetWordWrap(); |
988 | 1198 |
|
989 | 1199 |
switch($this->message_type) { |
990 | 1200 |
case 'alt': |
991 |
$result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
|
|
992 |
$result .= $this->EncodeString($this->AltBody, $this->Encoding);
|
|
993 |
$result .= $this->LE.$this->LE;
|
|
994 |
$result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
|
|
995 |
$result .= $this->EncodeString($this->Body, $this->Encoding);
|
|
996 |
$result .= $this->LE.$this->LE;
|
|
997 |
$result .= $this->EndBoundary($this->boundary[1]);
|
|
1201 |
$body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
|
|
1202 |
$body .= $this->EncodeString($this->AltBody, $this->Encoding);
|
|
1203 |
$body .= $this->LE.$this->LE;
|
|
1204 |
$body .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
|
|
1205 |
$body .= $this->EncodeString($this->Body, $this->Encoding);
|
|
1206 |
$body .= $this->LE.$this->LE;
|
|
1207 |
$body .= $this->EndBoundary($this->boundary[1]);
|
|
998 | 1208 |
break; |
999 | 1209 |
case 'plain': |
1000 |
$result .= $this->EncodeString($this->Body, $this->Encoding);
|
|
1210 |
$body .= $this->EncodeString($this->Body, $this->Encoding);
|
|
1001 | 1211 |
break; |
1002 | 1212 |
case 'attachments': |
1003 |
$result .= $this->GetBoundary($this->boundary[1], '', '', '');
|
|
1004 |
$result .= $this->EncodeString($this->Body, $this->Encoding);
|
|
1005 |
$result .= $this->LE;
|
|
1006 |
$result .= $this->AttachAll();
|
|
1213 |
$body .= $this->GetBoundary($this->boundary[1], '', '', '');
|
|
1214 |
$body .= $this->EncodeString($this->Body, $this->Encoding);
|
|
1215 |
$body .= $this->LE;
|
|
1216 |
$body .= $this->AttachAll();
|
|
1007 | 1217 |
break; |
1008 | 1218 |
case 'alt_attachments': |
1009 |
$result .= sprintf("--%s%s", $this->boundary[1], $this->LE); |
|
1010 |
$result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE); |
|
1011 |
$result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body |
|
1012 |
$result .= $this->EncodeString($this->AltBody, $this->Encoding); |
|
1013 |
$result .= $this->LE.$this->LE; |
|
1014 |
$result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body |
|
1015 |
$result .= $this->EncodeString($this->Body, $this->Encoding); |
|
1016 |
$result .= $this->LE.$this->LE; |
|
1017 |
$result .= $this->EndBoundary($this->boundary[2]); |
|
1018 |
$result .= $this->AttachAll(); |
|
1219 |
$body .= sprintf("--%s%s", $this->boundary[1], $this->LE); |
|
1220 |
$body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE); |
|
1221 |
$body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body |
|
1222 |
$body .= $this->EncodeString($this->AltBody, $this->Encoding); |
|
1223 |
$body .= $this->LE.$this->LE; |
|
1224 |
$body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body |
|
1225 |
$body .= $this->EncodeString($this->Body, $this->Encoding); |
|
1226 |
$body .= $this->LE.$this->LE; |
|
1227 |
$body .= $this->EndBoundary($this->boundary[2]); |
|
1228 |
$body .= $this->AttachAll(); |
Also available in: Unified diff
update phpmailer to version 5.1