Example #1
0
 public function initialize($view, $records)
 {
     # - we require our mail to auto-set the configurations
     # in the functions, so we need to call the possible
     # functions that doesn't require human calls
     $functions = ['host', 'port', 'username', 'password', 'encryption'];
     foreach ($functions as $function) {
         # - if the provided config is empty, turn next loop
         if (empty($this->config->{$function})) {
             continue;
         }
         # - now call the functions
         $this->adapter->{$function}($this->config->{$function});
     }
     # - render the view as partial
     $body = View::take($view, $records);
     # - we need to insert the global mailer 'from'
     # and insert the body
     $this->adapter->from(config()->app->mailer->from)->body($body);
     # - now return the adapter, so that they could still pre-modify
     # the function values
     return $this->adapter;
 }