twilight Posted September 1, 2009 Share Posted September 1, 2009 I get Invalid email error! each time i try to send an email to customer service or webmaster. I checked the admin panel and the email i have in there is typed in correctly. Please view the following "contact-us.php" code and show me what i'm doing wrong! Thanks!<?php $useSSL = true; include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/header.php'); $errors = array(); $smarty->assign('contacts', Contact::getContacts(intval($cookie->id_lang))); if (Tools::isSubmit('submitMessage')) { if (!($from = Tools::getValue('from')) OR !Validate::isEmail($from)) $errors[] = Tools::displayError('invalid e-mail address'); elseif (!($message = nl2br2(Tools::getValue('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}' => $_POST['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::getValue('from', ((isset($cookie) AND isset($cookie->email) AND Validate::isEmail($cookie->email)) ? $cookie->email : '')); $smarty->assign(array( 'errors' => $errors, 'email' => $email )); $smarty->display(_PS_THEME_DIR_.'contact-form.tpl'); include(dirname(__FILE__).'/footer.php'); ?> Link to comment Share on other sites More sharing options...
zefir Posted September 1, 2009 Share Posted September 1, 2009 Hi, I have the same issue. There is problem here. If setting with SMTP and your provider no allow relaying (which is currently very common option) you want be able to send email here. Link to comment Share on other sites More sharing options...
twilight Posted September 1, 2009 Author Share Posted September 1, 2009 Zefir - I tried this and it WORKED! Here’s the thread:http://www.prestashop.com/forums/viewthread/25370/general_discussion/contact_us_error_bug Link to comment Share on other sites More sharing options...
zefir Posted September 2, 2009 Share Posted September 2, 2009 Hi I know, that previous version will work - If you look into the code you will see that to email class is not sending any from params so it takes default configuration and then relaying won't be an issue cheers Link to comment Share on other sites More sharing options...
halalan Posted September 3, 2009 Share Posted September 3, 2009 I still believe its a BUG in the new contact-us.php file. Maybe someone with better PHP knowledge can compare the two file versions and see why one would work just fine and the other doesn;t and lets get the RIGHT ANSWER to fix it. If its just a paramater setting with ones HOSTING provider and is common, but the older file will work on the common setting, then it would seem 1) It should be maybe an option to decide with CONTACT-US.PHP file to use. Because in setting up the system the pre-chjeck test for the email WORKS...just not once you have your site up and try to use the CONTACT button to send. Link to comment Share on other sites More sharing options...
WATCH PHONE ONLINE Posted September 17, 2009 Share Posted September 17, 2009 Hi I know, that previous version will work - If you look into the code you will see that to email class is not sending any from params so it takes default configuration and then relaying won't be an issue cheers For me, no previous version replacing worked, so i've figured out the following and that finally works!In Mail.php class copy, paste and customize the following lines in Send(...) function:ini_set('SMTP', 'webmail.blahblah.xx');ini_set('smtp_port', '[YOUR SMTP PORT NUMBER]');ini_set('sendmail_from', '[first part of the mail - e.g. if the mail is [email protected] then put there only "name"]');that's it, this will manually set the smtp parameters.In the email config just set the option 'sending emais by php function' not smtp (i've tried but didn't worked).email.php is called each time when an email is being sent from any form of the PS.Hope this will help you. Link to comment Share on other sites More sharing options...
zefir Posted September 18, 2009 Share Posted September 18, 2009 For SMTP there is other problem.I reported it here with solution:http://www.prestashop.com/bug_tracker/view/2800/ Link to comment Share on other sites More sharing options...
exadra37 Posted September 19, 2009 Share Posted September 19, 2009 For SMTP there is other problem.I reported it here with solution:http://www.prestashop.com/bug_tracker/view/2800/ I put that line off code and the error stop to appear but i don´t receive any email in store account and also the clients don´t receive the status off the order.How can i resolve this? Link to comment Share on other sites More sharing options...
zefir Posted September 20, 2009 Share Posted September 20, 2009 Do you have correct (real settings) in contact settings? I mean email address you are using in contact form must exists on email server (for servers not allowing relaying) I mean in Admin panel: Settings->Contact? Also for contact form you need real email addresses: Employees->Contacts Link to comment Share on other sites More sharing options...
exadra37 Posted September 21, 2009 Share Posted September 21, 2009 Do you have correct (real settings) in contact settings? I mean email address you are using in contact form must exists on email server (for servers not allowing relaying) I mean in Admin panel: Settings->Contact? Also for contact form you need real email addresses: Employees->Contacts The email is the same for everything and exist in Gmail.I read somewhere that this problem is because i am testing in localhost and i don´t have the router configured to send and receive the emails by port 25 .... It is this true?Thanks Link to comment Share on other sites More sharing options...
paradate Posted October 19, 2009 Share Posted October 19, 2009 I had the same problem. I worked so hard. Finally I fixed it by changing the email address in the admin areaPreferences ---> Email:Instead of [email protected]I changed it to just: Support And it worked perffectly for me.[Link removed - Edit by Patric] Link to comment Share on other sites More sharing options...
Recommended Posts