Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / make a form to go to a different email address

make a form to go to a different email address

Started by rivs on 31 May 2012, 5:27 PM · Views: 860

Results 1 to 5 of 5
31 May 2012, 5:27 PM
#1
rivs avatar

rivs

New Zenner

Join Date:
Mar 2010
Location:
NY - Hudson Valley
Posts:
30
Plugin Contributions:
0

make a form to go to a different email address

Hi,

I've copied the contact form in order to make an additional and different type of form. It's all working well BUT... I need the form to go to a different email address than the original contact form.

Does anyone know how to hardcode for that? Currently the contact form goes to a drop down list (set in the Admin). Is there a way to delete the code from the new tpl_newform.php and just hard code an address or two?

Here are the 2 page areas that I think need help:

tpl_pagename_default.php

v<?php // show dropdown if set if (CONTACT_US_LIST !=''){ ?>
<label class="inputLabel" for="send-to"><?php echo SEND_TO_TEXT; ?></label>

<?php echo zen_draw_pull_down_menu('send_to', $send_to_array, 'id=\"send-to\"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?> <br class="clearBoth" /> <?php } ?>

header.php (for the new page)

// use contact us dropdown if defined
if (CONTACT_US_LIST !=''){
$send_to_array=explode("," ,CONTACT_US_LIST);
preg_match('/<[^>]+>/', $send_to_array[$_POST['send_to']], $send_email_array);
$send_to_email= eregi_replace (">", "", $send_email_array[0]);
$send_to_email= eregi_replace ("<", "", $send_to_email);
$send_to_name = preg_replace('/<[^]/', '', $send_to_array[$_POST['send_to']]);
} else { //otherwise default to EMAIL_FROM and store name
$send_to_email = EMAIL_FROM;
$send_to_name = STORE_NAME;
}

Maybe I'm way off?! :blink: Thanks.

1 Jun 2012, 6:47 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: make a form to go to a different email address

I showed someone how to do exactly that in this older thread: http://www.zen-cart.com/showthread.php?4855-custom-forms-data-collection
You'll see the discussion and if you follow it far enough you'll see exactly what you need to do.

The newer posts in that thread (last 6 months) have gotten quite off topic and unfortunately have nothing to do with the original question anymore. But the stuff before that will be useful to you.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Jun 2012, 6:56 PM
#3
rivs avatar

rivs

New Zenner

Join Date:
Mar 2010
Location:
NY - Hudson Valley
Posts:
30
Plugin Contributions:
0

Re: make a form to go to a different email address

DrByte:

I showed someone how to do exactly that in this older thread: http://www.zen-cart.com/showthread.php?4855-custom-forms-data-collection
You'll see the discussion and if you follow it far enough you'll see exactly what you need to do.

The newer posts in that thread (last 6 months) have gotten quite off topic and unfortunately have nothing to do with the original question anymore. But the stuff before that will be useful to you.

thank you Dr. Byte.

Here is what I did - it's working.

Defined in the incl/template/yourtemplatename/templates/tpl_newname_default.php

define('SEND_TO_ADDRESS','[email protected] ');
removed: define('SEND_TO_TEXT','Send Email To:');

modifed as follows in the includes/modules/pages/newpagename/header.php

// use contact us dropdown if defined
if (CONTACT_US_LIST ==''){
$send_to_array=explode("," ,CONTACT_US_LIST);
preg_match('/<[^>]+>/', $send_to_array[$_POST['send_to']], $send_email_array);
$send_to_email= eregi_replace (">", "", $send_email_array[0]);
$send_to_email= eregi_replace ("<", "", $send_to_email);
$send_to_name = preg_replace('/<[^]/', '', $send_to_array[$_POST['send_to']]);
} else { //otherwise default to EMAIL_FROM and store name - CHANGED TO SENDTOADDRESS and defined in credit_application.php
$send_to_email = SEND_TO_ADDRESS;
$send_to_name = STORE_NAME;
}

This seems to be working for my form. I had to mark the (CONTACT_US_LIST!='') to (CONTACT_US_LIST=='') in the above section because the site is using a list. This doesn't seem like the right way to do it, but it worked for me. If anyone wants to tell me the correct way to code this, it would be appreciated. Thanks!!

1 Jun 2012, 7:47 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: make a form to go to a different email address

You probably could have deleted that whole section of code and just kept this part: ```
$send_to_email = SEND_TO_ADDRESS;
$send_to_name = STORE_NAME;

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Jun 2012, 9:22 PM
#5
rivs avatar

rivs

New Zenner

Join Date:
Mar 2010
Location:
NY - Hudson Valley
Posts:
30
Plugin Contributions:
0

Re: make a form to go to a different email address

thanks! I'll try that.