Problem
The Webform module includes the ability to send notification and confirmation emails. In certain situations, a scheduled reminder email needs to be sent out to a submission's email recipient after the submission was completed and/or a draft saved. Scheduled emails could include reminders to complete a submission in draft or a simple reminder for upcoming event.
Solution
Extend the email handler to support scheduling the sending of emails based on a selected date and/or submission status. All sent emails will be logged and tracked.
Tasks
- Create new ScheduledEmailWebformHandler.
- Create WebformScheduledEmailProcessor service
- Setup webform_submission_log table.
- Update admin Handlers table (/admin/structure/webform/settings/handlers) to include cron property.
- Setup hook_cron processing.
- Write tests.
Implementation
SchedualedEmailHandler will provide settings for…
- Date (Element value, Created, Updated, Completed, or Custom) with +/- X days/hours. [date] [add/substract] [date interval]
- Status (Draft or Completed)
User interface changes
- Transaction log tab will be added to submissions.
- Admin settings will include number of emails to be sent per cron task.
- Handler admin listing will include cron setting.
API changes
- WebformHandlers will support optional cron method.
- WebformSubmissionStorage will support optional transaction logging.
- ScheduledEmailWebformHandler adds scheduling conditions to configuration options.
- HOOK_cron that calls cron method on WebformHandler plugins.
Data model changes
Transaction log table needs to be created.
@see #2854020: Provide a mechanism to log submission transactions
References
Related Issues
- Schedule send reminder email to take another survey
- Add rule for a webform checkbox to autosend email after specified time
- Using rules to send an email x days after a user registers
- How to Send Follow-Up Emails Using Rules Scheduler in Drupal 7
Related Projects
- Webform Mass Email
Provides a functionality to send mass email for the subscribers of a webform. - Scheduler
Gives content editors the ability to schedule nodes to be published and unpublished at specified dates and times in the future.
Other Form Builders
- FormStack: New Feature Release – Add Delayed Email Confirmations to Your Online Forms
- JotForm: How can i Auto send my forms on a given date
Test script
Setup
- Enable the webform_scheduled_email.module and webform_scheduled_email_test.module
- Go to the 'Test scheduled email' form (/admin/structure/webform/manage/test_handler_scheduled_email)
Check schedule and send.
- Check 'Yesterday' radio.
- Confirm 'Yesterday' email schedule. (admin/structure/webform/manage/test_handler_scheduled_email/handlers)
- Click 'Send now'
- Review submission log (/admin/structure/webform/manage/test_handler_scheduled_email/results/log)
- Confirm 'Yesterday' email was scheduled and sent.
Check schedule and unschedule
- Check 'Yesterday' radio.
- Confirm 'Yesterday' email schedule. (admin/structure/webform/manage/test_handler_scheduled_email/handlers)
- Delete the 'Yesterday' handler.'
- Review submission log (/admin/structure/webform/manage/test_handler_scheduled_email/results/log)
- Confirm 'Yesterday' email was scheduled and unsent.
Check broken/invalid date
- Check 'Broken' radio.
- Confirm email is not scheduled
Review other date variations.
- Check 'Tomorrow, ''Last Year', 'Other' radios.
- Confirm emails schedule.
| Comment | File | Size | Author |
|---|---|---|---|
| #48 | provide_a_handler_to-2854017-48.patch | 209.12 KB | jrockowitz |
| #45 | provide_a_handler_to-2854017-45.patch | 200.38 KB | jrockowitz |
| #39 | provide_a_handler_to-2854017-39.patch | 145.81 KB | jrockowitz |
| #37 | provide_a_handler_to-2854017-36.patch | 145.87 KB | jrockowitz |
| #34 | provide_a_handler_to-2854017-34.patch | 145.87 KB | jrockowitz |
Comments
Comment #2
jrockowitz commentedComment #3
jrockowitz commentedComment #4
anpolimusComment #12
jrockowitz commentedComment #15
jrockowitz commentedComment #16
jrockowitz commentedComment #23
jrockowitz commentedComment #26
jrockowitz commentedComment #30
jrockowitz commentedComment #31
jrockowitz commentedComment #34
jrockowitz commentedComment #37
jrockowitz commentedComment #39
jrockowitz commentedComment #45
jrockowitz commentedComment #48
jrockowitz commentedComment #50
jrockowitz commented