Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!$lastnameErr && !$firstnameErr && !$emailErr)
- {
- // Set time zone
- date_default_timezone_set('Etc/UTC');
- // Require PHPMailer
- require_once('phpmailer.php');
- // GET posted fields
- $lastname = $_POST['contact']['lastname'];
- $firstname = $_POST['contact']['firstname'];
- $email = $_POST['contact']['email'];
- $phone = $_POST['contact']['phone'];
- $message = $_POST['contact']['message'];
- $subject = "Email de contact Peregrina fr";
- $body = "De: " . ucfirst($lastname) . " " . ucfirst($firstname) . "\nE-mail: " . $email . "\nTel: " . $phone . "\n\nMessage:\n" . $message;
- $mail = new PHPMailer();
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->Port = 587; // TCP port to connect to
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'peregrinamailsite@gmail.com'; // SMTP username
- $mail->Password = 'powerball'; // SMTP password
- $mail->setFrom('contact@site-peregrina.fr', 'Contact Peregrina');
- $mail->addAddress('xl@xavierleonard.fr');
- $mail->addBCC('xl@peregrina.fr');
- $mail->addBCC('natsensxl@gmail.com');
- $mail->addBCC('yves@yateo.com');
- $mail->Subject = $subject;
- $mail->Body = $body;
- if(!$mail->send()) {
- $mailSent = false;
- } else {
- $mailSent = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement