1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-26 06:37:38 +02:00

Début de gestion des mails et quelques modifications

This commit is contained in:
galaxyoyo
2019-09-07 16:37:00 +02:00
parent 7266fe8e24
commit e5e197dd38
11 changed files with 109 additions and 52 deletions

View File

@ -0,0 +1,30 @@
<?php
function sendMail($email, $subject, $content, $from = "contact")
{
global $MAIL_DOMAIN, $URL_BASE, $YEAR;
$content = preg_replace("#{URL_BASE}#", $URL_BASE, $content);
$content = preg_replace("#{YEAR}#", $YEAR, $content);
$headers = "From: " . $from . "@" . $MAIL_DOMAIN . "\r\n";
$headers .= "Reply-To: contact@" . $MAIL_DOMAIN . "\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
mail($email, $subject, $content, $headers);
}
/**
* @param NewUser
*/
function sendRegisterMail($new_user)
{
global $LOCAL_PATH, $YEAR;
$content = file_get_contents("$LOCAL_PATH/server_files/services/mail_templates/register.html");
$content = preg_replace("#{FIRST_NAME}#", $new_user->first_name, $content);
$content = preg_replace("#{SURNAME}#", $new_user->surname, $content);
$content = preg_replace("#{TOKEN}#", $new_user->confirm_email_token, $content);
sendMail($new_user->email, "Inscription au TFJM² $YEAR", $content);
}

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Inscription au TFJM² {YEAR}</title>
</head>
<body>
Bonjour {FIRST_NAME} {SURNAME},<br />
<br />
Vous venez de vous inscrire au TFJM<sup>2</sup> {YEAR} et nous vous en remercions.<br />
Pour valider votre adresse e-mail, veuillez cliquer sur le lien : <a href="{URL_BASE}/confirmer_mail/{TOKEN}">{URL_BASE}/confirmer_mail/{TOKEN}</a><br />
<br />
Le comité national d'organisation du TFJM<sup>2</sup>
</body>
</html>