我正在尝试接收邮件中活动帐户的邮件地址。
到目前为止,我做了以下
tell application "Mail"
set selected to selected mailboxes of message viewer 1
end tell
和
tell application "Mail"
email addresses of every account
end tell
但不知怎的,我不能做像
那样的事情tell application "Mail"
set selectedMailboxes to selection
set theAccount to account of selection
return theAccount
end tell
The Last applescript不起作用。如何在message vieview 1
?
答案 0 :(得分:1)
试试这个
tell application "Mail"
try
set selectedMailbox to item 1 of (get selected mailboxes of message viewer 1)
set mailAddresses to email addresses of account of selectedMailbox
on error
display dialog "No Mailbox selected"
end try
end tell
由于帐户可以有多个邮件地址,因此即使只有一个地址,变量mailAddresses
的类也是一个列表。
使用索引号(从1开始)获取所需的地址
set myAddress to item 1 of mailAddresses
或
set myAddress to second item of mailAddresses