您的位置:首页 > 移动开发

AppleScript发送邮件

2017-11-15 14:15 381 查看
tell application "Finder"
set theFile to ":Users:yueyansheng:Desktop:sadasd.pptx" as alias
set fileName to name of theFile
end tell

set theSubject to fileName
set theBody to "Hello sir. Here is my " & fileName
set theAddress to "Some Email"
set theAttachment to theFile
set theSender to "Some Sender"

tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return, visible:true}
tell theNewMessage
set visibile to true
set sender to theSender
make new to recipient at end of to recipients with properties {address:theAddress}
try
make new attachment with properties {file name:theAttachment} at after the last word of the last paragraph
set message_attachment to 0
log "message_attachment = " & message_attachment
on error
set message_attachment to 1
end try
#tell content
#   make new attachment with properties {file name:theAttachment, path:fileList}

#end tell
#send
end tell
activate
end tell
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  applescript