private function mailer($name, $email, $message) { $optionManager = new \Manager\OptionsManager(); $mailrecipe = $optionManager->getMail(); $mail = new \PHPMailer(); // $email and $message are the data that is being // posted to this page from our html contact form //$email = '' ; $completeMessage = 'Vous avez recu un mail de ' . $email; //$mail->SMTPDebug = 2; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom($email); // below we want to set the email address we will be sending our email to. $mail->AddAddress($mailrecipe); $mail->addReplyTo(''); $mail->addCC(''); $mail->addBCC(''); $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Message recu depuis votre site OVE.'; $mail->Body = $message . "<br><br>" . $completeMessage; $mail->AltBody = $message; if (!$mail->send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; $this->redirectToRoute('onepage'); }