【问题标题】:choosing mail account in applescript在applescript中选择邮件帐户
【发布时间】:2014-07-23 18:10:54
【问题描述】:

我想使用 Mac Automator 操作发送邮件。我准备了以下邮件脚本:

set recipientName to "<recipient>"
set recipientAddress to "<recipient mail address>"
set theSubject to "<mail subject>"
set textBody to "<text>"

tell application "Mail"
    set theMessage to make new outgoing message with properties {subject:theSubject, content:textBody, visible:true}
    --set recipient
    tell theMessage
        make new to recipient with properties {name:recipientName, address:recipientAddress}
        --send the message
        send
    end tell
end tell

现在,当我发送此邮件时,它使用邮件应用程序中基本上当前选择(突出显示)的帐户。

有什么方法可以选择特定的帐户吗?

【问题讨论】:

  • 嘿@Dragon5689 这是怎么回事?您在下面尝试过我的答案吗?

标签: macos email applescript


【解决方案1】:

您需要将 theMessage 的sender 设置为您的其中一个帐户的有效地址。

例如

set recipientName to "<recipient>"
set recipientAddress to "<recipient mail address>"
set theSubject to "<mail subject>"
set textBody to "<text>"
set theSender to "dragon5689@stackoverflow.com" -- your valid account email here 

tell application "Mail"
    set theMessage to make new outgoing message with properties {subject:theSubject, content:textBody, visible:true, sender:theSender}
    tell theMessage
        make new to recipient with properties {name:recipientName, address:recipientAddress}
        send
    end tell
end tell

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 1970-01-01
    • 2016-07-26
    • 2018-08-24
    • 1970-01-01
    • 2020-05-07
    • 2022-08-10
    相关资源
    最近更新 更多