Example #1
0
 static function send(array $from, array $to, $subject, $body, $contentType = 'text/html')
 {
     $gmail = Config::email();
     $transport = Swift_SmtpTransport::newInstance($gmail['GMAIL']['address'], $gmail['GMAIL']['port'], $gmail['GMAIL']['security'])->setUsername($gmail['GMAIL']['username'])->setPassword($gmail['GMAIL']['password']);
     $mailer = Swift_Mailer::newInstance($transport);
     $message = Swift_Message::newInstance($subject)->setFrom($from)->setTo($to)->setBody($body, $contentType);
     return $mailer->send($message);
 }
Example #2
0
 public function run()
 {
     // Binder do banco
     $this->db = new Database();
     global $db;
     $db = $this->db;
     $this->dbo = new DatabaseOld();
     global $dbo;
     $dbo = $this->dbo;
     // Binder dos configs
     $this->config = (object) array('db' => Config::db(), 'email' => Config::email());
     // Binder do request
     Request::build();
     // Binder do router
     $this->router = new Router();
 }
Example #3
0
 public function init()
 {
     $mailerPath = __ROOT__ . Config::config('core_dir') . '/plugins/PHPMailer/PHPMailerAutoload.php';
     include $mailerPath;
     $mail = new PHPMailer();
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = Config::email('server');
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = Config::email('username');
     // SMTP username
     $mail->Password = Config::email('password');
     // SMTP password
     //     $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
     $mail->Port = Config::email('port');
     // TCP port to connect to
     $mail->setFrom(Config::email('from'));
     //
     return $mail;
 }
Example #4
0
 public function sendPasswordResetEmail()
 {
     $template = EmailTemplate::passwordReset($this);
     $emailConf = Config::email();
     $params = ['type' => 'password_reset', 'senderName' => $emailConf['sender']['name'], 'senderEmail' => $emailConf['sender']['email'], 'receiverName' => $this->firstName . ' ' . $this->lastName, 'receiverEmail' => $this->email, 'cc' => NULL, 'bcc' => NULL, 'subject' => 'Password reset', 'body' => $template];
     return Emailer::queue($params);
 }