AppleScript 错误:邮件出现错误:无法识别的直接参数类型,请指定类似“John Doe <jdoe@example.com>"的字符串

编程入门 行业动态 更新时间:2024-10-26 08:35:18
本文介绍了AppleScript 错误:邮件出现错误:无法识别的直接参数类型,请指定类似“John Doe <jdoe@example>"的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个脚本可以根据 收件人 过滤电子邮件,但是我收到了一个错误.

I have a script that filters emails based on the to recipient but I'm getting an error.

这是脚本:

tell application "Mail"
    set firstInboxMessage to the first message of mailbox "INBOX" of account "Account"
    set theEmail to extract address from to recipient of the firstInboxMessage
    set my text item delimiters to {"+", "@"}
    set mailboxName to text item 2 of theEmail
    set messageAccount to account of mailbox of the firstInboxMessage
    tell the messageAccount to if the name of its mailboxes does not contain ¬
        the mailboxName then make new mailbox at the end of its mailboxes ¬
        with properties {name:mailboxName}
    set newMailbox to the mailbox named mailboxName in the messageAccount
    set the mailbox of the firstInboxMessage to the newMailbox
end tell

这是错误:

Mail got an error: Unrecognized direct parameter type, please specify a string like "John Doe <jdoe@example>"

我认为这与以下事实有关当我使用其中任何一个时,脚本运行良好.

I think it has to do with the fact that to recipient is classified differently somehow in AppleScript compared to for example subject or sender because when I use either of those the script runs fine.

任何帮助将不胜感激.

推荐答案

两个问题:

to receiver 是一个元素.可以有多个收件人.收件人的地址在address属性中可用,不需要extract address from.澄清一下:extract address from 应用到 John Doe <jdoe@example> 返回 jdoe@example 但一个 to 收件人 不包含这样的复合字符串. to recipient is an element. There can be more than one recipient. The address of to recipient is available in the address property, extract address from is not needed. To clarify it: extract address from applied to John Doe <jdoe@example> returns jdoe@example but a to recipient doesn't contain such a compounded string.

简单写

set theEmail to address of to recipient 1 of the firstInboxMessage

这篇关于AppleScript 错误:邮件出现错误:无法识别的直接参数类型,请指定类似“John Doe <jdoe@example>"的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 14:00:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/915710.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   出现错误   类似   错误   邮件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!