PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/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. * //License information must not be removed.
  4. *
  5. * PHP version 5.4x
  6. *
  7. * @Category ### Gripsell ###
  8. * @Package ### Advanced ###
  9. * @Architecture ### Secured ###
  10. * @Copyright (c) 2013 {@URL http://www.gripsell.com Gripsell eApps & Technologies Private Limited}
  11. * @License EULA License http://www.gripsell.com
  12. * @Author $Author: gripsell $
  13. * @Version $Version: 5.3.3 $
  14. * @Last Revision $Date: 2013-21-05 00:00:00 +0530 (Tue, 21 May 2013) $
  15. */
  16. function mail_custom($emails = array(), $subject, $message)
  17. {
  18. global $INI;
  19. include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
  20. settype($emails, 'array');
  21. $options = array(
  22. 'contentType' => 'text/html',
  23. 'encoding' => 'UTF-8',
  24. );
  25. $from = $INI['mail']['from'];
  26. $to = $INI['mail']['from']; //array_shift($emails);
  27. if ($INI['mail']['mail'] == 'mail') {
  28. Mailer::SendMail($from, $to, $subject, $message, $options, $emails);
  29. } else {
  30. Mailer::SmtpMail($from, $to, $subject, $message, $options, $emails);
  31. }
  32. }
  33. function gift_coupon($deals, $coupon, $user, $order, $userExist)
  34. {
  35. global $INI;
  36. $vars = array(
  37. 'deals' => $deals,
  38. 'coupon' => $coupon,
  39. 'user' => $user,
  40. 'order' => $order,
  41. 'userExist' => $userExist,
  42. );
  43. $message = render('mail_gift', $vars);
  44. // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
  45. $options = array(
  46. 'contentType' => 'text/html',
  47. 'encoding' => 'UTF-8',
  48. );
  49. $from = $INI['mail']['from'];
  50. $to = $order['giftemail'];
  51. $subject = $INI['system']['sitename'] . ': You have received a gift from ' . $user['realname'] . '(' . $user['email'] . ')';
  52. if ($INI['mail']['mail'] == 'mail') {
  53. Mailer::SendMail($from, $to, $subject, $message, $options);
  54. } else {
  55. Mailer::SmtpMail($from, $to, $subject, $message, $options);
  56. }
  57. $message = render('mail_gift_delivered', $vars);
  58. // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
  59. $options = array(
  60. 'contentType' => 'text/html',
  61. 'encoding' => 'UTF-8',
  62. );
  63. $from = $INI['mail']['from'];
  64. $to = $user['email'];
  65. $subject = $INI['system']['sitename'] . ': Your gift has been delivered';
  66. if ($INI['mail']['mail'] == 'mail') {
  67. Mailer::SendMail($from, $to, $subject, $message, $options);
  68. } else {
  69. Mailer::SmtpMail($from, $to, $subject, $message, $options);
  70. }
  71. }
  72. function mail_coupon($deals, $coupon, $user)
  73. {
  74. global $INI;
  75. $vars = array(
  76. 'deals' => $deals,
  77. 'coupon' => $coupon,
  78. 'user' => $user,
  79. );
  80. $message = render('mail_coupon', $vars);
  81. // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
  82. $options = array(
  83. 'contentType' => 'text/html',
  84. 'encoding' => 'UTF-8',
  85. );
  86. $from = $INI['mail']['from'];
  87. $to = $user['email'];
  88. $subject = $INI['system']['sitename'] . ' Notification: Congratulations! Your coupon is now valid.';
  89. if ($INI['mail']['mail'] == 'mail') {
  90. Mailer::SendMail($from, $to, $subject, $message, $options);
  91. } else {
  92. Mailer::SmtpMail($from, $to, $subject, $message, $options);
  93. }
  94. }
  95. function mail_purchase($deals, $user)
  96. {
  97. global $INI;
  98. $vars = array(
  99. 'deals' => $deals,
  100. 'user' => $user,
  101. );
  102. $message = render('mail_purchase', $vars);
  103. // $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
  104. $options = array(
  105. 'contentType' => 'text/html',
  106. 'encoding' => 'UTF-8',
  107. );
  108. $from = $INI['mail']['from'];
  109. $to = $user['email'];
  110. $subject = 'Purchase Confirmation';
  111. if ($INI['mail']['mail'] == 'mail') {
  112. Mailer::SendMail($from, $to, $subject, $message, $options);
  113. } else {
  114. Mailer::SmtpMail($from, $to, $subject, $message, $options);
  115. }
  116. }
  117. function mail_sign($user)
  118. {
  119. global $INI;
  120. include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
  121. if (empty($user)) return true;
  122. $from = $INI['mail']['from'];
  123. $to = $user['email'];
  124. $vars = array('user' => $user,);
  125. $message = render('mail_sign_verify', $vars);
  126. $subject = $INI['system']['sitename'] . ' account verification';
  127. $options = array(
  128. 'contentType' => 'text/html',
  129. 'encoding' => 'utf-8',
  130. );
  131. if ($INI['mail']['mail'] == 'mail') {
  132. Mailer::SendMail($from, $to, $subject, $message, $options);
  133. } else {
  134. Mailer::SmtpMail($from, $to, $subject, $message, $options);
  135. }
  136. }
  137. function mail_sign_id($id)
  138. {
  139. $user = Table::Fetch('user', $id);
  140. mail_sign($user);
  141. }
  142. function mail_sign_email($email)
  143. {
  144. $user = Table::Fetch('user', $email, 'email');
  145. mail_sign($user);
  146. }
  147. function mail_repass($user)
  148. {
  149. global $INI;
  150. include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
  151. if (empty($user)) return true;
  152. $from = $INI['mail']['from'];
  153. $to = $user['email'];
  154. $vars = array('user' => $user,);
  155. $message = render('mail_repass', $vars);
  156. $subject = $INI['system']['sitename'] . ' password reset';
  157. $options = array(
  158. 'contentType' => 'text/html',
  159. 'encoding' => 'utf-8',
  160. );
  161. if ($INI['mail']['mail'] == 'mail') {
  162. Mailer::SendMail($from, $to, $subject, $message, $options);
  163. } else {
  164. Mailer::SmtpMail($from, $to, $subject, $message, $options);
  165. }
  166. }
  167. function mail_subscribe($city, $deals, $partner, $subscribe)
  168. {
  169. global $INI;
  170. include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lang/email_subject.php');
  171. $week = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
  172. $today = date('m.d.Y') . $week[date('w')];
  173. $vars = array(
  174. 'today' => $today,
  175. 'deals' => $deals,
  176. 'city' => $city,
  177. 'subscribe' => $subscribe,
  178. 'partner' => $partner,
  179. 'fn_email' => $INI['subscribe']['helpemail'],
  180. 'fn_mobile' => $INI['subscribe']['helpphone'],
  181. 'notice_email' => $INI['mail']['reply'],
  182. );
  183. $message = render('mail_subscribe_deals', $vars);
  184. $message = mb_convert_encoding($message, 'UTF-8', 'UTF-8');
  185. $options = array(
  186. 'contentType' => 'text/html',
  187. 'encoding' => 'UTF-8',
  188. );
  189. $from = $INI['mail']['from'];
  190. $to = $subscribe['email'];
  191. $subject = $INI['system']['sitename'] . " Today's Deal: {$deals['title']}";
  192. if ($INI['mail']['mail'] == 'mail') {
  193. Mailer::SendMail($from, $to, $subject, $message, $options);
  194. } else {
  195. Mailer::SmtpMail($from, $to, $subject, $message, $options);
  196. }
  197. }