Erreur adresse de l'expéditeur [Réglé]
Visiteur
Boosteur Inactif
Je suis nouveau sur le forum, et je suis en train de créer un site internet pour ma société.
J'ai un problème avec le module contact. Lorsque je remplie le formulaire de contact que j'ai modifié en y ajoutant certains champ comme nom, prénom, adresse, code postal, téléphone et que j'envoi l'email, l'adresse de l'expéditeur qui a été saisi dans le formulaire est réceptionner avec le nom du site (de test) devant.
Voici l émail reçu :
De : bigbud013@free.frtestfree.fr A : yann13620@(caché volontairement)
L émail entré dans le formulaire est test@free.fr
Je n'arrive donc pas à supprimer le "bigbud013@free.fr" devant l'adresse mail de l'expéditeur.
Peut être est-ce du à hébergement de free ?
En tout cas je vous tire mon chapeau pour le développement de phpboost que je suis depuis maintenant 4 ans.
Code du fichier contact.php :
Code PHP :
<?php /*################################################## * contact.php * ------------------- * begin : July 29, 2005 * copyright : (C) 2005 Viarre Régis * email : crowkait@phpboost.com * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ require_once('../kernel/begin.php'); require_once('../contact/contact_begin.php'); require_once('../kernel/header.php'); $mail_from = retrieve(POST, 'mail_email', '', TSTRING_UNCHANGE); $mail_object = retrieve(POST, 'mail_object', '', TSTRING_UNCHANGE); $mail_nom = retrieve(POST, 'nom', '', TSTRING_UNCHANGE); $mail_prenom = retrieve(POST, 'prenom', '', TSTRING_UNCHANGE); $mail_adresse = retrieve(POST, 'adresse', '', TSTRING_UNCHANGE); $mail_codepostal = retrieve(POST, 'codepostal', '', TSTRING_UNCHANGE); $mail_telephone = retrieve(POST, 'telephone', '', TSTRING_UNCHANGE); $contents = retrieve(POST, 'mail_contents', '', TSTRING_UNCHANGE); $mail_contents = 'Nom :'. $mail_nom ."n". 'Prénom :' .$mail_prenom ."n". 'Adresse :'. $mail_adresse ."n". 'Code Postal :'. $mail_codepostal ."n". 'Téléphone :'. $mail_telephone ."n". $contents; $mail_valid = retrieve(POST, 'mail_valid', ''); $get_error = ''; import('util/captcha'); $captcha = new Captcha(); $captcha->set_difficulty($CONFIG_CONTACT['contact_difficulty_verifcode']); ###########################Envoi############################## if (!empty($mail_valid)) { //Code de vérification si activé if (!$CONFIG_CONTACT['contact_verifcode'] || $captcha->is_valid()) //Code de vérification si activé { import('io/mail'); $mail = new Mail(); if ($mail->send_from_properties($CONFIG['mail'], $mail_object, $mail_contents, $mail_from, '', 'user')) //Succès mail { $get_error = 'success'; } else //Erreur mail { $get_error = 'error'; } } else //Champs incomplet! { $get_error = 'verif'; } } elseif (!empty($_POST['mail_valid']) && ( empty($mail_email) || empty($mail_contents) || empty($mail_nom) || empty($mail_prenom) || empty($mail_adresse) || empty($mail_codepostal) || empty($mail_telephone) )) //Champs incomplet! { $get_error = 'incomplete'; } ###########################Affichage############################## $Template->set_filenames(array( 'contact'=> 'contact/contact.tpl' )); //Gestion erreur. if ($get_error == 'incomplete') { $Errorh->handler($LANG['e_incomplete'], E_USER_NOTICE); } elseif ($get_error == 'verif') { $Errorh->handler($LANG['e_incorrect_verif_code'], E_USER_WARNING); } elseif ($get_error == 'success')//Message de succés. { $Errorh->handler($LANG['success_mail'], E_USER_SUCCESS); } elseif ($get_error == 'error')//Message de succés. { $Errorh->handler($LANG['error_mail'], E_USER_WARNING); } //Code de vérification, anti-bots. if ($captcha->is_available() && $CONFIG_CONTACT['contact_verifcode']) { $Template->assign_vars(array( 'C_VERIF_CODE' => true, 'VERIF_CODE' => $captcha->display_form(), 'L_REQUIRE_VERIF_CODE' => $captcha->js_require() )); } $Template->assign_vars(array( 'MAIL' => $User->get_attribute('user_mail'), 'CONTACT_OBJECT' => stripslashes(retrieve(POST, 'mail_object', '')), 'CONTACT_CONTENTS' => $contents, 'L_REQUIRE_MAIL' => $LANG['require_mail'], 'L_REQUIRE_TEXT' => $LANG['require_text'] , 'L_CONTACT_MAIL' => $LANG['contact_mail'], 'L_MAIL' => $LANG['mail'], 'L_VERIF_CODE' => $LANG['verif_code'], 'L_REQUIRE' => $LANG['require'], 'L_VALID_MAIL' => $LANG['valid_mail'], 'L_NOM' => 'Nom', 'L_PRENOM' => 'Prénom', 'L_ADRESSE' => 'Adresse', 'L_CODEPOSTAL' => 'Code postal', 'L_TELEPHONE' => 'Téléphone', 'L_OBJET' => $LANG['objet'], 'L_CONTENTS' => $LANG['content'], 'L_SUBMIT' => $LANG['submit'], 'L_RESET' => $LANG['reset'], 'U_ACTION_CONTACT' => url('contact.php?token=' . $Session->get_token()) )); $Template->pparse('contact'); require_once('../kernel/footer.php'); ?>
Code du fichier contact.tpl
Code PHP :
<script type="text/javascript">
<!--
function check_form_mail(){
if(document.getElementById('mail_email').value == "") {
alert("{L_REQUIRE_MAIL}");
return false;
}
if(document.getElementById('mail_contents').value == "") {
alert("{L_REQUIRE_TEXT}");
return false;
}
{L_REQUIRE_VERIF_CODE}
return true;
}
-->
</script>
# IF C_ERROR_HANDLER #
<span id="errorh"></span>
<div class="{ERRORH_CLASS}" style="width:500px;margin:auto;padding:15px;">
<img src="../templates/{THEME}/images/{ERRORH_IMG}.png" alt="" style="float:left;padding-right:6px;" /> {L_ERRORH}
</div>
# ENDIF #
<form action="{U_ACTION_CONTACT}" method="post" onsubmit="return check_form_mail();" class="fieldset_mini">
<fieldset>
<legend>{L_CONTACT_MAIL}</legend>
<p>{L_REQUIRE}</p>
<dl>
<dt><label for="mail_email">* {L_MAIL}</label>
<span>{L_VALID_MAIL}</span></dt>
<dd><label><input type="text" size="30" maxlength="50" id="mail_email" name="mail_email" value="{MAIL}" class="text" /></label></dd>
</dl>
<dl>
<dt><label for="nom">* {L_NOM}</label></dt>
<dd><label><input type="text" size="30" name="nom" id="nom" class="text" /></label></dd>
</dl>
<dl>
<dt><label for="prenom">* {L_PRENOM}</label></dt>
<dd><label><input type="text" size="30" name="prenom" id="prenom" class="text" /></label></dd>
</dl>
<dl>
<dt><label for="adresse">* {L_ADRESSE}</label></dt>
<dd><label><input type="text" size="30" name="adresse" id="adresse" class="text" /></label></dd>
</dl>
<dl>
<dt><label for="codepostal">* {L_CODEPOSTAL}</label></dt>
<dd><label><input type="text" size="30" name="codepostal" id="codepostal" class="text" /></label></dd>
</dl>
<dl>
<dt><label for="telephone">* {L_TELEPHONE}</label></dt>
<dd><label><input type="text" size="30" name="telephone" id="telephone" class="text" /></label></dd>
</dl>
<dl>
<dt><label for="mail_objet">{L_OBJET}</label></dt>
<dd><label><input type="text" size="30" name="mail_object" id="mail_object" class="text" value="{CONTACT_OBJECT}" /></label></dd>
</dl>
# IF C_VERIF_CODE #
<dl>
<dt><label for="verif_code">* {L_VERIF_CODE}</label></dt>
<dd>
<label>
{VERIF_CODE}
</label>
</dd>
</dl>
# ENDIF #
<label for="mail_contents">* {L_CONTENTS}</label>
<label><textarea rows="10" cols="47" id="mail_contents" name="mail_contents">{CONTACT_CONTENTS}</textarea></label>
</fieldset>
<fieldset class="fieldset_submit">
<legend>{L_SUBMIT}</legend>
<input type="submit" name="mail_valid" value="{L_SUBMIT}" class="submit" />
<input type="reset" value="{L_RESET}" class="reset" />
<input type="hidden" name="token" value="{TOKEN}" />
</fieldset>
</form>
Édité par Visiteur Le 31/08/2011 à 20h26
Visiteur
Boosteur Inactif
Visiteur
Boosteur Inactif
Code PHP :
if ($mail->send_from_properties($CONFIG['mail'], $mail_object, $mail_contents, $mail_from, 'From: Contact <'.$CONFIG['mail'] .'>' , 'user')) //Succès mail
la partie qui est modifier ici c'est : 'From: Contact <'.$CONFIG['mail'] .'>'
$CONFIG['mail'] est le mail de contact saisie dans l'admin normalement.
hight_tower Membre non connecté
Booster Bazooka
-
Booster Bazooka
- Voir le profil du membre hight_tower
- Inscrit le : 01/09/2009
- Site internet
Au plaisir
Visiteur
Boosteur Inactif
SaTurNin :
remplace la ligne 51 de contact.php par :
la partie qui est modifier ici c'est : 'From: Contact <'.$CONFIG['mail'] .'>'
$CONFIG['mail'] est le mail de contact saisie dans l'admin normalement.
Code PHP :
if ($mail->send_from_properties($CONFIG['mail'], $mail_object, $mail_contents, $mail_from, 'From: Contact <'.$CONFIG['mail'] .'>' , 'user')) //Succès mail
la partie qui est modifier ici c'est : 'From: Contact <'.$CONFIG['mail'] .'>'
$CONFIG['mail'] est le mail de contact saisie dans l'admin normalement.
Merci déjà pour ta réponse Saturnin. Malheureusement maintenant j'obtiens l’émail de l'administrateur, alors que je souhaiterais qu'il y est celui inscrit dans le formulaire de contact que met la personne.
Visiteur
Boosteur Inactif
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
Code PHP :
if ($mail->send_from_properties($CONFIG['mail'], $mail_object, $mail_contents, $mail_from, 'From: Contact <'. $mail_from .'>' , 'user')) //Succès mail
Visiteur
Boosteur Inactif
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie