Email Alerts for non logged users more than 30 days

I don’t think there is built-in alert for it.

but you can easily combine occ user:list and occ user:lastseen and detect login older than specific date (keep in mind --output=json and --info parameter)

Using the occ command — Nextcloud latest Administration Manual latest documentation

UPDATE: as it seems to be common request:

I crafted a command to display only user_id and last_seen from occ user:list command

occ user:list --output=json --info| jq '.[] | {user_id, last_seen}'

will show json formated list of users with their last login time stamp e.g.

{
  "user_id": "test6",
  "last_seen": "2022-06-27T20:40:39+00:00"
}
{
  "user_id": "test7",
  "last_seen": "2022-06-28T19:38:48+00:00"
}

and

occ user:list --output=json --info| jq '.[] | [.user_id, .last_seen]|@csv'

will output the list as CSV

"\"test6\",\"2022-06-27T20:40:39+00:00\""
"\"test7\",\"2022-06-28T19:38:48+00:00\""