Zen Cart Logo
Forums / Contribution-Writing Guidelines / Notifier for Contact Us Email?

Notifier for Contact Us Email?

Views: 2,150

Results 1 to 2 of 2
18 May 2014, 10:30 PM
#1
jsquared avatar

jsquared

New Zenner

Join Date:
Dec 2005
Location:
Kalamazoo, MI
Posts:
65
Plugin Contributions:
0

Notifier for Contact Us Email?

Hello. I'm trying to create an add-on that will grab the contents of a submitted Contact Us form and post it to an external API. I see notifiers for sending generic emails but not one for this form. But the list in the wiki also seems to be from a slightly older version. Is there a notifier that'll do what I need or a more current list? I know I could modify the script directly but thought a notifier would be a cleaner way to implement.

19 May 2014, 4:02 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Notifier for Contact Us Email?

A couple options:

If you want to do your API call before any processing of the submitted data takes place, use the 'NOTIFY_HEADER_START_CONTACT_US' hook. Do keep in mind that that hook point doesn't know whether the form has been submitted or not; it'll fire even when the contact page is merely being drawn, so you'll have to check for presence of POST data and do all your own validation before doing your API call.

Or you could fire on 'NOTIFY_EMAIL_AFTER_SEND_WITH_ALL_PARAMS' which receives an array of parameters based on the data used to prepare the email. You'll want to check the $module parameter and fire only when it's equal to 'contact_us'. The array is: array($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $email_html, $text, $module, $ErrorInfo))