first commit from DTux
This commit is contained in:
28
include/envoi_courriel.inc.php
Normal file
28
include/envoi_courriel.inc.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user