Forums / General Questions / 2 emails sent from "contact us page"

2 emails sent from "contact us page"

Locked

Views: 1,546

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
1 Mar 2007, 10:37 AM
#1
magicpants avatar

magicpants

Zen Follower

Join Date:
Aug 2005
Posts:
314
Plugin Contributions:
0

2 emails sent from "contact us page"

We need to figure out a way to have emails sent from customers from our "contact us" page to be sent to two email addresses. I know there's currently the dropdown method, but that doesn't work into our design.

I could even hardcode it for now, if that's easier. I looked through the admin side and was surprised to not see an option for this. One issue is we don't want this second email to be visible to the customer.

Anybody know of a way to do this?

Currently using ZEN CART v. 1.3.6

2 Mar 2007, 12:41 AM
#2
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: 2 emails sent from "contact us page"

This addon can be easily customized from your includes/modules/<your_template>/pages/contact_us/header_php.php file. :wink2:

2 Mar 2007, 1:05 AM
#3
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: 2 emails sent from "contact us page"

Since I liked it, I coded it for you. In the mentionned file above,

find :

zen_mail($send_to_name, $send_to_email, EMAIL_SUBJECT, $text_message, $name, $email_address, $html_msg,'contact_us');

add below:

$customer_forward_id = 1 // Change the ID number to whom the email messages should be forwarded too.

    $forward_email_query = "

    SELECT customers_id, customers_firstname, customers_lastname, customers_email_address
    FROM " . CUSTOMERS_TABLE . "
    WHERE customers_id = " . $customer_forward_id;

    $forward_customer = $db->perform($forward_email_query);

    while (!$forward_customer->EOF) {
    $customer_forward_name = $forward_customer->fields['customers_firstname']. $forward_customer->fields['customers_lastname'];
    $customer_forward_email = (preg_match('/\<[^>]+\>/', $forward_customer->fields['customers_email_address'])) ? $forward_customer->fields['customers_email_address'] : EMAIL_FROM;
    } // End of while statement.

    zen_mail($customer_forward_name, $customer_forward_email, EMAIL_SUBJECT, $text_message, $name, $email_address, $html_msg,'contact_us');

Then, make sure to modify the forwarded's customer ID from this line (first - to see if it works as expected) :

$customer_forward_id = 1 // Change the ID number to whom the email messages should be forwarded too.

Change '1' to the targeted forwarder's ID you wish to forwards your emails. :wink2:

2 Mar 2007, 1:41 AM
#4
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: 2 emails sent from "contact us page"

Slight mistake.

From my codes above,

replace:

$customer_forward_id = 1; // Change the ID number to whom the email messages should be forwarded too.

    $forward_email_query = "

    SELECT customers_firstname, customers_lastname, customers_email_address
    FROM " . CUSTOMERS_TABLE . "
    WHERE customers_id = " . $customer_forward_id;

 $forward_customer = $db->Execute($forward_email_query);
2 Mar 2007, 2:49 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 2 emails sent from "contact us page"

Wouldn't it be easier to just setup an email for this in your control panel and forward it to whoever needs to receive the Contact Us if you need more than one email address at a time recieving the email?

This would work for both the single emails and dropdown emails and you can easily add on more ane more of them as needed ... :smile:

And voila ... no coding required ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

2 Mar 2007, 7:55 AM
#6
magicpants avatar

magicpants

Zen Follower

Join Date:
Aug 2005
Posts:
314
Plugin Contributions:
0

Re: 2 emails sent from "contact us page"

Thank you The Oracle! That's a very nice surprise -- thought I'd just get tipped in the right direction, thanks for actually putting it together. :happy:

I got an error though when i try to send a test email from the contact us page -- it looks like a simple fix is needed, but I haven't figured it out yet:

1146 Table 'hh4.CUSTOMERS_TABLE' doesn't exist
in:
[ SELECT customers_firstname, customers_lastname, customers_email_address FROM CUSTOMERS_TABLE WHERE customers_id = 1]

hh4 is the name of my database. i'm gonna keep trying to fix it myself, i'll post if i got it. otherwise, please let me know.

Currently using ZEN CART v. 1.3.6

2 Mar 2007, 9:10 AM
#7
magicpants avatar

magicpants

Zen Follower

Join Date:
Aug 2005
Posts:
314
Plugin Contributions:
0

Re: 2 emails sent from "contact us page"

Okay, that wasn't too hard: CUSTOMERS_TABLE should be TABLE_CUSTOMERS

Made that change, but now I get this when trying to send a test mail:

Fatal error: Maximum execution time of 30 seconds exceeded in /www/catalog/includes/modules/pages/contact_us/header_php.php on line 79

The normal email is received, but the forwarded mail doesn't arrive because it just hangs.

Currently using ZEN CART v. 1.3.6

2 Mar 2007, 11:32 AM
#8
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: 2 emails sent from "contact us page"

If you check your mail error logs, under your cPanel, what does it report ?

2 Mar 2007, 4:04 PM
#9
magicpants avatar

magicpants

Zen Follower

Join Date:
Aug 2005
Posts:
314
Plugin Contributions:
0

Re: 2 emails sent from "contact us page"

I don't have cPanel or plesk -- trying to figure out how to get access to our mail error logs now. I've contacted our webhost and will wait for a reply.

Currently using ZEN CART v. 1.3.6