Custom rake task for package expiration reminder on Faspex

Rake tasks are scripts that allow you to retrieve, delete or update information on your Faspex server using the command line. This article describes a custom rake task available for sending email reminders to users about package expirations.

Please note that you must install this rake task as it is not yet included by default on Faspex. For more information on custom rake tasks and how to install them, see this article (Custom rake tasks on Faspex).


This rake task allows you to send an email reminder to users that their packages are going to expire in a certain number of days. The package expiration time in days is set on the Faspex web interface on the Server page, in Configuration > Package Storage. Users need to download packages before the expiration date, after which they will no longer be accessible.The syntax for this rake task is as follows:

asctl faspex:rake custom:send_expiration_reminder -- [options]

The available options are the following:

short form long form description
  --email_text_body=file file containing desired email text body
  --email_html_body=file file containing desired email html body
-ssubject --subject=subject email subject
-fuser --from=user user that the email reminder is from (required)
-ddays --days=days
days before expiration
-t --testmode performs a user/package lookup but does not send the email
-c --chatty print more information on stdout
-h --help print out help information for this rake task

By default the rake task sends email reminders for any package set to expire in 7 days, but you can change the number of days with the -d option. The --from option is required and specifies the user account that the email reminder is from, which should generally be an admin account.

The email is sent with a preset reminder message, but you can also use a custom message of your choice by passing in a text or html file to the rake task. The message can also contain the following variables for substitution (see the example below for how to use them):

  • @receiver_user
  • @package_name
  • @package_url
  • @package_expiration_date


To send a reminder email for all packages set to expire in 4 days from the admin user aspera, you would run the following:

asctl faspex:rake custom:send_expiration_reminder -- --from=aspera -d4

Example output:

Finding all completed packages uploaded between 2015-07-12 23:59:59 -0700 and 2015-07-16 23:59:59 -0700

Elaborating results 1
Emailing for package

To send a reminder email with a custom message of your own located at /tmp/reminder.txt, you would use the following: 

asctl faspex:rake custom:send_expiration_reminder -- --from=aspera --email_text_body=/tmp/reminder.txt

Below is an example of what the contents of reminder.txt could look like, which uses variable substitution:

Hello <%= h @receiver_user %>,

Please note that your package <%= h @package_name %> is expiring soon! You will need to download this package before
<%= h @package_expiration_date %>, otherwise you will no longer be able to access it.

Download the package now at <%= h @package_url %>

XYZ Corp


Article is closed for comments.
Powered by Zendesk