- <?php 
- /* 
-  * Copyright (C) 2017 Karmabunny Pty Ltd. 
-  * 
-  * This file is a part of SproutCMS. 
-  * 
-  * SproutCMS is free software: you can redistribute it and/or modify it under the terms 
-  * of the GNU General Public License as published by the Free Software Foundation, either 
-  * version 2 of the License, or (at your option) any later version. 
-  * 
-  * For more information, visit <http://getsproutcms.com>. 
-  */ 
-   
- namespace Sprout\Helpers; 
-   
- use Kohana; 
- use PHPMailer\PHPMailer\PHPMailer; 
-   
- /** 
-  * Sends emails using HTML content generated by a View, wrapped in a standard template 
-  * 
-  * @example 
-  * $view = new View('modules/MyModule/welcome_email'); 
-  * $view->set(...); 
-  * 
-  * $mail = new Email(); 
-  * $mail->Subject = 'Talking about the things and stuff'; 
-  * $mail->addAddress('example@example.org', 'Elaine Exemplary'); 
-  * $mail->SkinnedHTML($view); 
-  * $mail->send(); 
-  */ 
- class Email extends PHPMailer 
- { 
-   
-     public function __construct() 
-     { 
-         parent::__construct(); 
-   
-         $this->From = Kohana::config('sprout.site_email'); 
-         $this->FromName = Kohana::config('sprout.site_title'); 
-   
-         $this->IsSMTP(); 
-         $this->Host = Kohana::config('sprout.smtp_server'); 
-         $this->Port = Kohana::config('sprout.smtp_port'); 
-         $this->SMTPSecure = (Kohana::config('sprout.smtp_secure') ? 'tls' : ''); 
-         $this->SMTPAutoTLS = Kohana::config('sprout.smtp_autotls'); 
-         $this->SMTPAuth = Kohana::config('sprout.smtp_auth'); 
-         $this->Username = Kohana::config('sprout.smtp_username'); 
-         $this->Password = Kohana::config('sprout.smtp_password'); 
-   
-         $this->AllowedDomains = Kohana::config('sprout.email_allowed_domains'); 
-   
-         // Bypass failed cert verification to use TLS 
-         if (!IN_PRODUCTION) { 
-             $this->SMTPOptions['ssl']['verify_peer'] = false; 
-             $this->SMTPOptions['ssl']['verify_peer_name'] = false; 
-         } 
-   
-         // Other SMTP options: 
-         // $this->SMTPSecure = '', 'ssl', 'tls' 
-         // $this->Port = ? 
-         // $this->SMTPDebug = true | false 
-         // $this->Timeout = ? 
-   
-         // Other transports 
-         // $this->IsMail() 
-         // $this->IsSendmail() 
-         // $this->IsQmail() 
-     } 
-   
-   
-     /** 
-     * Sets the message content to be the specified content, with the email skin around it 
-     * Content can either be a HTML string or a View. 
-     * 
-     * @param $content string|View The content for the email. 
-     *        In the outer view becomes the parameter $content. 
-     * @param $extraparams array Optional extra parameters to set for the outer view. 
-     * @param $template string The template to use for the outer view. The default is "skin/email". 
-     **/ 
-     public function SkinnedHTML($content, $extraparams = null, $template = 'skin/email') 
-     { 
-         $view = new View($template); 
-         $view->content = $content; 
-   
-         if (!empty($this->Subject)) { 
-             $view->html_title = $this->Subject; 
-         } else { 
-             $view->html_title = Kohana::config('sprout.site_title'); 
-         } 
-   
-             foreach ($extraparams as $k => $v) { 
-                 $view->set($k, $v); 
-             } 
-         } 
-   
-         $html = $view->render(); 
-   
-   
-         $this->MsgHTML($html, DOCROOT); 
-     } 
-   
- } 
-   
-   
-