Coder Social home page Coder Social logo

helpfulrobot / sunnysideup-email-reminder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sunnysideup/silverstripe-email_reminder

0.0 2.0 0.0 27 KB

Module for the Silverstripe CMS. Sends a reminder to users when their membership (or similar) is about to expire.

License: Other

PHP 86.79% Scheme 13.21%

sunnysideup-email-reminder's Introduction

Member Reminder System

This module sends out reminders for Members (users) to renew their membership (or similar).

You can create zero to many reminders that go out to each member as customised emails.

This is done by running a daily task that checks which users are about to expire and emails them a reminder.

You can set up as many reminders as you like - e.g. 10 days before, 5 days before, etc...

Daily task

A daily task can run through all the users to check who needs a membership. You will need to set this up using a cron job or similar.

Model

  • EmailReminder_NotificationSchedule:
    • Days before / after experiation to run
    • Template to be used for mail out.
    • Message (HTML)
    • Number of days lee-way a message can have - i.e. if the message is not sent exactly on the day it is supposed to then the system have up to n number of days to send it.
    • MANY_MANY: Members: if any Users are listed here, the task will send the reminder to these test users instead of the actual users that need to receive it. For these test users, the expiry date will be ignored (i.e. they test users will get the email every time)
    • Date field to use: date fiels are automatically selected from the Member class and using the field_labels config for Member, the meaningful name for the field is shown here (e.g. Created, LastEdited, ExpiryDate.
  • EmailReminder_EmailRecord:
    • One for each notification for each member. This helps us ensure that no emails are sent twice.

Other classes

  • EmailReminder_DailyMailOut
  • EmailReminder_Mailer extends Mailer so that we can add change the content of the email (e.g. replace tags) before sending it.

Email Formatting

We use the emogrifier class to make sure the email looks as it was designed. Emogrifier places CSS inline from a CSS file. This CSS file can be set in the configs.

At the same time, we also replace a bunch of common links in the email content:

  • [PASSWORD_REMINDER_LINK]
  • [LOGIN_LINK]
  • [DAYS_TO_EXPIRATION]: for days past expiration it wil return the absolute integer (e.g. expired ten days ago should be -10 but is shown shown as 10).

You can also set up zero to many custom replacers e.g.

  • [RENEW_MEMBERSHIP_LINK] using a custom class.

The replacement is shown with the HTML editor of the message, so that the editor knows how to use it and what to expect.

If you add [PASSWORD_REMINDER_LINK] to your message then this becomes: password reset (linking to the page where you can reset password) Behind the scenes we replace the placeholder with a link link this: <a href="Security/lostpassword">password reset</a>. The password reset phrasew can be edited in the lang* file`

The HTML of the email can also be set in the custom template file for the email.

Slow Down and Security

The system will only ever send n mails per day (see configs). This is to ensure that we don't accidentally spam all our users due to some sort of bug / glitch. In the CMS, you can view the EmailReminder_EmailRecord records to make sure emails are being sent correctly. These can be found under the Security tab in the CMS, as well as being shown with each member.

Inspiration / Ideas

Setting up a Cron job

The task to run is dev/tasks/EmailReminder_DailyMailOut. A few things to remember:

  • theme-ing may not work / work differently from command line
  • In the EmailReminder_NotificationSchedule you can set up test emails.
  • Not sure how to set up a cron job? Google it.

sunnysideup-email-reminder's People

Contributors

sunnysideup avatar axllent avatar

Watchers

James Cloos avatar helpfulrobot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.