pakerou Posted February 28, 2011 Share Posted February 28, 2011 Bonjour,Je souhaite envoyer un mail par défaut et le deuxième je veux le personnaliser avec une deuxième tpl mail ou je peux modifier le chemain pour qu'il utilise la deux tpl mail $errors = array(); $smarty->assign('contacts', Contact::getContacts(intval($cookie->id_lang))); if (Tools::isSubmit('submitMessage')) { $message = Tools::htmlentitiesUTF8(Tools::getValue('message')); if (!($from = Tools::getValue('from')) OR !Validate::isEmail($from)) $errors[] = Tools::displayError('invalid e-mail address'); elseif (!($message = nl2br2($message))) $errors[] = Tools::displayError('message cannot be blank'); elseif (!Validate::isMessage($message)) $errors[] = Tools::displayError('invalid message'); elseif (!($id_contact = intval(Tools::getValue('id_contact'))) OR !(Validate::isLoadedObject($contact = new Contact(intval($id_contact), intval($cookie->id_lang))))) $errors[] = Tools::displayError('please select a contact in the list'); else { if (intval($cookie->id_customer)) $customer = new Customer(intval($cookie->id_customer)); if (Mail::Send(intval($cookie->id_lang), 'contact', 'Message from contact form', array('{email}' => $from, '{message}' => stripslashes($message)), $contact->email, $contact->name, $from, (intval($cookie->id_customer) ? $customer->firstname.' '.$customer->lastname : $from))) $smarty->assign('confirmation', 1); else $errors[] = Tools::displayError('an error occurred while sending message'); } } $email = Tools::safeOutput(Tools::getValue('from', ((isset($cookie) AND isset($cookie->email) AND Validate::isEmail($cookie->email)) ? $cookie->email : ''))); $smarty->assign(array( 'errors' => $errors, 'email' => $email )); Merci Link to comment Share on other sites More sharing options...
pakerou Posted February 28, 2011 Author Share Posted February 28, 2011 Voici la solution il faut ajouter exemple contact1 le nouveau nom de 2 tpl (il faut deux fichiers html et txt dans mails/fr) if (!Mail::Send(intval($cookie->id_lang), 'contact1', 'test', array('{email}' => $from, '{message}' => stripslashes($message)), $contact->email, $contact->name, $from, (intval($cookie->id_customer) ? $customer->firstname.' '.$customer->lastname : $from), NULL, NULL, dirname(__FILE__).'/mails/')) $error = $this->l('An error occurred during the process.'); else $confirm = $this->l('An email has been sent successfully to').' '.Tools::safeOutput($_POST['email']).'.'; } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now