controllers/MessageController.php
#todo: Maybe one day pass this to his own file;
Maybe one day pass this to his own file.
Maybe one day pass this to his own file .
private  function sendMail($message){
    $response = '';
    $email = new \SendGrid\Mail\Mail();
    $email->setFrom("gelsonmoreno105@gmail.com","Transtec");
    $email->setSubject($message->title);
    $email->addTo($message->getContactUs()->email , $message->getContactUs()->name, [$message->getContactUs()->name => $message->getContactUs()->name]);
    $email->addSubstitution("subject", $message->title);
    $email->addSubstitution("content", $message->text);
    $email->setTemplateId("");
    $sendgrid = new \SendGrid("");
    try {
      $response = $sendgrid->send($email);
      echo $response->body();
    } catch (Exception $e) {
      echo 'Caught exception: '.  $e->getMessage(). "\n";
    }
  }
private function sendMail ( $ message ) { $ response = '' ; $ email = new \ SendGrid \ Mail \ Mail ( ) ; $ email -> setFrom ( " gelsonmoreno105@gmail.com " , " Transtec " ) ; $ email -> setSubject ( $ message -> title ) ; $ email -> addTo ( $ message -> getContactUs ( ) -> email , $ message -> getContactUs ( ) -> name , [ $ message -> getContactUs ( ) -> name => $ message -> getContactUs ( ) -> name ] ) ; $ email -> addSubstitution ( " subject " , $ message -> title ) ; $ email -> addSubstitution ( " content " , $ message -> text ) ; $ email -> setTemplateId ( " " ) ; $ sendgrid = new \ SendGrid ( " " ) ; try { $ response = $ sendgrid -> send ( $ email ) ; echo $ response -> body ( ) ; } catch ( Exception $ e ) { echo 'Caught exception: ' . $ e -> getMessage ( ) . " \n " ; } }
todo: Maybe one day pass this to his own file;
todo : Maybe one day pass this to his own file ;
#todo: Maybe one day pass this to a config file