Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function send_contact_mail($data)
- {
- $data = array(
- 'firstName' => $data['firstName'],
- 'lastName' => $data['lastName'],
- 'callName' => $data['callName'],
- 'email' => $data['email'],
- 'comment' => $data['comment'],
- );
- $template = Timber::compile('templates/mail/contact_mail.twig', $data);
- $mail = new PHPMailer; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- //TODO change smtp server
- // $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
- // $mail->SMTPAuth = true; // Enable SMTP authentication
- // $mail->Username = 'user@example.com'; // SMTP username
- // $mail->Password = 'secret'; // SMTP password
- // $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- // $mail->Port = 587; // 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($data['email'], $data['firstName'] .' '. $data['lastName']);
- $mail->addAddress('janmoes96@live.nl', 'School4us'); // Add a recipient
- // $mail->addAddress('janmoes96@live.nl', 'School4us'); // Add a recipient
- $mail->addReplyTo($data['email'], 'Contact');
- // $mail->addCC('cc@example.com');
- // $mail->addBCC('bcc@example.com');
- // $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
- // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'Contact aanvraag';
- $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