Mail those more than six months inactive users of your Mastodon server and delete them from your database if they don't reply after 30 days of receiving this warning email.
Go to file
2020-01-13 13:56:11 +01:00 Added three columns to database's table 2019-12-05 12:56:22 +01:00 Updated 2020-01-13 13:50:42 +01:00
LICENSE.txt Added LICENSE.txt 2019-11-30 15:42:24 +01:00 Delete from DB already deleted users from Mastodon 2019-12-05 13:21:25 +01:00 Updated with information 2020-01-13 13:56:11 +01:00
requirements.txt Added requirements.txt 2019-11-30 15:31:19 +01:00 Added to delete them 2020-01-13 13:47:23 +01:00


Mail your Mastodon server inactive users and track their feedback.

This code written in Python get all more than a year inactive users from Mastodon's database and email them with the subject and message of your choice. Then, inactive users data is stored into new created Postgresql database to track feedback and status. Run periodically to catch 'new' inactive users and update the elapsed days of the already emailed ones.


  • Python 3
  • Postgresql server
  • Mastodon server (admin)
  • Everything else at the top of!


Within Python Virtual Environment:

  1. Run '' to set database parameters and create needed database and table. All collected data of inactive users (see point 3) will be written there.

  2. Run '' to set your SMTP parameters and desired email subject. They will be saved to 'secrets/secrets.txt' for further use.

  3. Run '' to start emailing your inactive users ('last_sign_in_at' older than a year). Their username, account_id, email, delivery status (True if successful) and delivery date will be written to Postgresql database. There is another column, 'deleted', False by default. Will be useful to track deleted/not deleted inactive users if you choose to do so.

  4. Use your favourite scheduling method to set to run regularly. Column 'elapsed_days' of mailing's database will be updated so you can decide actions after some time.

  5. Run "' to delete all inactive users after 30 days period from the warning email.

Note: install all needed packages with 'pip install -r requirements.txt'