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…

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

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

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.

Comments

jrockowitz created an issue. See original summary.

jrockowitz’s picture

Title: Webform Scheduled Email Handler » Provide a handler to schedule the sending of emails
jrockowitz’s picture

Issue summary: View changes
anpolimus’s picture

Issue tags: +KyivCampCS17

  • jrockowitz committed eb4a2bc on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    

  • jrockowitz committed 71ac8e6 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    

  • jrockowitz committed 6fe0618 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    

  • jrockowitz committed 2bf83a9 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    

  • jrockowitz committed 7bd3d4e on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    

  • jrockowitz committed 2806b28 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    

  • jrockowitz committed a8b7086 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new79.49 KB

Status: Needs review » Needs work

The last submitted patch, 12: provide_a_handler_to-2854017-12.patch, failed testing.

  • jrockowitz committed 43ac128 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new90.74 KB
jrockowitz’s picture

Issue summary: View changes

  • jrockowitz committed 5e3db2c on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails
    

  • jrockowitz committed 2b33f55 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....

  • jrockowitz committed 0b0d2da on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....
  • jrockowitz committed f682102 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....

  • jrockowitz committed 911110e on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails. Add...

  • jrockowitz committed 1306957 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails. Add...

  • jrockowitz committed f4874c7 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....
jrockowitz’s picture

StatusFileSize
new235.93 KB

Status: Needs review » Needs work

The last submitted patch, 23: provide_a_handler_to-2854017-23.patch, failed testing.

  • jrockowitz committed a3c6fa2 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new235.94 KB

  • jrockowitz committed 78978d9 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....

  • jrockowitz committed 2649bad on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....

  • jrockowitz committed 4992324 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....
jrockowitz’s picture

StatusFileSize
new250.04 KB
jrockowitz’s picture

StatusFileSize
new136 KB

Status: Needs review » Needs work

The last submitted patch, 31: provide_a_handler_to-2854017-31.patch, failed testing.

  • jrockowitz committed 13d6ace on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new145.87 KB

Status: Needs review » Needs work

The last submitted patch, 34: provide_a_handler_to-2854017-34.patch, failed testing.

  • jrockowitz committed 0307bab on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new145.87 KB

Status: Needs review » Needs work

The last submitted patch, 37: provide_a_handler_to-2854017-36.patch, failed testing.

jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new145.81 KB

  • jrockowitz committed b3d9eff on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails....

  • jrockowitz committed 0672104 on 2854017-scheduled-emails
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...

  • jrockowitz committed be685b7 on 2854017-scheduled-emails
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...

  • jrockowitz committed 6910453 on 2854017-scheduled-emails
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...
  • jrockowitz committed 8ddbeb8 on 2854017-scheduled-emails
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...

  • jrockowitz committed d82e796 on 2854017-scheduled-emails
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...
jrockowitz’s picture

StatusFileSize
new200.38 KB

  • jrockowitz committed 6860d8a on 2854017-scheduled-emails
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...

  • jrockowitz committed ca2d71a on 2854017-scheduled-emails
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...
jrockowitz’s picture

StatusFileSize
new209.12 KB

  • jrockowitz committed 3af0219 on 2854017-scheduled-emails
    Issue #2854017: Provide a handler to schedule the sending of emails.
    
jrockowitz’s picture

Status: Needs review » Fixed

  • jrockowitz committed c71035c on 8.x-5.x
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...

  • jrockowitz committed 45a2260 on 8.x-5.x
    Issue #2854017 by jrockowitz: Provide a handler to schedule the sending...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.