Ejemplo n.º 1
0
 public function send($template, $data, $callback)
 {
     //Nova instanca Mailgun Messagebuildera koji sluzi za pravljenje emailova
     $builder = $this->mailer->MessageBuilder();
     //Kreiramo instancu Message k. da bi mogli poslati body od email,a arg. constuctora $builder,omogucava da se metode
     //iz Message k. izvrse. Message k. ne treba importovati zato sto se nalazi u istom folderu kao i Mailer k.
     $message = new Message($builder);
     //Nastimavamo od koga je poruka sa setFromAddress(),a iz konfiguracije dohvatamo email adresu od koga se salje poruka
     $message->from($this->config->get('mail.from'));
     //Dodajemo $data na view koji smo propustili kao param. u register.php ('email/auth/registered.php'),a to su korinsicki
     //podatci,tako da su ti korisnicki podatci dostupni i šerovani na views-u i da se mogu koristiti unutar Twiga
     $this->view->appendData($data);
     //Dodajemo tijelo email-a tj. poruku sa tekstom body,uz pomoc body() m. iz Message klase,u koji propustamo $template arg.
     //koji ce onda otici na register.php i preuzeti views ('email/auth/registered.php') i uz pomoc render() metoda poslati ga
     //kao tijelo emila
     $message->body($this->view->render($template));
     //Pozivamo callback funkciju sa register.php zajedno sa $message = new Message($this->mailer); da bi mogli koristiti
     //Message metode. callback func. uzima param. $message i onda prilikom svog izvrsavanje koristi to() i subject() m.
     call_user_func($callback, $message);
     //Dohvatamo domenu od Mailguna zato sto cemo slati POST request kroz Milgun API
     $domain = $this->config->get('mail.domain');
     //Slanje email poruke (getMessage() m. je iz Mailguna i sluzi sa dohvatanje email poruke,a post() sluzi sa slanje emaila)
     //"{$domain}/messages" se odnosi na nasu domenu na Mailgun st. i messages view tj. poruke na toj st.
     $this->mailer->post("{$domain}/messages", $builder->getMessage());
 }
Ejemplo n.º 2
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $message->body($this->load->view($template, $data, true));
     call_user_func($callback, $message);
     return $this->mailer->send();
 }
 public function notice($body, $data, $callback)
 {
     $message = new Message($this->email);
     $message->body($body);
     $message->from($this->from);
     call_user_func($callback, $message);
     $this->sendgrid->send($this->email);
 }
Ejemplo n.º 4
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     $this->mailer->send();
 }
Ejemplo n.º 5
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $this->mailer->From = "*****@*****.**";
     $this->mailer->FromName = "elePHPant";
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     $this->mailer->send();
 }
Ejemplo n.º 6
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $this->mailer->From = "*****@*****.**";
     $this->mailer->FromName = "No Reply";
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     $this->mailer->send();
 }
Ejemplo n.º 7
0
 public function send($template, $data, $callback)
 {
     $builder = $this->mailer->MessageBuilder();
     $message = new Message($builder);
     $message->from($this->config->get('mail.from'), $this->config->get('mail.from_name'));
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     $domain = $this->config->get('mail.domain');
     $this->mailer->post("{$domain}/messages", $builder->getMessage());
 }
Ejemplo n.º 8
0
 public function send($template, $data, $cb)
 {
     $message = new Message($this->mailer);
     $message->body($this->view->render($template, $data));
     call_user_func($cb, $message);
     if (!$this->mailer->send()) {
         die('Mailer Error: ' . $this->mailer->ErrorInfo);
     } else {
         echo "Success sending email";
     }
 }
Ejemplo n.º 9
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     // Remember to 'Allow less secure apps' in Google's security settings when testing
     if (!$this->mailer->send()) {
         echo "Mailer Error: " . $this->mailer->ErrorInfo;
         exit;
     }
 }
Ejemplo n.º 10
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     if (!$this->mailer->Send()) {
         return "Mailer Error: " . $mailer->ErrorInfo;
     } else {
         return "Message sent!";
     }
 }
Ejemplo n.º 11
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     $this->mailer->From = '*****@*****.**';
     //change
     $this->mailer->FromName = 'No Reply';
     //change
     $this->mailer->send();
 }
Ejemplo n.º 12
0
 public function send($template, $data, $callback)
 {
     $message = new Message($this->mailer);
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     try {
         $this->mailer->send();
     } catch (\Exception $e) {
         var_dump($e);
         die;
     }
 }
Ejemplo n.º 13
0
 public function send($template, $data, $callback)
 {
     $this->errors = null;
     $message = new Message($this->mailer);
     $this->view->appendData($data);
     $message->body($this->view->render($template));
     call_user_func($callback, $message);
     if (!$this->mailer->send()) {
         $this->errors = $this->mailer->ErrorInfo;
         return FALSE;
     } else {
         return TRUE;
     }
 }
Ejemplo n.º 14
0
 public function send($template, $data, $callback)
 {
     try {
         $message = new Message($this->mailer);
         $this->view->appendData($data);
         $message->body($this->view->render($template));
         call_user_func($callback, $message);
         $this->mailer->send();
     } catch (phpmailerException $e) {
         echo $e->errorMessage();
         //error messages from PHPMailer
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }