PageRenderTime 99ms CodeModel.GetById 37ms app.highlight 34ms RepoModel.GetById 13ms app.codeStats 1ms

/New Folder/functions/include/modules/mailer.php

https://github.com/bigbanton/Monline
PHP | 428 lines | 188 code | 222 blank | 18 comment | 23 complexity | f457c90846b7c9226b1a4ccd7b758190 MD5 | raw file
  1<?php
  2
  3/**
  4 * //License information must not be removed.
  5 * 
  6 * PHP version 5.4x
  7 * 
  8 * @Category ### Gripsell ###
  9 * @Package ### Advanced ###
 10 * @Architecture ### Secured  ###
 11 * @Copyright (c) 2013 {@URL http://www.gripsell.com Gripsell eApps & Technologies Private Limited}
 12 * @License EULA License http://www.gripsell.com
 13 * @Author $Author: gripsell $
 14 * @Version $Version: 5.3.3 $
 15 * @Last Revision $Date: 2013-21-05 00:00:00 +0530 (Tue, 21 May 2013) $
 16 */
 17
 18function mail_custom($emails = array(), $subject, $message)
 19{
 20    
 21     global $INI;
 22    
 23    
 24    
 25     include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
 26    
 27     settype($emails, 'array');
 28    
 29    
 30    
 31     $options = array(
 32        
 33        'contentType' => 'text/html',
 34        
 35         'encoding' => 'UTF-8',
 36        
 37        );
 38    
 39    
 40    
 41     $from = $INI['mail']['from'];
 42    
 43     $to = $INI['mail']['from']; //array_shift($emails);
 44    
 45    
 46     if ($INI['mail']['mail'] == 'mail') {
 47        
 48        Mailer::SendMail($from, $to, $subject, $message, $options, $emails);
 49        
 50         } else {
 51        
 52        Mailer::SmtpMail($from, $to, $subject, $message, $options, $emails);
 53        
 54         } 
 55    
 56    } 
 57
 58function gift_coupon($deals, $coupon, $user, $order, $userExist)
 59{
 60    
 61     global $INI;
 62    
 63    
 64    
 65     $vars = array(
 66        
 67        'deals' => $deals,
 68        
 69         'coupon' => $coupon,
 70        
 71         'user' => $user,
 72        
 73         'order' => $order,
 74        
 75         'userExist' => $userExist,
 76        
 77        );
 78    
 79     $message = render('mail_gift', $vars);
 80    
 81     // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
 82    $options = array(
 83        
 84        'contentType' => 'text/html',
 85        
 86         'encoding' => 'UTF-8',
 87        
 88        );
 89    
 90    
 91    
 92     $from = $INI['mail']['from'];
 93    
 94     $to = $order['giftemail'];
 95    
 96     $subject = $INI['system']['sitename'] . ': You have received a gift from ' . $user['realname'] . '(' . $user['email'] . ')';
 97    
 98    
 99    
100    
101    
102     if ($INI['mail']['mail'] == 'mail') {
103        
104        Mailer::SendMail($from, $to, $subject, $message, $options);
105        
106         } else {
107        
108        Mailer::SmtpMail($from, $to, $subject, $message, $options);
109        
110         } 
111    
112    
113    
114    
115    
116    $message = render('mail_gift_delivered', $vars);
117    
118     // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
119    $options = array(
120        
121        'contentType' => 'text/html',
122        
123         'encoding' => 'UTF-8',
124        
125        );
126    
127    
128    
129     $from = $INI['mail']['from'];
130    
131     $to = $user['email'];
132    
133     $subject = $INI['system']['sitename'] . ': Your gift has been delivered';
134    
135    
136    
137    
138    
139     if ($INI['mail']['mail'] == 'mail') {
140        
141        Mailer::SendMail($from, $to, $subject, $message, $options);
142        
143         } else {
144        
145        Mailer::SmtpMail($from, $to, $subject, $message, $options);
146        
147         } 
148    
149    
150    
151    } 
152
153function mail_coupon($deals, $coupon, $user)
154{
155    
156     global $INI;
157    
158    
159    
160     $vars = array(
161        
162        'deals' => $deals,
163        
164         'coupon' => $coupon,
165        
166         'user' => $user,
167        
168        );
169    
170     $message = render('mail_coupon', $vars);
171    
172     // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
173    $options = array(
174        
175        'contentType' => 'text/html',
176        
177         'encoding' => 'UTF-8',
178        
179        );
180    
181    
182    
183     $from = $INI['mail']['from'];
184    
185     $to = $user['email'];
186    
187     $subject = $INI['system']['sitename'] . ' Notification: Congratulations! Your coupon is now valid.';
188    
189    
190    
191    
192    
193     if ($INI['mail']['mail'] == 'mail') {
194        
195        Mailer::SendMail($from, $to, $subject, $message, $options);
196        
197         } else {
198        
199        Mailer::SmtpMail($from, $to, $subject, $message, $options);
200        
201         } 
202    
203    } 
204
205function mail_purchase($deals, $user)
206{
207    
208     global $INI;
209    
210    
211    
212     $vars = array(
213        
214        'deals' => $deals,
215        
216         'user' => $user,
217        
218        );
219    
220     $message = render('mail_purchase', $vars);
221    
222     // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
223    $options = array(
224        
225        'contentType' => 'text/html',
226        
227         'encoding' => 'UTF-8',
228        
229        );
230    
231    
232    
233     $from = $INI['mail']['from'];
234    
235     $to = $user['email'];
236    
237     $subject = 'Purchase Confirmation';
238    
239    
240    
241    
242    
243     if ($INI['mail']['mail'] == 'mail') {
244        
245        Mailer::SendMail($from, $to, $subject, $message, $options);
246        
247         } else {
248        
249        Mailer::SmtpMail($from, $to, $subject, $message, $options);
250        
251         } 
252    
253    } 
254
255function mail_sign($user)
256{
257    
258     global $INI;
259    
260    
261    
262     include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
263    
264     if (empty($user)) return true;
265    
266     $from = $INI['mail']['from'];
267    
268     $to = $user['email'];
269    
270    
271    
272     $vars = array('user' => $user,);
273    
274     $message = render('mail_sign_verify', $vars);
275    
276     $subject = $INI['system']['sitename'] . ' account verification';
277    
278    
279    
280     $options = array(
281        
282        'contentType' => 'text/html',
283        
284         'encoding' => 'utf-8',
285        
286        );
287    
288     if ($INI['mail']['mail'] == 'mail') {
289        
290        Mailer::SendMail($from, $to, $subject, $message, $options);
291        
292         } else {
293        
294        Mailer::SmtpMail($from, $to, $subject, $message, $options);
295        
296         } 
297    
298    } 
299
300function mail_sign_id($id)
301{
302    
303     $user = Table::Fetch('user', $id);
304    
305     mail_sign($user);
306    
307    } 
308
309function mail_sign_email($email)
310{
311    
312     $user = Table::Fetch('user', $email, 'email');
313    
314     mail_sign($user);
315    
316    } 
317
318function mail_repass($user)
319{
320    
321     global $INI;
322    
323    
324    
325     include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
326    
327     if (empty($user)) return true;
328    
329     $from = $INI['mail']['from'];
330    
331     $to = $user['email'];
332    
333    
334    
335     $vars = array('user' => $user,);
336    
337     $message = render('mail_repass', $vars);
338    
339     $subject = $INI['system']['sitename'] . ' password reset';
340    
341    
342    
343     $options = array(
344        
345        'contentType' => 'text/html',
346        
347         'encoding' => 'utf-8',
348        
349        );
350    
351     if ($INI['mail']['mail'] == 'mail') {
352        
353        Mailer::SendMail($from, $to, $subject, $message, $options);
354        
355         } else {
356        
357        Mailer::SmtpMail($from, $to, $subject, $message, $options);
358        
359         } 
360    
361    } 
362
363function mail_subscribe($city, $deals, $partner, $subscribe)
364
365{
366    
367     global $INI;
368    
369    
370    
371     include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
372    
373     $week = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
374    
375     $today = date('m.d.Y') . $week[date('w')];
376    
377     $vars = array(
378        
379        'today' => $today,
380        
381         'deals' => $deals,
382        
383         'city' => $city,
384        
385         'subscribe' => $subscribe,
386        
387         'partner' => $partner,
388        
389         'fn_email' => $INI['subscribe']['helpemail'],
390        
391         'fn_mobile' => $INI['subscribe']['helpphone'],
392        
393         'notice_email' => $INI['mail']['reply'],
394        
395        );
396    
397     $message = render('mail_subscribe_deals', $vars);
398    
399     $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
400    
401     $options = array(
402        
403        'contentType' => 'text/html',
404        
405         'encoding' => 'UTF-8',
406        
407        );
408    
409     $from = $INI['mail']['from'];
410    
411     $to = $subscribe['email'];
412    
413     $subject = $INI['system']['sitename'] . " Today's Deal: {$deals['title']}";
414    
415    
416    
417     if ($INI['mail']['mail'] == 'mail') {
418        
419        Mailer::SendMail($from, $to, $subject, $message, $options);
420        
421         } else {
422        
423        Mailer::SmtpMail($from, $to, $subject, $message, $options);
424        
425         } 
426    
427    } 
428