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 deleting contacts saved on user accounts.
Contacts are email addresses saved to a user’s contact list when users send a package to them. The list of contacts for a user can be viewed and removed from the Account link on the top right, under the Edit Contacts tab. Note that the contacts feature is only available when admins allow packages to be sent to external email addresses (email addresses not associated to a Faspex account) or when the Faspex user directory has been made private.
You can delete all the contacts belonging to a user with a rake task. The syntax is the following:
asctl faspex:rake custom:delete_user_contact -- [options]
|short form||long form||description|
|-uusername||--username=username||report file (required)|
|-femail_filter||--email_filter=email_filter||number of days covered by report (default: 7)|
|-h||--help||print out help information for this rake task|
You must specify the username of the account you’d like to clear the contacts for. By default the rake task deletes all the contacts belonging to the user, but you can use the email_filter option to define a string so that only emails that contain it will be deleted.
To delete the contacts matching the example.com domain for the user janedoe, you would use the following:
asctl faspex:rake custom:delete_user_contact -- --username=janedoe --email_filter=example.com
Below is an example of what the output could look like:
Removing contact firstname.lastname@example.org
Removing contact email@example.com
Removing contact firstname.lastname@example.org