Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require(__DIR__.'/../../vendor/phpmailer/phpmailer/PHPMailerAutoload.php');
- function sendClient($body, $data){
- $template = Timber::compile($body, $data);
- sendMail($template, 'Inschrijving', $data['email'], 'info@school4us.nl');
- }
- function sendMail($template, $subject, $receiver, $sender){
- $mail = new PHPMailer; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP // TCP port to connect to
- $mail->Host = 'smtp.gmail.com';
- $mail->Port = 587;
- $mail->SMTPSecure = 'tls';
- $mail->SMTPAuth = true;
- $mail->Username = "testschool4us@gmail.com";
- $mail->Password = "school4ustest";
- $mail->setFrom($sender);
- $mail->addAddress($receiver); // Add a recipient
- $mail->addReplyTo($receiver);
- $mail->isHTML(true);
- $mail->Subject = $subject;
- $mail->Body = $template;
- $mail->AltBody = $template; //$mail->AltBody = $template; //
- if (!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement