Applescript Outlook 获取电子邮件名称

Applescript Outlook to get name of email

我正在尝试回复电子邮件,并希望包括我回复的人的名字,因为他们的电子邮件是 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.

尝试:

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