set (move deleted messages to trash of anAcnt) to true
set (empty trash frequency of anAcnt) to -1 -- = never
set (empty sent messages frequency of anAcnt) to -1 -- = never
These commands do not modify mail's prefs file and when you quit Mail, the old values are always written to the prefs file. I had to use a script like this ...
tell application "Mail" to quit
-- get path to the "com.apple.mail.plist" preference file
-- read the "com.apple.mail.plist" preference file
tell application "System Events"
set mailAccountsList to (value of property list item "MailAccounts" of property list file prefsPath)
end tell
-- modify mailAccountsList
-- write the "com.apple.mail.plist" preference file
tell application "System Events"
set value of property list item "MailAccounts" of property list file prefsPath to mailAccountsList
end tell
tell application "Mail" to activate
If you need to permanently modify any application's preferences, you, too, may encounter this situation.