1
0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__avion-poeme/include/envoi_courriel.inc.php

29 lines
794 B
PHP
Raw Normal View History

2021-03-22 12:20:39 +01:00
<?php
require_once 'log.php';
function envoiMail($destinataire, $sujet, $text, $html=false)
{
$headers = "From: contact@avion-poe.me" . LF;
if ($html)
{
$headers .= "Content-type: text/html; charset=UTF-8" . LF;
}else
$headers .= "Content-type: text/plain; charset=UTF-8" . LF;
}
$headers .= "DATE: " . date( 'r' ) . LF . LF;
log_write(__FILE__ . __LINE__ . " Envoi d'un courriel à " . $courriel . "sujet:" . $sujet, INFO);
if( !mail($destinataire, $sujet, $text, $headers) ) //Sending mail
{
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" .$courriel . EOL . $sujet . EOL, ERROR);
return 0;
}else
{
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel avec les pièces jointes est parti:" .$courriel . EOL, INFO);
return 1;
}
}