# notify the user that s/he needs to re-login after 6 months to prevent account deletion
notifyUser (){
( cat <<EOF
Dear ${dispname},
you have registered on ${siteurl}${registered} and last time you logged in was ${lastlogin}.
Your latest post - if any - was ${lastpost}.
If you want to continue to keep your account on Nerdica then please log in at least every 6 months to keep your account alive. Otherwise we assume that you don't want to use it anymore and will cancel your account 7 months after your last login.
You can access your profile at ${profileurl} or you can cancel your account on your own when logged in at ${siteurl}removeme - however we would like to see you become an active user again and contribute to the Fediverse, but of course it's up to you.
Sincerely,
your ${site} admins
EOF
)| sed 's/_/\ /g'| /usr/bin/mail -s "The Fediverse misses you, ${username}!" -r "${sitefrom}" -- "${usermail}"
# add '-b "$siteadmin"' before the "--" above to receive BCC mails
}
# notify user that the account has been deleted because of inactivity
notifyUserDeletion (){
( cat <<EOF
Dear ${dispname},
you have registered on ${siteurl}${registered} and last time you logged in was ${lastlogin}.
Your latest post - if any - was ${lastpost}.
Since you haven't reacted to the previous mails and didn't login again, your account including all your data has now been deleted.
Sincerely,
your ${site} admins
EOF
)| sed 's/_/\ /g'| /usr/bin/mail -s "Your account ${username} on ${site} has been be deleted!" -r "${sitefrom}" -- "${usermail}"
# add '-b "$siteadmin"' before the "--" above to receive BCC mails
# find & notify users that didn't logged in >6 months and send mail to log in again
for u in $(${friendicapath}/bin/console user list active -c 10000| grep -v '.*---.*'| sed 's/|/;/g'| tr -s "\ "| sed 's/^;\ //g'| sed 's/\ ;\ /;/g'| sed 's/\ /_/g'| tail -n +2 );do