Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 607101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:19:27+00:00 2026-05-13T17:19:27+00:00

I’m using Prestashop as my ecommerce shopping cart and CMS solution and was having

  • 0

I’m using Prestashop as my ecommerce shopping cart and CMS solution and was having problems receiving emails sent via the contact form. I asked around and found the problem to be due to the fact that I need to assign the ‘from’ address as something from my domain (e.g. do_not_reply@mydomain.com) and the email entered by user to be assigned a different variable (e.g. ‘replyemail’).

However, the Prestashop contact form is created with a PHP Smarty template engine, which has separate contact-form.php file and a separate contact-form.tpl which I am displaying below.
Firstly contact-form.php:-

<?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::safeOutput(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');

?>

Next is the code for the file contact-form.tpl:-

{capture name=path}{l s='Contact'}{/capture}

{include file=$tpl_dir./breadcrumb.tpl}



<h2>{l s='Contact us'}</h2>



{if isset($confirmation)}

    <p>{l s='Your message has been successfully sent to our team.'}</p>

    <ul class="footer_links">

        <li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li>

    </ul>

{else}

    <p class="bold">{l s='For questions about an order or for information about our products'}.</p>

    {include file=$tpl_dir./errors.tpl}

    <form action="{$request_uri|escape:'htmlall':'UTF-8'}" method="post" class="std">

        <fieldset>

            <h3>{l s='Send a message'}</h3>

            <p class="select">

                <label for="id_contact">{l s='Subject'}</label>

                <select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">

                    <option value="0">{l s='-- Choose --'}</option>

                {foreach from=$contacts item=contact}

                    <option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>

                {/foreach}

                </select>

            </p>

            <p id="desc_contact0" class="desc_contact">&nbsp;</p>

        {foreach from=$contacts item=contact}

            <p id="desc_contact{$contact.id_contact|intval}" class="desc_contact" style="display:none;">

            <label>&nbsp;</label>{$contact.description|escape:'htmlall':'UTF-8'}</p>

        {/foreach}

        <p class="text">

            <label for="email">{l s='E-mail address'}</label>

            <input type="text" id="email" name="from" value="{$email}" />

        </p>

        <p class="textarea">

            <label for="message">{l s='Message'}</label>

             <textarea id="message" name="message" rows="7" cols="35">{if isset($smarty.post.message)}{$smarty.post.message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea>

        </p>

        <p class="submit">

            <input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button_large" />

        </p>

    </fieldset>

</form>

{/if}

Does anyone have any idea how I can adjust this contact form in order to assign the from address of my choice (e.g. do_not_reply@mydomain.com) and hopefully this email form would start working for me. If this ‘from’ address is stored somewhere else, can anyone see where it might be stored or where it is refering to in the code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:19:27+00:00Added an answer on May 13, 2026 at 5:19 pm

    If this ‘from’ address is stored somewhere else, can anyone see where it might be stored or where it is refering to in the code?

    I can’t tell from the code, but my strong guess would be this file:

    include(dirname(__FILE__).'/config/config.inc.php');
    

    Edit:

     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)))
    

    I can’t look closely into the code right now, but replacing either

    '{email}' => $_POST['from']
    

    or

    $from
    

    by

    '{email}' => 'whatever_you_want'
    

    or

    'whatever_you_want'
    

    might do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.