Advertisement
Guest User

Untitled

a guest
Sep 6th, 2017
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php
  2.  
  3. require(__DIR__.'/../../vendor/phpmailer/phpmailer/PHPMailerAutoload.php');
  4.  
  5. function sendClient($body, $data){
  6.     $template = Timber::compile($body, $data);
  7.     sendMail($template, 'Kopie inschrijving', $data['email'], 'info@school4us.nl');
  8. }
  9.  
  10. function sendCompany($body, $data){
  11.     $template = Timber::compile($body, $data);
  12.     sendMail($template, 'Inschrijving', 'info@school4us.nl', $data['email']);
  13. }
  14.  
  15. function sendMail($template, $subject, $receiver, $sender){
  16.  
  17.     $mail = new PHPMailer;                        // Enable verbose debug output
  18.  
  19.     $mail->isSMTP();                                      // Set mailer to use SMTP     // TCP port to connect to
  20.  
  21.     $mail->Host = 'smtp.gmail.com';
  22.     $mail->Port = 587;
  23.     $mail->SMTPSecure = 'tls';
  24.     $mail->SMTPAuth = true;
  25.     $mail->Username = "testschool4us@gmail.com";
  26.     $mail->Password = "school4ustest";
  27.  
  28.     $mail->setFrom($sender);
  29.     $mail->addAddress($receiver);     // Add a recipient
  30.     $mail->addReplyTo($receiver);
  31.  
  32.     $mail->isHTML(true);
  33.  
  34.     $mail->Subject = $subject;
  35.     $mail->Body = $template;
  36.     $mail->AltBody = $template; //$mail->AltBody = $template; //
  37.  
  38.     return $mail->send();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement