feat/send-mail-to-member #81

Merged
florent.lesaout merged 10 commits from feat/send-mail-to-member into master 2024-03-20 14:04:39 +01:00
Showing only changes of commit 1dd30c2f75 - Show all commits

View File

@ -5,28 +5,28 @@ use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
$errors = '';
$myEmail = getenv('ASTRO_SMTP_FROM');
$errors = '';
$myEmail = getenv('ASTRO_SMTP_FROM');
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
$errors .= "\n Error: all fields are required";
}
}
if(!empty($_POST['name']) && !empty($_POST['email'])) {
if(!empty($_POST['name']) && !empty($_POST['email'])) {
$errors .= "\n Error: spam";
}
}
$name = $_POST['namezzz'];
$emailAddress = $_POST['emailzzz'];
$select = $_POST['select'];
$message = $_POST['message'];
$subscribe = $_POST['subscribe'];
$name = $_POST['namezzz'];
$emailAddress = $_POST['emailzzz'];
$select = $_POST['select'];
$message = $_POST['message'];
$subscribe = $_POST['subscribe'];
if (!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
if (!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
$errors .= "\n Error: Invalid email address $emailAddress";
}
}
if( empty($errors)) {
if(empty($errors)) {
$to = $myEmail;
$emailSubject = "[Formulaire Astrolabe] Nouveau message";
@ -85,7 +85,7 @@ $mail = new PHPMailer(true);
// redirect to the 'thank you' page
header("Location: /thank-you/index.html");
}
}
?>
<!DOCTYPE html>
<html>
@ -97,6 +97,6 @@ $mail = new PHPMailer(true);
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
?>
</body>
</html>