我正在尝试回复电子邮件,并希望根据他们的电子邮件是first.last@company.com的已知事实包括我回复的人的名字。
这是我到目前为止所得到的,但似乎无法获得电子邮件地址或名称:
on run
tell application "Microsoft Outlook"
set replyToMessage to selection
if (replyToMessage is "") then
-- no email selected, don't continue
display dialog "No email is selected!"
return
end if
set theRecpt to extract name from sender of replyToMessage as text
set replyMessageSubj to subject of replyToMessage
set replyMessage to reply to replyToMessage without opening window
--need variable theName to get name or email to parse here
if has html of replyMessage then
log "HTML!"
set the content of replyMessage to ("<p>Hi " & theName & ",<br><br>This is my email body
else
log ("PLAIN TEXT!")
set the plain text content of replyMessage to "Hi " & theName & "
This is my email body" & return & (the plain text content of replyMessage)
end if
open replyMessage -- may not need to do this, you could just send it
end tell
end run
任何帮助都将不胜感激。
更新:我试过这个:
set sender's address of newMessage to "first.last@company.com"
我收到以下错误:
Microsoft Outlook got an error: Can’t make address of sender of outgoing message id 292223 into type specifier.
答案 0 :(得分:4)
尝试:
tell application "Microsoft Outlook"
set replyToMessage to selection
if replyToMessage = missing value then
-- no email selected, don't continue
display dialog "No email is selected!"
return
end if
set theName to name of (get replyToMessage's sender)
set replyMessageSubj to replyToMessage's subject
set replyMessage to reply to replyToMessage without opening window
if has html of replyMessage then
log "HTML!"
set the content of replyMessage to ("<p>Hi " & theName & ",<br><br>This is my email body ")
else
log ("PLAIN TEXT!")
set the plain text content of replyMessage to "Hi " & theName & "
This is my email body" & return & (the plain text content of replyMessage)
end if
open replyMessage
end tell