简体   繁体   English

如何使用applescript在苹果邮件中检索外发邮件的电子邮件正文?

[英]How to retrieve email body of outgoing mail in apple mail using applescript?

How can i retrieve email body, recipient email address, subject etc of outgoing mail. 我如何检索外发邮件的电子邮件正文,收件人电子邮件地址,主题等。

thanks for any help. 谢谢你的帮助。

EDIT:- I have added one custom button in outgoing mail toolbar see image. 编辑:-我在传出邮件工具栏中添加了一个自定义按钮,请参见图片。

在此处输入图片说明

And the functionality of that button is send mail and save all mail detail on my server also so how can i get that detail like, both email addresses "To"="test@gmail.com" and "cc"="test2@gmail.com", subject="My subject" , and email body="My email body" 该按钮的功能是发送邮件并将所有邮件详细信息保存在我的服务器上,因此我该如何获取该详细信息,例如电子邮件地址“ To” =“ test@gmail.com”和“ cc” =“ test2 @ gmail .com“,subject =”我的主题“和电子邮件正文=”我的电子邮件正文“

How can i achieve this ? 我怎样才能做到这一点?

Through this apple script you can retrieve mail content so please try it. 通过此Apple脚本,您可以检索邮件内容,因此请尝试一下。

tell application "System Events"
    tell process "Mail"
        set _Contents to {}
        set _contentDetail to {}
        set the _contentDetail to entire contents of UI element 1 of scroll area 3 of window 1
        repeat with _value in _contentDetail
            set str to ""
            if class of _value is static text then
                set str to value of _value
            end if
            set str to str & return
            set _Contents to _Contents & str

        end repeat
        return get _Contents as string
    end tell
end tell

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM