58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
|
require_once __DIR__ . '../../vendor/autoload.php';
|
|
Dotenv\Dotenv::createImmutable(__DIR__ . '../../')->load();
|
|
|
|
// Custom Dotenv Boolean Support
|
|
if (! function_exists('evalBool')) {
|
|
function evalBool($value)
|
|
{
|
|
return (strcasecmp($value, 'true') ? false : true);
|
|
}
|
|
}
|
|
|
|
require_once("inc/PHPMailer.php");
|
|
require_once("inc/SMTP.php");
|
|
require_once("inc/Exception.php");
|
|
|
|
define('ENV', getenv('ENVIRONMENT'));
|
|
|
|
$host = getenv('DB_HOST');
|
|
$db = getenv('DB_NAME');
|
|
$username = getenv('DB_USER');
|
|
$pwd = getenv('DB_PASSWORD');
|
|
|
|
$charte_POST_ID = 1946;
|
|
$charte_TABLE = "wp01_posts";
|
|
|
|
$db = new \PDO("mysql:host=$host;dbname=$db;charset=UTF8", $username, $pwd, array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION));
|
|
|
|
session_start();
|
|
|
|
function configure_smtp($phpmailer){
|
|
$phpmailer->IsHTML(true);
|
|
//Pour ne pas avoir de soucis par la suite il est conseillé de donner l' encodage
|
|
$phpmailer->CharSet = "UTF-8";
|
|
$phpmailer->isSMTP(); //switch to smtp
|
|
$phpmailer->Host = getenv('SMTP_HOST');
|
|
$phpmailer->SMTPAuth = evalBool(getenv('SMTP_AUTH'));
|
|
$phpmailer->Port = getenv('SMTP_PORT');
|
|
$phpmailer->Username = getenv('SMTP_USER');
|
|
$phpmailer->Password = getenv('SMTP_PASS');
|
|
$phpmailer->SMTPSecure = getenv('SMTP_SECURE');
|
|
if (ENV === 'production'){
|
|
$phpmailer->AddAddress('rgpd@ldc.fr');
|
|
$phpmailer->AddBCC('sylvain.gouet@ldc.fr');
|
|
$phpmailer->AddBCC('sebastien.hattry@ldc.fr');
|
|
}else{
|
|
$phpmailer->AddAddress('equipe.web@ldc.fr');
|
|
}
|
|
// ! plus utilisé avec sendinblue
|
|
// $phpmailer->SMTPAutoTLS = false;
|
|
// $phpmailer->SMTPOptions = array(
|
|
// 'ssl' => array(
|
|
// 'verify_peer' => false,
|
|
// 'verify_peer_name' => false,
|
|
// 'allow_self_signed' => true
|
|
// )
|
|
// );
|
|
}
|