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

32 lines
789 B
PHP
Raw Normal View History

2021-03-22 12:20:39 +01:00
<?php
require_once 'log.php';
2021-03-23 20:26:52 +01:00
2021-03-22 12:20:39 +01:00
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
2021-03-23 20:26:52 +01:00
{
2021-03-22 12:20:39 +01:00
$headers .= "Content-type: text/plain; charset=UTF-8" . LF;
}
$headers .= "DATE: " . date( 'r' ) . LF . LF;
2021-03-23 20:26:52 +01:00
log_write(__FILE__ . __LINE__ . " Envoi d'un courriel à " . $text . "sujet:" . $sujet, INFO);
2021-03-22 12:20:39 +01:00
if( !mail($destinataire, $sujet, $text, $headers) ) //Sending mail
{
2021-03-23 20:26:52 +01:00
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" .$text . EOL . $sujet . EOL, ERROR);
2021-03-22 12:20:39 +01:00
return 0;
}else
{
2021-03-23 20:26:52 +01:00
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel avec les pièces jointes est parti:" .$text . EOL, INFO);
2021-03-22 12:20:39 +01:00
return 1;
}
}
2021-03-23 20:26:52 +01:00
?>