Get_Datas();
}
if (!isset($conf_mail))
{
$conf_mail = get_mail_configuration();
}
if (isset($args))
{
$infos_message= $mail_supervisor->Memo_Var($args);
}else{
$args = array();
}
//=====================================================================================================
$groups=get_liste($group_id).dest;
//=======================================================================================
if (count($groups) > 0)
{
$args['Bcc']=$groups;
} else {
$mailto = $conf_mail['formated_email_webmaster'];
}
$args['from'] =(function_exists('get_user_language_desc')) ? get_user_language_desc($conf_mail['formated_email_webmaster']):$conf_mail['formated_email_webmaster'];
$message_html =$message;
if (function_exists('get_user_language_desc') and isset($message) and $message <> '')
$message = get_user_language_desc($message)."\n\n";
//==================================================================
$message_texte=sprintf(
l10n('Sv_message_texte %s %s %s %s'),
format_date( date("Y-m-d H:i:s")),
$group_name,
$message,
$args['from']
);
//==================================================================
$message_html .= "" . $message . "" . $message_texte;
//==========================================================================
$args['subject']="Plugin Piwigo TEST";
$args['content']=$message_html;
$infos_message .="To :" . $mailto;
$ret= pwg_mail($mailto , $args);
if ( $group_name <> '' or $mailto <> '' )
{
if ($group_name<>'') {
$infos_message .= '
'. sprintf( l10n('An information email was sent to group "%s"'), $group_name ).'
';
}
if ($mailto <> '') {
$infos_message .= '
'. sprintf( l10n('Sv_mail_sent_to'), $mailto ).'
';
}
}else{
$infos_message .='
'.l10n('Sv_no_receiver_available') ;
}
}
//===============================================================================================================
function mail_attachement($args){
global $infos_message,$erreur_message ,$conf,$user,$conf_mail,$mail_donnees,$lang ;
$mails_donnees = $mail_supervisor->Get_Datas();
if (!isset($conf_mail))
{
$conf_mail = get_mail_configuration();
}
load_language('plugin.lang', MAIL_SUPERV_PATH);
$nom ='piwigo_logo_sombre_214x100.png';
$fichier=PHPWG_ROOT_PATH.'admin/template/goto/theme/roma/images/piwigo_logo_sombre_214x100.png' ;
$typemime='image/jpeg';
$fd = fopen( $fichier, "r" );
$contenu = fread( $fd, filesize( $fichier ) );
fclose( $fd );
$piecejointe = chunk_split(base64_encode($contenu));
$from=$args['from'];
$to="";
$message_texte=sprintf(
l10n('Sv_message_texte %s %s %s'),
format_date( date("Y-m-d H:i:s")),
$to,
$from
);
$message_html = '';
ob_start();
echo str_replace("\n","
",$message_texte);
$message_html .= ob_get_contents()."\n";
//ob_flush();
ob_end_clean();
$limite=$conf_mail['boundary_key'];
$headers = date("Y-m-d H:i:s") ."\n";
//=======================================================================================
$headers = "From: ".$args['from']."\n";
$headers.= "Reply-To: ".$args['from']."\n";
$nb_destinataires=0;
$destinataire = $conf_mail['email_webmaster'];
if (!empty($args['Cc'])){
$nb_destinataires += count($args['Cc']);
$to= explode(',', $args['Cc']);
$headers .= get_strict_email_list($to) ;
}
if (!empty($args['Bcc'])){
$nb_destinataires += count($args['Bcc']);
$to = implode(',', $args['Bcc']);
$headers .= 'Bcc :'.get_strict_email_list($to)."\n" ;
}
$headers.= 'Content-Type: multipart/alternative;'."\n";
$headers.= ' boundary="---='.$limite.'";'."\n";
$headers.= ' reply-type=original'."\n";
$headers.= 'MIME-Version: 1.0'."\n";
$headers.= 'X-Mailer: Piwigo Mailer'."\n";
//Le message en texte simple pour les navigateurs qui n'acceptent pas le HTML
$texte = "This is a multi-part message in MIME format.\n";
$texte .= "-----=".$limite."\n";
$texte .= "Ceci est un message est au format MIME.\n";
$texte .= 'Content-Type: text/plain; charset="UTF-8"'."\n";
$texte .= 'Content-Transfer-Encoding: 8bit'."\n\n";
$texte .= $message_texte ;
$texte .= "\n\n";
$texte .= "-----=".$limite."\n";
$texte .= 'Content-Type: text/html; charset="UTF-8"'."\n";
$texte .= 'Content-Transfer-Encoding: 8bit'."\n\n";
$texte .= $message_html;
$texte .= "\n\n";
$attachement = "-----=".$limite."\n";
$attachement .= "Content-Type: ".$typemime."; name=\"".$nom."\"\n";
$attachement .= "Content-Transfer-Encoding: base64\n";
$attachement .= "Content-Disposition: attachment; filename=\"".$nom."\"\n\n";
$attachement .= $piecejointe;
$attachement .= "\n\n\n-----=".$limite."\n";
$ret=false;
ob_start();
$ret= mail( $destinataire, $args['subject'], $texte.$attachement, $headers);
$message = ob_get_contents() ;
//ob_flush();
ob_end_clean();
if (($message)<>"") {
$erreur_message .= $message ;
$infos_message = "-------------------";
}
return $ret;
}
?>