Im am using te applescript to send mails from my Mac from a shell script. The script runs fine with one exception: The 'standard' user setting "always Bcc myself" is not set again when the script ends... I am trying to do this with the boldface lines in the script. Switching off does work in the italic lines!
Is there a way to store ALL user settings and restore them at the end of the script?
-- send mail
tell application "Mail"
-- Save user settings
**copy always bcc myself to Cpy_bcc_myself**
**copy always cc myself to Cpy_cc_myself**
-- Make sure we don't get unexpected behaviour
*set always bcc myself to false*
*set always cc myself to false*
-- Create message
tell (make new outgoing message)
set visible to false
set sender to "email adress"
set content to myMsgBody
set subject to "pCloud wijzigingen"
repeat with thisRecipient in ToRecipients as list
make new to recipient at end of to recipients with properties {address:thisRecipient}
end repeat
-- Message ready, send it
send
end tell
-- Set user's setting back to what it was
**set always bcc myself to Cpy_bcc_myself**
**set always cc myself to Cpy_cc_myself**
end tell
*
sections are B/I.