Каждый день я отправлял электронное письмо с прикрепленным изображением
Я делаю снимок экрана в своем iPhone для загрузки в iCloud, и это появляется на моем настольном компьютере Mac, поэтому мой сценарий берет это изображение с рабочего стола, прикрепленный и отправляет его.
Но нужно знать «если» или «еще», чтобы узнать, есть изображение или нет.
Если есть изображение: отправьте его
Если изображение отсутствует, не отправляйте его
set recipientName to "name"
set recipientAddress to "Mail@mail.com"
set theAttachment to POSIX file "user/desktop/image.png"
set theSubject to "theSubject"
set theContent to "message"
--Mail Tell Block
tell application "Mail"
--Create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
--Set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
--Add attachment
make new attachment with properties {file name:theAttachment} at before the last paragraph
##Pause
delay 3
##Send the Message
--send
end tell
end tell