Here is my question: The password field on my old server is using MySQL's ENCRYPT function to encrypt the password. So how can I transfer the user account safely to the iRedMail?
Please try to prepend '{CRYPT}' in your password. For example, old password is 'xxxxx' (encrypted with ENCRYPT function), the new one in iRedMail should be '{CRYPT}xxxxx'.
This password doesn't work with iRedAdmin (our web admin panel), so you can migrate with '{CRYPT}' for all users first, then reset the admin account to MD5 password.
NOTE: it's recommended to migrate one or just few accounts for testing purpose first, if it works, migrate all if you want.
I am not a programmer, but when I tried look at the code I saw that it seems iRedMail encrypt the password through python script and then save the password as plain text into the table vamil.mailbox.
Not exactly.
iRedMail stores MD5 hash by default, not plain text. Plain text is optional and NOT RECOMMENDED.