Gmail的应用脚本-搜索确切主题 [英] Apps script for Gmail - search for exact subject

查看:87
本文介绍了Gmail的应用脚本-搜索确切主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每天都会收到多封自动电子邮件.一个主题为每日报告",另一个主题为每日报告详细信息".这是我使用的脚本,但是一旦电子邮件开始发送却没有按时间顺序排列,我有时会发现错误的消息.

I get every day multiple automatic emails. One has the subject 'Daily Report' and one has the subject 'Daily Report details'. This is the script I was using, but once the emails started coming without chronological order, I sometimes catch the wrong one.

 var threads = GmailApp.search('Daily Report') //search gmail with the given query(partial name using * as a wildcard to find anything in the current subject name).
 var msgs = GmailApp.getMessagesForThreads(threads);

是否有一种方法可以告诉搜索,我希望邮件的主题为每日报告",而不是主题为每日报告详细信息"的邮件?

Is there a way to tell the search that I want the mail with exact subject 'Daily Report' and not the one with 'Daily Report Details'?

谢谢

推荐答案

就像提到的@ Pierre-Marie Richard和@Cooper一样,您可以使用内置的Gmail搜索功能.以下是 Gmail搜索功能的列表,例如@Cooper所述您最好使用类似这样的东西:

Like @Pierre-Marie Richard and @Cooper mentioned, you can use the built-in Gmail search functions. Here are a list of the Gmail Search Functions, like @Cooper mentioned you may be best using something like:

var threads = GmailApp.search('subject:"Daily Report"-Details')
var msgs = GmailApp.getMessagesForThreads(threads);

引号(" )完全匹配,而减号('-')则排除了一个单词. 如果仍然无法解决问题,请告诉我,我将进行进一步的研究.

The quotes ("") work as an exact match and the minus ('-') is to exclude a word. If that still doesn't work let me know and I will look further into it.

祝你好运:)

这篇关于Gmail的应用脚本-搜索确切主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆