Version: current

     1 <?php
     2 /**
     3  * Stores a queued email to be sent at the given time
     4  * @package sapphire
     5  * @subpackage email
     6  */
     7 class QueuedEmail extends DataObject {
     8
     9     static $db = array(
    10         'Send' => 'SS_Datetime',
    11         'Subject' => 'Varchar',
    12         'From' => 'Varchar',
    13         'Content' => 'Text'
    14     );
    15
    16     static $has_one = array(
    17         'To' => 'Member'
    18     );
    19
    20     static $has_many = array();
    21
    22     static $many_many = array();
    23
    24     static $defaults = array();
    25
    26     // overwrite this method to provide a check whether or not to send the email
    27     function canSendEmail() {
    28         return true;
    29     }
    30
    31     function send() {
    32         $email = new Email( $this->From, $this->To()->Email, $this->Subject, $this->Content );
    33         $email->send();
    34     }
    35 }
    36 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -