Error: undefined method `force_encoding' for nil:NilClass body attachment.content

I am receiving:

Delivery failed: “Unable to send email to ‘pra@gmail.com’: Can’t use Channel::Driver::Smtp: #<NoMethodError: undefined method `force_encoding’ for nil:NilClass body attachment.content.force_encoding(‘BINARY’) ^^^^^^^^^^^^^^^>”

Maybe is my mistake, but previously I deleted the old records from
store_provider_dbs
as they took too much space. I tried a scheduled task to clean up the database and keep it small, but it never dropped the tickets.

Zammad is version 6.2.0

Well congratulations. You’ve dropped attachments from your database without tickets and thus bricked your data structure. This is the exact reason why we never suggest to fiddle around in the database directly.