Compare commits
11 Commits
quentin-du
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
dca1b7ff4c | ||
|
b8315263ec | ||
770fd5e874 | |||
|
63d467a759 | ||
|
e91376c45c | ||
fd013b6fa4 | |||
b37970c683 | |||
9ac3a24840 | |||
4eedd138c0 | |||
7e96ee9d51 | |||
7eb77bedff |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
#.gitignore
|
||||||
|
*~
|
||||||
*.log
|
*.log
|
||||||
npm-debug.*
|
npm-debug.*
|
||||||
*.scssc
|
*.scssc
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require("/usr/share/php/libphp-phpmailer/autoload.php");
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
$errors = '';
|
$errors = '';
|
||||||
$myEmail = 'contact-form@astrolabe.coop'; // email address to send form content
|
$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";
|
$errors .= "\n Error: all fields are required";
|
||||||
@ -8,7 +14,7 @@
|
|||||||
|
|
||||||
if(!empty($_POST['name']) && !empty($_POST['email'])) {
|
if(!empty($_POST['name']) && !empty($_POST['email'])) {
|
||||||
$errors .= "\n Error: spam";
|
$errors .= "\n Error: spam";
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $_POST['namezzz'];
|
$name = $_POST['namezzz'];
|
||||||
$emailAddress = $_POST['emailzzz'];
|
$emailAddress = $_POST['emailzzz'];
|
||||||
@ -21,14 +27,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( empty($errors)) {
|
if( empty($errors)) {
|
||||||
$headers = array(
|
|
||||||
"From: " .$myEmail,
|
|
||||||
"Reply-To: " .$emailAddress,
|
|
||||||
"MIME-Version: 1.0",
|
|
||||||
"Content-Type: text/html;charset=UTF-8",
|
|
||||||
"Content-Transfer-Encoding:8bit"
|
|
||||||
);
|
|
||||||
|
|
||||||
$to = $myEmail;
|
$to = $myEmail;
|
||||||
$emailSubject = "[Formulaire Astrolabe] Nouveau message";
|
$emailSubject = "[Formulaire Astrolabe] Nouveau message";
|
||||||
|
|
||||||
@ -49,15 +47,35 @@
|
|||||||
$purpose = "Autre demande";
|
$purpose = "Autre demande";
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageWrap = wordwrap($message, 70, "\r\n", false);
|
|
||||||
|
|
||||||
$emailBody = "Vous avez reçu un nouveau message depuis le formulaire du site Astrolabe :".
|
$emailBody = "Vous avez reçu un nouveau message depuis le formulaire du site Astrolabe :".
|
||||||
"\r\n\r\nNom: $name \r\nEmail: $emailAddress \r\nRaison: $purpose\r\nSubscribe: $subscribe\r\n\r\n$messageWrap";
|
"\r\n\r\nNom: $name \r\nEmail: $emailAddress \r\nRaison: $purpose\r\nSubscribe: $subscribe\r\n\r\n$message";
|
||||||
|
|
||||||
$emailBodyHTML = str_replace("\r\n", "<br>", $emailBody);
|
$emailBodyHTML = str_replace("\r\n", "<br>", $emailBody);
|
||||||
|
|
||||||
// send the email
|
$mail->isSMTP();
|
||||||
mail($to, $emailSubject, $emailBodyHTML, implode("\r\n", $headers));
|
$mail->Host = getenv('ASTRO_SMTP_HOSTNAME');
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = getenv('ASTRO_SMTP_USERNAME');
|
||||||
|
$mail->Password = getenv('ASTRO_SMTP_PASSWORD');
|
||||||
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||||
|
$mail->Port = 587;
|
||||||
|
|
||||||
|
//Options
|
||||||
|
$mail->CharSet = 'UTF-8';
|
||||||
|
$mail->WordWrap = 70;
|
||||||
|
|
||||||
|
//Recipients
|
||||||
|
$mail->setFrom($myEmail);
|
||||||
|
$mail->addAddress($myEmail);
|
||||||
|
$mail->addReplyTo($emailAddress, $name);
|
||||||
|
|
||||||
|
// Content
|
||||||
|
$mail->isHTML(true);
|
||||||
|
$mail->Subject = $emailSubject;
|
||||||
|
$mail->Body = $emailBodyHTML;
|
||||||
|
$mail->AltBody = $emailBody;
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
|
||||||
// if subscribe add to mailing list
|
// if subscribe add to mailing list
|
||||||
if(!empty($subscribe)) {
|
if(!empty($subscribe)) {
|
||||||
|
BIN
src/images/posts/image-de-mon-article.png
Normal file
BIN
src/images/posts/image-de-mon-article.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 KiB |
@ -21,5 +21,5 @@ Son focus actuel est sur les systèmes IoT et communautés associées.
|
|||||||
|
|
||||||
N'hésitez pas à le contacter si vous souhaitez partager à propos de projets open-sources ou open hardware.
|
N'hésitez pas à le contacter si vous souhaitez partager à propos de projets open-sources ou open hardware.
|
||||||
|
|
||||||
https://purl.org/rzr/
|
https://purl.org/rzr
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Vincent porte les couleurs d'Astrolabe au 31e marathon de La Rochelle
|
title: Vincent porte les couleurs d'Astrolabe au 31e marathon de La Rochelle
|
||||||
date: '2022-11-29'
|
date: '2022-11-29'
|
||||||
type: 'new'
|
type: 'news'
|
||||||
illustration: '/images/posts/marathon-lr-2022.jpg'
|
illustration: '/images/posts/marathon-lr-2022.jpg'
|
||||||
---
|
---
|
||||||
|
|
||||||
|
11
src/posts/monsuperarticle.md
Normal file
11
src/posts/monsuperarticle.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: Titre de mon super article
|
||||||
|
date: '2022-12-25'
|
||||||
|
type: 'news'
|
||||||
|
illustration: '/images/posts/image-de-mon-article.png'
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mon super article
|
||||||
|
|
||||||
|
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user