123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
-
-
- require 'C:\xampp\composer\vendor\autoload.php';
- if(isset($_POST['submit'])) {
- $name = $_POST['name'];
- $email = $_POST['email'];
- $phone = $_POST['phone'];
- $subject = $_POST['subject'];
- $message = $_POST['message'];
- $mail = new PHPMailer(true);
- $mail->SMTPDebug = 2; // Enable debugging
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'infoletlabo@gmail.com';
- $mail->Password = 'Garfield@13';
- $mail->SMTPSecure = 'tls'; // Enable SSL secure email
- $mail->Port = 587; // Port no may change
-
- //Recipients
- $mail->setFrom($email, $name); // User email
- $mail->addAddress('infoletlabo@gmail.com', 'Letlabo Nature Reserve'); // Your email
- $mail->addcc ($email);
- $mail->addReplyTo($email, $name); // Replay to User
- //Content
- $mail->isHTML(False);
- $mail->Subject = $subject;
- $mail->Body ='Equiry From: '.$name."\r\n".'Message: ' .$message."\r\n". 'Reply To: ' .$email."\r\n". 'Contact on: '.$phone;
- ;
-
-
-
- if($mail->send()) {
- echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
- }
- else
- {
- echo "<script type='text/javascript'>alert('failed!')</script>";
- }
- header('Location: contact.html');
- exit;
-
-
- }
- ?>
|