Compare commits

...

11 Commits

Author SHA1 Message Date
Anthony Bourguignon
dca1b7ff4c remove test mail address 2023-01-05 10:25:00 +01:00
Anthony Bourguignon
b8315263ec switch to phpmailer to send emails 2023-01-04 18:04:37 +01:00
770fd5e874 Merge pull request 's/m/p-c.md: Fix URL' (#25) from philippe.coval/SiteWebAstrolabe:sandbox/rzr/review/master into master
Reviewed-on: AstrolabeCAE/SiteWebAstrolabe#25
2022-12-22 11:53:42 +01:00
Philippe Coval
63d467a759 s/m/p-c.md: Fix URL
Signed-off-by: Philippe Coval <rzr@users.sf.net>
2022-12-21 14:26:14 +01:00
Philippe Coval
e91376c45c git: Ignore emacs backup files
Signed-off-by: Philippe Coval <rzr@users.sf.net>
2022-12-21 14:16:14 +01:00
fd013b6fa4 Merge pull request 'fix: typo' (#23) from vincent.genieux/SiteWebAstrolabe:master into master
Reviewed-on: AstrolabeCAE/SiteWebAstrolabe#23
2022-12-15 14:56:51 +01:00
b37970c683 fix: typo 2022-12-15 14:53:11 +01:00
9ac3a24840 Merge pull request 'monsuperarticle' (#22) from jacques-olivier.farcy/SiteWebAstrolabe:monsuperarticle into master
Reviewed-on: AstrolabeCAE/SiteWebAstrolabe#22
2022-12-15 13:06:17 +01:00
4eedd138c0 Transférer les fichiers vers 'src/images/posts' 2022-12-15 13:02:17 +01:00
7e96ee9d51 Mise à jour de 'src/posts/monsuperarticle.md' 2022-12-15 13:00:24 +01:00
7eb77bedff Ajout d'un article sur le site web
Journée digital Tech
2022-12-15 12:52:00 +01:00
6 changed files with 48 additions and 17 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
#.gitignore
*~
*.log
npm-debug.*
*.scssc

View File

@ -1,6 +1,12 @@
<?php
require("/usr/share/php/libphp-phpmailer/autoload.php");
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
$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'])) {
$errors .= "\n Error: all fields are required";
@ -8,7 +14,7 @@
if(!empty($_POST['name']) && !empty($_POST['email'])) {
$errors .= "\n Error: spam";
}
}
$name = $_POST['namezzz'];
$emailAddress = $_POST['emailzzz'];
@ -21,14 +27,6 @@
}
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;
$emailSubject = "[Formulaire Astrolabe] Nouveau message";
@ -49,15 +47,35 @@
$purpose = "Autre demande";
}
$messageWrap = wordwrap($message, 70, "\r\n", false);
$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);
// send the email
mail($to, $emailSubject, $emailBodyHTML, implode("\r\n", $headers));
$mail->isSMTP();
$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(!empty($subscribe)) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

View File

@ -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.
https://purl.org/rzr/
https://purl.org/rzr

View File

@ -1,7 +1,7 @@
---
title: Vincent porte les couleurs d'Astrolabe au 31e marathon de La Rochelle
date: '2022-11-29'
type: 'new'
type: 'news'
illustration: '/images/posts/marathon-lr-2022.jpg'
---

View 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.