title: How do I delay sending mails with PHPMailer for multiple days?
body: <p>I'm trying to create a mailing system for our library. People receive an e-mail when they requested a book. However, I want them to receive an e-mail one day before the hand-in date as well.</p>
  
  <p>So I'm not looking for a sleep script code, I'm looking for a code that can maybe store the data on the server until the hand-in date arrived.</p>
  
  <p>I'm using Joomla 3.5.1 for our website, this is the code for the PHPMailer:</p>
  
  <pre><code>jimport('joomla.mail.mail');
  
  try{
  $mail             = new PHPMailer();
  
  $body             = $mailmsgadmin;
  
  $mail-&gt;IsSMTP(); // telling the class to use SMTP
  $mail-&gt;Host       = "example.host.com";         // SMTP server
  $mail-&gt;SMTPDebug  = 2;                      // enables SMTP debug information (for testing)
                                              // 1 = errors and messages
                                              // 2 = messages only
  $mail-&gt;SMTPAuth   = true;                   // enable SMTP authentication
  $mail-&gt;SMTPSecure = "ssl";                 // sets the prefix to the servier
  $mail-&gt;Host       = "example.host.com";         // sets the SMTP server
  $mail-&gt;Port       = 25;                    // set the SMTP port for the GMAIL server
  $mail-&gt;Username   = "email"; // SMTP account username
  $mail-&gt;Password   = "password";         // SMTP account password
  
  $mail-&gt;SetFrom('email', 'First Last');
  
  $mail-&gt;AddReplyTo($mailuseremail, $mailusername);
  
  $mail-&gt;Subject    = $mailsubject;
  
  $mail-&gt;AltBody    = "To view the message, please use an HTML compatible email viewer!";
  
  $mail-&gt;MsgHTML($body);
  
  $mail-&gt;AddAddress("Users e-mail","Users name");
  
  if(!$mail-&gt;Send()) {
    JError::raiseWarning( 'SOME_ERROR_CODE', $mail-&gt;ErrorInfo);
  }
  } catch (Exception $e) {JError::raiseWarning( 'SOME_ERROR_CODE', $e-&gt;getMessage());}
  </code></pre>