Probleme envois de courriel via php

Fermé
Guimb0 Messages postés 10 Date d'inscription lundi 9 avril 2012 Statut Membre Dernière intervention 28 septembre 2014 - 9 sept. 2014 à 20:26
 Utilisateur anonyme - 29 sept. 2014 à 14:26
Je suis en confection de site et pour sauver un peu de temps j'ai acheter un script php pour le transfert de courriel via mon site web .

Lors de l'envois il me donne le code d'erreur suivant :

<?php
//www.resellscripts.info
error_reporting(E_ALL);
if(getenv('REQUEST_METHOD') != 'POST')
exit('Opss! Only POST requests are accepted');

include_once 'email.class.php';
include_once 'config.class.php';
include_once 'protector.class.php';

define('DS' , DIRECTORY_SEPARATOR);

$email = new Email($_POST);
$email->init();

?>


Le email.class.php :
<?php
//www.resellscripts.info
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
class Email extends Protector {

public function init(){

if($this->finish()){
$mail = $this->phpmailer();
$mail = new PHPMailer(true);
$mail->IsHTML(true);

try{
$mail->Body = $this->body();
$mail->Subject = $this->subject();
$mail->From = $this->from('email');
$mail->FromName = $this->from('name');
$mail->AddReplyTo($this->from('email'));

/** SMTP OPTIONS **/

if($this->Config->smtp['use'] != 'no'){
$mail->IsSMTP();
$mail->Host = $this->Config->smtp['host'];
$mail->Port = $this->Config->smtp['port'];
$mail->SMTPSecure = $this->Config->smtp['secure'];
if($this->Config->smtp['auth'] != 'no'){
$mail->SMTPAuth = true;
$mail->Username = $this->Config->smtp['username'];
$mail->Password = $this->Config->smtp['password'];
}
}
// Adds Addresses

foreach($this->Config->Address as $Address){
if(!empty($Address))
$mail->AddAddress($Address);
}

// Adds cc
foreach($this->Config->Cc as $Address){
if(!empty($Address))
$mail->AddCC($Address);
}


$mail->CharSet = $this->Config->charset;
$email = $mail->Send();
if($email){
if(IS_AJAX)
echo json_encode(true);
else
echo $this->msg['success'];
}
}catch(Exception $e){
if(IS_AJAX)
echo json_encode(false);
else
echo $this->msg['error'];
}

}

}
public function __constructor($post){
parent::__construct($post);
}
private function phpmailer(){
include_once 'phpmailer' . DS . 'class.phpmailer.php';
return new PHPMailer();
}

public function body(){
$body = "<h3 style=\"color:#0066CC;border-bottom:1px solid #0066CC;\">Details</h3>\n";
foreach($this->data as $key => $val){
if($this->fields[$key]['func'] != 'sec1'){
if($this->fields[$key]['func'] != 'sec2'){
$field = $this->fields[$key]['name'];
$body .= " <strong>{$field}: </strong>{$val}<br />";
}
}
}
return $body;

}

public function subject(){
foreach($this->fields as $key => $val){
if(isset($this->fields[$key]['is']) && $this->fields[$key]['is'] == 'subject')
return $this->data[$key];
}
}

public function from($a){
foreach($this->fields as $key => $val){
if($a == 'email'){
if(isset($this->fields[$key]['is']) && $this->fields[$key]['is'] == 'email')
return $this->data[$key];
}else{
if(isset($this->fields[$key]['is']) && $this->fields[$key]['is'] == 'name')
return $this->data[$key];
}
}
}

}
?>

Merci de votre aide

4 réponses

loupix57 Messages postés 316 Date d'inscription mercredi 20 mars 2013 Statut Membre Dernière intervention 1 juin 2015 14
29 sept. 2014 à 14:22
oui, tu t'est tromper sur l'emplacement des classes !!
revoie ta page et tes require_once !
1
loupix57 Messages postés 316 Date d'inscription mercredi 20 mars 2013 Statut Membre Dernière intervention 1 juin 2015 14
24 sept. 2014 à 19:50
J'veut bien t'aider, mais je ne voit pas le code d'erreur :-/
0
Guimb0 Messages postés 10 Date d'inscription lundi 9 avril 2012 Statut Membre Dernière intervention 28 septembre 2014
28 sept. 2014 à 17:38
Voilà ce qui arrive lorsque j'essaie d'envoyer

Warning: include_once(../php - Copie/config.class.php): failed to open stream: No such file or directory in /home/auberget/public_html/publi-print.net/assets/php/send.php on line 7

Warning: include_once(): Failed opening '../php - Copie/config.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/auberget/public_html/publi-print.net/assets/php/send.php on line 7

Warning: include_once(../php - Copie/protector.class.php): failed to open stream: No such file or directory in /home/auberget/public_html/publi-print.net/assets/php/send.php on line 8

Warning: include_once(): Failed opening '../php - Copie/protector.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/auberget/public_html/publi-print.net/assets/php/send.php on line 8

Warning: include_once(../php - Copie/email.class.php): failed to open stream: No such file or directory in /home/auberget/public_html/publi-print.net/assets/php/send.php on line 9

Warning: include_once(): Failed opening '../php - Copie/email.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/auberget/public_html/publi-print.net/assets/php/send.php on line 9

Fatal error: Class 'Email' not found in /home/auberget/public_html/publi-print.net/assets/php/send.php on line 13
0
Bonjour

Exemple :

<?php
define('WEBROOT', str_replace('index.php', '', $_SERVER['SCRIPT_NAME']));
define('ROOT'   , str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']));

// inserer les controleurs principaux
require ROOT .  'controleurs/controleur/Controleur.php';
require ROOT .  'modeles/Modele.php';
require ROOT .  'controleurs/editeur/Form.php';
require ROOT .  'controleurs/erreur/Erreur.php'; 


C'est juste une piste ^^ c'est comme ça que je fais et c'est "portable" sur n'importe quel hébergement ( à la condition que ton index pricipal soit en .php, sinon remplace le par la bonne extension )

En informatique 99% des problèmes se situent entre le fauteuil et le clavier
0