Changing email subject and email address?

Current Version: 1.3.4-sp3



One thing that has always bugged me is that when a customer emails me through the contact us form, the subject is always “Contact Us”, rather than the subject name they give on the form. Anyone know how to change this? I did a search and found a solution for a later version of CS-Cart, but that directory doesn't exist on my older version and I can't upgrade at the moment. Help!



Also, is it possible so that the customers email address is shown in its raw form, rather than it showing my sites name? Help!

The subject could be changed, but if you change the 'From' address then any respectable mail system will reject it as spam because it's coming from your site but the message envelope says it's from somewhere else.

Thanks, so how can I change the subject field in the email to the subject title the customer inputs on the form? If I can find the correct php/tpl file I'm sure I can figure it out.

It's been awhile but if I recall, you need to look in /addons/form_builder/. If I have time later, I will look for it and post it.

[quote name='The Tool' timestamp='1328785334' post='130889']

It's been awhile but if I recall, you need to look in /addons/form_builder/. If I have time later, I will look for it and post it.

[/quote]



Yeah, that is what I thought, but there isn't such a directory on the older version that I can see. If you find it, I'd appreciate you letting me know.

Wow! I haven't looked at 1.3.5 code in years!



Yep, it's completely different back in them days. It looks like it's a universal set up and they are using the form title for the subject.

Oops, Update: Didn't see the prior posts referring to 1.x… This applies to 2.x only…



go look around in addons/form_builder/func.php



I'm sure you'll find where the subject gets built in fn_form_send() or some subroutine it calls. I'd suggest you use the format of

FormName: Customers subject



So it might look like:

Contact Us: Where's my product?

I don't have a addons/form_builder/func.php directory/file unfortunately. Any ideas if it would likely be in the admin, customer or mail section? At least then I can focus my search. The contact us form must be embedded somewhere, I've just got to find it!

Like I said previously, it seems to be universal and and uses the form title so if you modify it, any and all forms will use the same method.



/skin/your_skin/mail/forms/form_subject.tpl

[quote name='The Tool' timestamp='1328865918' post='131001']

Like I said previously, it seems to be universal and and uses the form title so if you modify it, any and all forms will use the same method.



/skin/your_skin/mail/forms/form_subject.tpl

[/quote]



As far as I'm aware, I only use a contact us form, no other, but don't know if changes to this would also affect the order confirmation mails too?



The code in the form_subject.tpl file is:



{*$Id: form_subject.tpl 1044 2005-12-21 09:03:06Z zeke $*}
{$form_title}




Can this be edited to suit a request to take something else?

Just guessing…


{$form_description}

or maybe

{$form_subject}

I can change it to the company name followed by the contact us message as follows:



{$settings.Company.company_name} - {$form_title}




But I just can't find the relevant code for using the customers entered subject. Using the debugger I can find it in the elements code but that isn't the right bit, and I can't find the physical form used for sending the information to see what the code would be.



Any further thoughts from anyone?

Look at the corresponding form (the body of the message) and then use the variable you want from there. The same template variables are available to the subject as the body of the message.

Can't seem to find the correct viable; can you spot it from within the form_body.tpl file:


```php

{* $Id: form_body.tpl 2644 2006-12-12 13:43:33Z zeke $ *}



{include file=“letter_header.tpl”}


{foreach from=$elements key=element_id item=element}
{if $element.element_type == 'D'}



{elseif $element.element_type == 'H'}



{else}




{/if}
{/foreach}

{$element.description}
{$element.description}: 
{assign var="value" value=$elements_values.$element_id}
{if $element.element_type == 'S' || $element.element_type == 'R'}
{$element.variants.$value.description}
{elseif $element.element_type == 'C'}
{if $value == 'Y'}{$lang.yes}{else}{$lang.no}{/if}
{elseif $element.element_type == 'M' || $element.element_type == 'N'}
{foreach from=$value item=v name="fe"}{$element.variants.$v.description}{if !$smarty.foreach.fe.last}, {/if}{/foreach}
{elseif $element.element_type == 'I' || $element.element_type == 'T' || $element.element_type == 'Y' || $element.element_type == 'Z' || $element.element_type == 'P'}
{$value}
{elseif $element.element_type == 'V'}
{0|mktime:0:0:$value.Date_Month:$value.Date_Day:$value.Date_Year|date_format:$settings.Appearance.date_format}
{elseif $element.element_type == 'Y' || $element.element_type == 'Z' || $element.element_type == 'P'}

{elseif $element.element_type == 'X'}
{$value|fn_get_country_name}
{assign var="c_code" value=$value}
{elseif $element.element_type == 'W'}
{assign var="c_code" value=$c_code|default:$settings.General.default_country}
{assign var="state" value=$value|fn_get_state_name:$c_code}
{$state|default:$value}
{/if}

{include file="letter_footer.tpl"}
```

Tried {$element.description} and {$value.description} but neither work?

don’t you just love cs-cart template coding? :-)



I’d probably catch the POST of the form in addons/my_changes/controllers/pages.post.php.

I’d look at the _REQUEST variables and find the appropriate one related to the field you want to append to the subject.

I’d then simply set my own variable name for the subject extension like ‘my_sub_info’ to be the value of that request field.

Then modify the subject template to add that variable name to the subject field.

Sorry, I didn't quite understand your instructions, I can't find an addons/my_changes folder, nor do I know from the code above which command is for the subject field completed by the customer?

What version of the cart are you running?

An oldie:



Current Version: 1.3.4-sp3

Sorry, but I have very little experience with pre 2.0.x cs-cart. My brain can only retain so much…