Guest User

Untitled

a guest
Jul 8th, 2021
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.12 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace phpmailer\phpmailer;
  15.  
  16. class PHPMailer
  17. {
  18. const CHARSET_ASCII = 'us-ascii';
  19. const CHARSET_ISO88591 = 'iso-8859-1';
  20. const CHARSET_UTF8 = 'utf-8';
  21. const CONTENT_TYPE_PLAINTEXT = 'text/plain';
  22. const CONTENT_TYPE_TEXT_CALENDAR = 'text/calendar';
  23. const CONTENT_TYPE_TEXT_HTML = 'text/html';
  24. const CONTENT_TYPE_MULTIPART_ALTERNATIVE = 'multipart/alternative';
  25. const CONTENT_TYPE_MULTIPART_MIXED = 'multipart/mixed';
  26. const CONTENT_TYPE_MULTIPART_RELATED = 'multipart/related';
  27. const ENCODING_7BIT = '7bit';
  28. const ENCODING_8BIT = '8bit';
  29. const ENCODING_BASE64 = 'base64';
  30. const ENCODING_BINARY = 'binary';
  31. const ENCODING_QUOTED_PRINTABLE = 'quoted-printable';
  32. const ENCRYPTION_STARTTLS = 'tls';
  33. const ENCRYPTION_SMTPS = 'ssl';
  34. const ICAL_METHOD_REQUEST = 'REQUEST';
  35. const ICAL_METHOD_PUBLISH = 'PUBLISH';
  36. const ICAL_METHOD_REPLY = 'REPLY';
  37. const ICAL_METHOD_ADD = 'ADD';
  38. const ICAL_METHOD_CANCEL = 'CANCEL';
  39. const ICAL_METHOD_REFRESH = 'REFRESH';
  40. const ICAL_METHOD_COUNTER = 'COUNTER';
  41. const ICAL_METHOD_DECLINECOUNTER = 'DECLINECOUNTER';
  42. const VERSION = '6.1.5';
  43. const STOP_MESSAGE = 0;
  44. const STOP_CONTINUE = 1;
  45. const STOP_CRITICAL = 2;
  46. const CRLF = "\r\n";
  47. const FWS = ' ';
  48. const MAIL_MAX_LINE_LENGTH = 63;
  49. const MAX_LINE_LENGTH = 998;
  50. const STD_LINE_LENGTH = 76;
  51.  
  52. public $Priority;
  53. public $CharSet = \self::CHARSET_ISO88591;
  54. public $ContentType = \self::CONTENT_TYPE_PLAINTEXT;
  55. public $Encoding = \self::ENCODING_8BIT;
  56. public $ErrorInfo = '';
  57. public $From = 'root@localhost';
  58. public $FromName = 'Root User';
  59. public $Sender = '';
  60. public $Subject = '';
  61. public $Body = '';
  62. public $AltBody = '';
  63. public $Ical = '';
  64. static protected $IcalMethods = [self::ICAL_METHOD_REQUEST, self::ICAL_METHOD_PUBLISH, self::ICAL_METHOD_REPLY, self::ICAL_METHOD_ADD, self::ICAL_METHOD_CANCEL, self::ICAL_METHOD_REFRESH, self::ICAL_METHOD_COUNTER, self::ICAL_METHOD_DECLINECOUNTER];
  65. protected $MIMEBody = '';
  66. protected $MIMEHeader = '';
  67. protected $mailHeader = '';
  68. public $WordWrap = 0;
  69. public $Mailer = 'mail';
  70. public $Sendmail = '/usr/sbin/sendmail';
  71. public $UseSendmailOptions = true;
  72. public $ConfirmReadingTo = '';
  73. public $Hostname = '';
  74. public $MessageID = '';
  75. public $MessageDate = '';
  76. public $Host = 'localhost';
  77. public $Port = 25;
  78. public $Helo = '';
  79. public $SMTPSecure = '';
  80. public $SMTPAutoTLS = true;
  81. public $SMTPAuth = false;
  82. public $SMTPOptions = [];
  83. public $Username = '';
  84. public $Password = '';
  85. public $AuthType = '';
  86. protected $oauth;
  87. public $Timeout = 300;
  88. public $dsn = '';
  89. public $SMTPDebug = 0;
  90. public $Debugoutput = 'echo';
  91. public $SMTPKeepAlive = false;
  92. public $SingleTo = false;
  93. protected $SingleToArray = [];
  94. public $do_verp = false;
  95. public $AllowEmpty = false;
  96. public $DKIM_selector = '';
  97. public $DKIM_identity = '';
  98. public $DKIM_passphrase = '';
  99. public $DKIM_domain = '';
  100. public $DKIM_copyHeaderFields = true;
  101. public $DKIM_extraHeaders = [];
  102. public $DKIM_private = '';
  103. public $DKIM_private_string = '';
  104. public $action_function = '';
  105. public $XMailer = '';
  106. static public $validator = 'php';
  107. protected $smtp;
  108. protected $to = [];
  109. protected $cc = [];
  110. protected $bcc = [];
  111. protected $ReplyTo = [];
  112. protected $all_recipients = [];
  113. protected $RecipientsQueue = [];
  114. protected $ReplyToQueue = [];
  115. protected $attachment = [];
  116. protected $CustomHeader = [];
  117. protected $lastMessageID = '';
  118. protected $message_type = '';
  119. protected $boundary = [];
  120. protected $language = [];
  121. protected $error_count = 0;
  122. protected $sign_cert_file = '';
  123. protected $sign_key_file = '';
  124. protected $sign_extracerts_file = '';
  125. protected $sign_key_pass = '';
  126. protected $exceptions = false;
  127. protected $uniqueid = '';
  128. static protected $LE = \self::CRLF;
  129.  
  130. public function __construct($exceptions = NULL)
  131. {
  132. if (NULL !== $exceptions) {
  133. $this->exceptions = (bool) $exceptions;
  134. }
  135.  
  136. $this->Debugoutput = (strpos(PHP_SAPI, 'cli') !== false ? 'echo' : 'html');
  137. }
  138.  
  139. public function __destruct()
  140. {
  141. $this->smtpClose();
  142. }
  143.  
  144. private function mailPassthru($to, $subject, $body, $header, $params)
  145. {
  146. if (ini_get('mbstring.func_overload') & 1) {
  147. $subject = $this->secureHeader($subject);
  148. }
  149. else {
  150. $subject = $this->encodeHeader($this->secureHeader($subject));
  151. }
  152. if (!$this->UseSendmailOptions || (NULL === $params)) {
  153. $result = @mail($to, $subject, $body, $header);
  154. }
  155. else {
  156. $result = @mail($to, $subject, $body, $header, $params);
  157. }
  158.  
  159. return $result;
  160. }
  161.  
  162. protected function edebug($str)
  163. {
  164. if ($this->SMTPDebug <= 0) {
  165. return NULL;
  166. }
  167.  
  168. if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
  169. $this->Debugoutput->debug($str);
  170. return NULL;
  171. }
  172. if (is_callable($this->Debugoutput) && !in_array($this->Debugoutput, ['error_log', 'html', 'echo'])) {
  173. call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
  174. return NULL;
  175. }
  176.  
  177. switch ($this->Debugoutput) {
  178. case 'error_log':
  179. error_log($str);
  180. break;
  181. case 'html':
  182. echo htmlentities(preg_replace('/[\\r\\n]+/', '', $str), ENT_QUOTES, 'UTF-8');
  183. echo '<br>' . "\n";
  184. break;
  185. case 'echo':
  186. default:
  187. $str = preg_replace('/\\r\\n|\\r/m', "\n", $str);
  188. echo gmdate('Y-m-d H:i:s');
  189. echo "\t";
  190. echo trim(str_replace("\n", "\n" . ' ' . "\t" . ' ', trim($str)));
  191. echo "\n";
  192. }
  193. }
  194.  
  195. public function isHTML($isHtml = true)
  196. {
  197. if ($isHtml) {
  198. $this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
  199. }
  200. else {
  201. $this->ContentType = static::CONTENT_TYPE_PLAINTEXT;
  202. }
  203. }
  204.  
  205. public function isSMTP()
  206. {
  207. $this->Mailer = 'smtp';
  208. }
  209.  
  210. public function isMail()
  211. {
  212. $this->Mailer = 'mail';
  213. }
  214.  
  215. public function isSendmail()
  216. {
  217. $ini_sendmail_path = ini_get('sendmail_path');
  218.  
  219. if (false === stripos($ini_sendmail_path, 'sendmail')) {
  220. $this->Sendmail = '/usr/sbin/sendmail';
  221. }
  222. else {
  223. $this->Sendmail = $ini_sendmail_path;
  224. }
  225.  
  226. $this->Mailer = 'sendmail';
  227. }
  228.  
  229. public function isQmail()
  230. {
  231. $ini_sendmail_path = ini_get('sendmail_path');
  232.  
  233. if (false === stripos($ini_sendmail_path, 'qmail')) {
  234. $this->Sendmail = '/var/qmail/bin/qmail-inject';
  235. }
  236. else {
  237. $this->Sendmail = $ini_sendmail_path;
  238. }
  239.  
  240. $this->Mailer = 'qmail';
  241. }
  242.  
  243. public function addAddress($address, $name = '')
  244. {
  245. return $this->addOrEnqueueAnAddress('to', $address, $name);
  246. }
  247.  
  248. public function addCC($address, $name = '')
  249. {
  250. return $this->addOrEnqueueAnAddress('cc', $address, $name);
  251. }
  252.  
  253. public function addBCC($address, $name = '')
  254. {
  255. return $this->addOrEnqueueAnAddress('bcc', $address, $name);
  256. }
  257.  
  258. public function addReplyTo($address, $name = '')
  259. {
  260. return $this->addOrEnqueueAnAddress('Reply-To', $address, $name);
  261. }
  262.  
  263. protected function addOrEnqueueAnAddress($kind, $address, $name)
  264. {
  265. $address = trim($address);
  266. $name = trim(preg_replace('/[\\r\\n]+/', '', $name));
  267. $pos = strrpos($address, '@');
  268.  
  269. if (false === $pos) {
  270. $error_message = sprintf('%s (%s): %s', $this->lang('invalid_address'), $kind, $address);
  271. $this->setError($error_message);
  272. $this->edebug($error_message);
  273.  
  274. if ($this->exceptions) {
  275. throw new Exception($error_message);
  276. }
  277.  
  278. return false;
  279. }
  280.  
  281. $params = [$kind, $address, $name];
  282. if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) {
  283. if ('Reply-To' !== $kind) {
  284. if (!array_key_exists($address, $this->RecipientsQueue)) {
  285. $this->RecipientsQueue[$address] = $params;
  286. return true;
  287. }
  288. }
  289. else if (!array_key_exists($address, $this->ReplyToQueue)) {
  290. $this->ReplyToQueue[$address] = $params;
  291. return true;
  292. }
  293.  
  294. return false;
  295. }
  296.  
  297. return call_user_func_array([$this, 'addAnAddress'], $params);
  298. }
  299.  
  300. protected function addAnAddress($kind, $address, $name = '')
  301. {
  302. if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) {
  303. $error_message = sprintf('%s: %s', $this->lang('Invalid recipient kind'), $kind);
  304. $this->setError($error_message);
  305. $this->edebug($error_message);
  306.  
  307. if ($this->exceptions) {
  308. throw new Exception($error_message);
  309. }
  310.  
  311. return false;
  312. }
  313.  
  314. if (!static::validateAddress($address)) {
  315. $error_message = sprintf('%s (%s): %s', $this->lang('invalid_address'), $kind, $address);
  316. $this->setError($error_message);
  317. $this->edebug($error_message);
  318.  
  319. if ($this->exceptions) {
  320. throw new Exception($error_message);
  321. }
  322.  
  323. return false;
  324. }
  325.  
  326. if ('Reply-To' !== $kind) {
  327. if (!array_key_exists(strtolower($address), $this->all_recipients)) {
  328. $this->{$kind}[] = [$address, $name];
  329. $this->all_recipients[strtolower($address)] = true;
  330. return true;
  331. }
  332. }
  333. else if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
  334. ...........................................................................
  335. ................................................
  336. ...................
Add Comment
Please, Sign In to add comment