I need to write my first module to send a confirmation email to the user who filled out a webform on my site. From what I've read, I can't extend webform with 'additional processing' by adding php code to do this. (which I understand the danger)
So what I'm attempting to do in my_module is (in psudo code, cause the real stuff aint working)
First add a hidden field in the webform called send_email that is a boolean set to true.
1. hook into the form_submit hook.
2. grab all the values of the form fields I want to email.
3. Build an email with the values
4. if the send_email is true, call the send function.
I have tried to hook into the submit hook, but I can't seem to get a value for variables I'm (trying) to get. It may be a scoping issue, not sure. I've been going at this for a while, and am thinking I'm not the only one who has faced this issue. Anyone have a working example they'd like to share?
Point me in the right direction?
Thanks in advance for any help!
Dan
Comments
Have you considered sending
Have you considered sending an email using Emails sub-tab underneath the Webform tab.
Its easy the steps are-
1) In the "Form components" subtab, add three components: "Example First Name" (type: textfield), "Example Last Name" (type: textfield), and "Example Email Address" (type: email). For this example, mark them all as "Mandatory" (although I don't think that setting is required for confirmation emails).
2)Check out the "E-mails" subtab. See how the "Component value:" dropdown now displays "Example Email Address" as an option? Leave that selected, and click on the "Add" button to the right.
3)On the next page, you can define the email header and body, as I'm sure you've seen before. Note at the top, however, the E-mail to address: field, which still has your "Example Email Address" component selected. This means that the confirmation email will be sent to the email address that is entered in the Example Email Address form field upon submission.
4)Now click the "View" tab and try out your form: Enter an example name and a real email address, submit, and check to see if you receive the Webform-generated confirmation email.
I had a FEELING I was over complicating things!
Ayush-
Thanks for the help! I totally breezed past that part, and assumed it was something to add to the 'extra processing' area. Then when I found out we can't use that anymore, I started looking at making a module...
Well I got off the path just as quickly as you helped me back!
Lesson learned .
Thanks again, this Drupal thing is pretty cool!
Dan
Define Headers
Ayush, I'm using webform 2x and don't see an option to define the headers as you mentioned in step 3. Are those options on the page for editing the webform?
Everything I have configured
Everything I have configured as you mentioned in your comment. But not getting any email for subimtter.
Thanks and Regards
ARUN AK
www.developersdocs.com
Webform Confirm Email Address Module
Have you tried this - https://www.drupal.org/project/webform_confirm_email Works for me, without complicating or coding stuff.
Sending Confirmation email from webform to the submitter
when I found out we can't use that anymore, I started looking at making a module...
Well I got off the path just as quickly as you helped me back!