Résolution issue #0000094, pour mise en production
This commit is contained in:
parent
f6e54b1130
commit
90db719c58
@ -9,7 +9,8 @@ define ('CHARSET','utf-8');
|
||||
define ('EMAIL_SUPPORTDEV','supportdev@scores-decisions.com');
|
||||
|
||||
//Définition SMTP Serveur et méthode
|
||||
define ('SMTP_HOST','smtp.free.fr');
|
||||
define ('MAIL_METHOD', 'smtp');
|
||||
define ('MAIL_SMTPHOST','smtp.free.fr');
|
||||
|
||||
//Message affiché lors d'une erreur soap
|
||||
define ('ERROR_SOAP',
|
||||
|
@ -9,7 +9,7 @@ define ('CHARSET','utf-8');
|
||||
define ('EMAIL_SUPPORTDEV','supportdev@scores-decisions.com');
|
||||
|
||||
//Définition SMTP Serveur et méthode
|
||||
define ('SMTP_HOST','localhost');
|
||||
define ('MAIL_METHOD', 'sendmail');
|
||||
|
||||
//Message affiché lors d'une erreur soap
|
||||
define ('ERROR_SOAP',
|
||||
|
@ -9,7 +9,7 @@ define ('CHARSET','utf-8');
|
||||
define ('EMAIL_SUPPORTDEV','supportdev@scores-decisions.com');
|
||||
|
||||
//Définition SMTP Serveur et méthode
|
||||
define ('SMTP_HOST','localhost');
|
||||
define ('MAIL_METHOD', 'sendmail');
|
||||
|
||||
//Message affiché lors d'une erreur soap
|
||||
define ('ERROR_SOAP',
|
||||
|
@ -9,7 +9,7 @@ define ('CHARSET','utf-8');
|
||||
define ('EMAIL_SUPPORTDEV','supportdev@scores-decisions.com');
|
||||
|
||||
//Définition SMTP Serveur et méthode
|
||||
define ('SMTP_HOST','smtp.free.fr');
|
||||
define ('MAIL_METHOD', 'sendmail');
|
||||
|
||||
//Message affiché lors d'une erreur soap
|
||||
define ('ERROR_SOAP',
|
||||
|
@ -57,19 +57,25 @@ function graydon_messageSoapFault(){
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
function graydon_mailSoapFault($message){
|
||||
$mail = new PHPMailer();
|
||||
$mail->IsSendmail();
|
||||
$body = $message;
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
$mail->AddReplyTo('contact@scores-decisions.com','Serveur SD-13408');
|
||||
$mail->SetFrom('contact@scores-decisions.com','Serveur SD-13408');
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, 'Support');
|
||||
$mail->Subject = "Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||
$mail->MsgHTML($body);
|
||||
if(!$mail->Send()) {
|
||||
graydon_logSoapFault($mail->ErrorInfo);
|
||||
}
|
||||
function graydon_mailSoapFault($message)
|
||||
{
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")",
|
||||
$message,
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Serveur SD-13408',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> EMAIL_SUPPORTDEV,
|
||||
'name' => 'Support'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -480,17 +480,24 @@ function getIdentite($identifier, $CompanyProductIdentifier, $file, $format = 'x
|
||||
//Pas d'enregistrement des détails de la commande car elle est immédiate
|
||||
|
||||
//Envoi d'un mail pour le passage de la commande
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->IsSendmail();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Commandes International";
|
||||
$mail->Subject = "[International] - (Date :".date("d")."/".date("m")."/".date("Y").") - Commandes";
|
||||
$body = "Commande effectué par ".$_SESSION['tabInfo']['login']."\n";
|
||||
$body .= $mailcommandes;
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"[International] - (Date :".date("d")."/".date("m")."/".date("Y").") - Commandes",
|
||||
"Commande effectué par ".$_SESSION['tabInfo']['login']."\n" .
|
||||
$mailcommandes,
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Commandes International',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> EMAIL_SUPPORTDEV,
|
||||
'name' => 'Support'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
@ -700,18 +707,24 @@ function setEnquete($pays){
|
||||
//Déjà fait avant le passage de la commande chez graydon
|
||||
|
||||
//Envoi d'un mail pour le passage de la commande
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->IsSendmail();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Commandes International";
|
||||
$mail->Subject = "[International] - Commande - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'].", ref : ".$commandes->reference;
|
||||
$body .= " ";
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"[International] - (Date :".date("d")."/".date("m")."/".date("Y").") - Commandes",
|
||||
"Commande effectué par ".$_SESSION['tabInfo']['login']."\n".
|
||||
", ref : ".$commandes->reference,
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Commandes International',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> EMAIL_SUPPORTDEV,
|
||||
'name' => 'Support'
|
||||
)
|
||||
)
|
||||
);
|
||||
$commandeOk = TRUE;
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
@ -723,17 +736,25 @@ function setEnquete($pays){
|
||||
graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
}
|
||||
//Envoi d'un mail pour le passage de la commande en erreur
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->IsSendmail();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Commandes International";
|
||||
$mail->Subject = "[International] - Commande Erreur - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'].", identifiant : ".$commandes_id;
|
||||
$body .= " ";
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"[International] - (Date :".
|
||||
date("d")."/".date("m")."/".date("Y").") - Commandes",
|
||||
"Commande effectué par ".$_SESSION['tabInfo']['login']."\n".
|
||||
", identifiant : ".$commandes_id,
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Commandes International',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> EMAIL_SUPPORTDEV,
|
||||
'name' => 'Support'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$commandeOk = FALSE;
|
||||
}
|
||||
|
@ -351,26 +351,22 @@ function lien_factice($siret, $ref, $lib)
|
||||
|
||||
function sendCmdMail($sujet, $message)
|
||||
{
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$receptionCmd = array( 'email' =>'pieces@scores-decisions.com', 'nom'=>'Pieces');
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->IsSendmail();
|
||||
try
|
||||
{
|
||||
$body = $message;
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
$mail->AddReplyTo('contact@scores-decisions.com','Contact Scores & Décisions');
|
||||
$mail->SetFrom('contact@scores-decisions.com','Contact Scores & Décisions');
|
||||
$mail->AddAddress($receptionCmd['email'], $receptionCmd['nom']);
|
||||
$mail->Subject = $sujet;
|
||||
$mail->MsgHTML($body);
|
||||
$mail->Send();
|
||||
}
|
||||
catch (phpmailerException $e)
|
||||
{
|
||||
//echo $e->errorMessage();
|
||||
} catch (Exception $e) {
|
||||
//echo $e->getMessage();
|
||||
}
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")",
|
||||
$message,
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Contact',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> 'pieces@scores-decisions.com',
|
||||
'name' => 'Pieces'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -347,13 +347,27 @@ function mailCommande($email, $siren, $type){
|
||||
$subject = "Commande de pièces pour $siren à ".$email;
|
||||
break;
|
||||
}
|
||||
$emailTo = 'contact@scores-decisions.com';
|
||||
mail( $emailTo, $subject,
|
||||
'REQUEST='.EOL.print_r($_REQUEST,true).'EOL'.
|
||||
'SERVER='.EOL.print_r($_SERVER,true).'EOL'.
|
||||
'SESSION='.EOL.print_r($_SESSION,true).'EOL'.
|
||||
'ENV='.EOL.print_r($_ENV,true).'EOL'.
|
||||
'tabInfo='.print_r($tabInfo,true));
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
$subject,
|
||||
'REQUEST='.EOL.print_r($_REQUEST,true).'EOL'.
|
||||
'SERVER='.EOL.print_r($_SERVER,true).'EOL'.
|
||||
'SESSION='.EOL.print_r($_SESSION,true).'EOL'.
|
||||
'ENV='.EOL.print_r($_ENV,true).'EOL'.
|
||||
'tabInfo='.print_r($tabInfo,true),
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Contact',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> 'contact@scores-decisions.com',
|
||||
'name' => 'Contact'
|
||||
)
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
|
57
includes/mail/mail.php
Normal file
57
includes/mail/mail.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* Suivant la configuration utiliser le smtp
|
||||
* ou utilisend sendmail
|
||||
* phpmailer ou commande mail
|
||||
*
|
||||
*/
|
||||
|
||||
function sendMail($sujet, $message, $from, $to, $cc = array() )
|
||||
{
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer(true);
|
||||
//Choix de la méthode d'envoi
|
||||
if(MAIL_METHOD == 'sendmail')
|
||||
{
|
||||
$mail->IsSendmail();
|
||||
}
|
||||
elseif(MAIL_METHOD == 'smtp')
|
||||
{
|
||||
$mail->IsSMTP();
|
||||
$mail->SMTPDebug = 0; // 0, 1, 2
|
||||
$mail->Host = MAIL_SMTPHOST;
|
||||
$mail->Port = defined(MAIL_SMTPPORT)? MAIL_SMTPPORT : 25;
|
||||
$mail->SMTPAuth = defined(MAIL_SMTPAUTH)? MAIL_SMTPAUTH : false;
|
||||
$mail->Username = defined(MAIL_SMTPUSER)? MAIL_SMTPUSER : '';
|
||||
$mail->Password = defined(MAIL_SMTPPASS)? MAIL_SMTPPASS : '';
|
||||
}
|
||||
//Spécification du charset
|
||||
$mail->CharSet = CHARSET;
|
||||
//Envoi du mail
|
||||
try
|
||||
{
|
||||
$body = $message;
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
$mail->AddReplyTo($from['email'], $from['name']);
|
||||
$mail->SetFrom($from['email'], $from['name']);
|
||||
foreach($to as $info)
|
||||
{
|
||||
$mail->AddAddress($info['email'], $info['name']);
|
||||
}
|
||||
$mail->Subject = $sujet;
|
||||
$mail->MsgHTML($body);
|
||||
$mail->Send();
|
||||
return true;
|
||||
}
|
||||
catch (phpmailerException $e)
|
||||
{
|
||||
//Ecriture des erreurs dans un fichier (sujet, to)
|
||||
file_put_contents(
|
||||
PATH_DATA.'/mailerror.log',
|
||||
$e->errorMessage().' '.$to.' '.$sujet,
|
||||
FILE_APPEND
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -100,12 +100,29 @@ if ($_REQUEST['action']<>'envoyer')
|
||||
$email = trim($formR['email']);
|
||||
$remarque = trim($formR['remarque']);
|
||||
|
||||
if (preg_match('#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#',$email) && $rs<>'' && $ville<>'' && $remarque<>'') {
|
||||
if ( preg_match('#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#',$email)
|
||||
&& $rs<>'' && $ville<>'' && $remarque<>'')
|
||||
{
|
||||
$fp=fopen(PATH_LOGS.'enquetes.csv', 'a');
|
||||
fwrite($fp, date('Y/m/d H:i:s').' - '.print_r($_REQUEST['formR'],true).print_r($tabInfo,true)."\n");
|
||||
fclose($fp);
|
||||
mail('contact@scores-decisions.com','Demande d\'investigation', print_r($_REQUEST['formR'],true).
|
||||
print_r($tabInfo,true));
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"Demande d'investigation",
|
||||
print_r($_REQUEST['formR'],true).print_r($tabInfo,true),
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Contact',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> 'contact@scores-decisions.com',
|
||||
'name' => 'Contact'
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
<table width="580" height="100%" border="0" align="left" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
@ -115,7 +132,9 @@ if ($_REQUEST['action']<>'envoyer')
|
||||
</tr>
|
||||
</table>
|
||||
<?
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<table width="580" height="100%" border="0" align="left" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
|
@ -55,7 +55,6 @@ function processSoapFault($clientSoap, $fault, $tabInfo, $debug = FALSE){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Affiche un message d'erreur sympatique pour le client.
|
||||
* @return string
|
||||
@ -75,25 +74,23 @@ function messageSoapFault()
|
||||
*/
|
||||
function mailSoapFault($message)
|
||||
{
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->IsSendmail();
|
||||
try
|
||||
{
|
||||
$body = $message;
|
||||
$body = eregi_replace("[\]",'',$body);
|
||||
$mail->AddReplyTo('contact@scores-decisions.com','Serveur SD-13408');
|
||||
$mail->SetFrom('contact@scores-decisions.com','Serveur SD-13408');
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, 'Support');
|
||||
$mail->Subject = "Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||
$mail->MsgHTML($body);
|
||||
$mail->Send();
|
||||
}
|
||||
catch (phpmailerException $e)
|
||||
{
|
||||
//echo $e->errorMessage();
|
||||
} catch (Exception $e) {
|
||||
//echo $e->getMessage();
|
||||
}
|
||||
require_once 'mail/mail.php';
|
||||
sendMail(
|
||||
"Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")",
|
||||
$message,
|
||||
//From
|
||||
array(
|
||||
'email' => 'contact@scores-decisions.com',
|
||||
'name' => 'Serveur SD-13408',
|
||||
),
|
||||
//TO
|
||||
array(
|
||||
0 => array(
|
||||
'email'=> EMAIL_SUPPORTDEV,
|
||||
'name' => 'Support'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user