I have a form that asks for the usual info... including email.
I want to send an email immediately to the posted email from the form... but for some reason I CANNOT strip the just posted email field.
I even tried: <? php echo $_POST["email"]; ?> in the "Confirmation message or redirect URL" section, even in the "Additional Validation" and "Additional Processing", but NO luck!
What am I missing here?
I planned to do a basic drupal_mail() function call as the email delivery within the Confirmation Message area.
Ideally I would love for this to be an option within the module directly, but in the meantime... HOW do I do this... I am hitting my head on this completely.
I appreciate any help.
Comments
Comment #1
quicksketchThere are a couple things you might try:
- If you just want to send a receipt-like e-mail to the user, use the "Conditional e-mail recipients" options directly underneath the e-mail field for the webform. Use the checkbox next to the e-mail component you have in your form to have the user receive an e-mail containing the values of the submission.
- You won't be able to access any $_POST data in the confirmation message box, because Webform will have already done a redirect before the code is executed, so $_POST will not contains any values.
- So if you need to do a manual drupal_mail(), the Additional processing field is the proper place for such code. While $_POST should be available there, you can also use the $form_values array that is available there to actually affect the values that are saved to the database. The Webform handbook pages contain a few examples of how to use/access the variables in this field: http://drupal.org/handbook/modules/webform.
Comment #2
quicksketchAlso... using "echo" in the additional processing or validation code will not output anything to the screen, as this code is executed via the eval() function. So all output is disregarded. You should install the devel module and use the dsm() or dvm() functions, that will print out messages in the Drupal message area.
Comment #3
neofactor commentedThanks for the suggestions...
I am trying to send them an email with some info that is not part of the initial provided form info.
I have read the help section and that is not doing it for me.
Can you give me the PHP snippet to display "email" within the "Confirmation message or redirect URL" section? I am at a loss.
Thanks.
Comment #4
metastate commentedI also need to send a confirmation email to the user that submitted the form (using webform version 5.x-2.1.1). I have been trying to use the drupal_mail() function in the additional processing field, but I can't quite get it to work properly.
Multiple copies of the email are being sent and the email fields are mixed up: the from info in the "header" is being used for the "to" field, the "message" is being used for the "from" field, and the "subject" is being used for the "message" body.
The code I am using:
I am sure there is an obvious mistake to anyone with more php/drupal api knowldege than me, but I am stumped. Any advice would be much appreciated!
Comment #5
quicksketchYou've got your parameters all mixed up. See http://api.drupal.org/api/function/drupal_mail/5
So what you need is:
Comment #6
Richard_1618 commentedThis code doesn't seem to work with 6.x no email is being sent to users submitting / posting a webform, please can someone tell me what i'm doing wrong
Is it possible to take more than just the email into additional procession (eg. email, title, full name, form title)
so email sent to users who use a web form get a response immediately saying Dear %title, %full_name thank you for submitting your form/request %form_name
please click here to validate your form/request $L:KJFSD:IJ#@OITJ@$O:IEGJ@HFSDLFKJ
Comment #7
quicksketchI think Drupal 6 requires basically 2 entirely separate functions, making using drupal_mail() rather difficult in a one-off scenario. You'll be better off using PHP's built-in mail() function.
Comment #8
Richard_1618 commentedThank you,
Could I please as you for more information as to where i start, I am really bad with code snippets and having a nightmare with sorting this out,
Just an email notification would be brilliant to send to people after submitting a webform in 6.x
Comment #9
Richard_1618 commentedPLEASE HELP !!!!
I've spent almost 24 hours straight on getting this right. Drupal 6.x to get the email value posted by a user in the webform submission and send an email as a simple thank you message - never mind anything else, there are plenty of articles posted on 5.x answered but none finnished on 6.x
Should i reinstall and go back to 5.x
Comment #10
metastate commentedActually, I haven't been able to get this to work in 5.x either. No email is being sent. Haven't had much time to troubleshoot yet so am not sure if this is an issue with my server or something else. I will try using the PHP mail function instead and see how that goes.
I am also considering going the theming route quicksketch mentions here: http://drupal.org/node/239792#comment-787643.
Any suggestions out there on the best way to send two seperate emails (different content) upon submission of a webform: one to the site admin and one to the user? Additional processing or theming or ??
Comment #11
metastate commentedNo idea why I didn't find this until today: #231520: How do you send different themed emails to different email addresses?.
Looks promising! The theming route I shall go...
Comment #12
kairu commentedHi,i want my users to be sending each other msgs, they can see the user names but no email address in the details, i want a code which can search the email from the db related to the user name given and send a msg to that email address.
Anyone with such a code, pliz help....
Comment #13
buddaI've got an auto response module add-on for webform.module - working/done. See http://drupal.org/node/327153
Currently the module is for 5.x
Comment #14
quicksketchClosing after lack of activity. @kairu Webform is not a messaging system, look at Private Messages module.