Version finale
This commit is contained in:
		@@ -20,7 +20,7 @@ if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['phone']) &&
 | 
			
		||||
        $mail->Host       = 'smtp.gmail.com';
 | 
			
		||||
        $mail->SMTPAuth   = true;
 | 
			
		||||
        $mail->Username   = 'neoeat.sav@gmail.com';
 | 
			
		||||
        $mail->Password   = 'zann afaj cnus tifc'; // Remplacez par le mot de passe de votre compte Gmail
 | 
			
		||||
        $mail->Password   = 'zann afaj cnus tifc'; 
 | 
			
		||||
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
 | 
			
		||||
        $mail->Port       = 465;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										42
									
								
								php/send_message_client.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								php/send_message_client.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
<?php
 | 
			
		||||
use PHPMailer\PHPMailer\PHPMailer;
 | 
			
		||||
use PHPMailer\PHPMailer\SMTP;
 | 
			
		||||
use PHPMailer\PHPMailer\Exception;
 | 
			
		||||
 | 
			
		||||
require 'phpmailer/Exception.php';
 | 
			
		||||
require 'phpmailer/PHPMailer.php';
 | 
			
		||||
require 'phpmailer/SMTP.php';
 | 
			
		||||
 | 
			
		||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
			
		||||
    $name = $_POST["name"];
 | 
			
		||||
    $email = $_POST["email"];
 | 
			
		||||
    $message = $_POST["message"];
 | 
			
		||||
    $mail = new PHPMailer(true);
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
        // Paramètres du serveur SMTP
 | 
			
		||||
        $mail->isSMTP();
 | 
			
		||||
        $mail->Host       = 'smtp.gmail.com';
 | 
			
		||||
        $mail->SMTPAuth   = true;
 | 
			
		||||
        $mail->Username   = 'neoeat.sav@gmail.com';
 | 
			
		||||
        $mail->Password   = 'zann afaj cnus tifc'; 
 | 
			
		||||
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
 | 
			
		||||
        $mail->Port       = 465;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $mail->setFrom($email, $name);
 | 
			
		||||
        $mail->addAddress('neoeat.sav@gmail.com', 'Neo Eat'); 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $mail->isHTML(false);
 | 
			
		||||
        $mail->Subject = 'Contact Form Submission';
 | 
			
		||||
        $mail->Body = "Name: $name\nEmail: $email\nMessage:\n$message";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $mail->send();
 | 
			
		||||
        header("Location: ../html/messageSucces.html");
 | 
			
		||||
    } catch (Exception $e) {
 | 
			
		||||
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user