Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get a lot of system alerts related blank mails. The custom scripts send empty mails when there is no issue found on the server.

How do I filter such mail? I know how to filter using "From" and "to" fields. I need to know if there is anything in the contents tag.

share|improve this question
Can you have them custom script add some phrase such as Nothing significant to report. – mhoran_psprep Jun 25 '12 at 13:08

All of the available search operators are listed in GMail advanced search help. There's no standard wildcard selector to put into Doesn't have but according to a question about wildcards you can use Perl RegEx for query. This way, you need to construct a query that searches for the absence of any character in the body.

enter image description here

enter image description here

share|improve this answer
And how do you check if the body of the mail is empty? – Alex Jun 25 '12 at 13:00
You check with the parameters that aren't empty, such as From and Subject. – dnbrv Jun 25 '12 at 13:07
The OP stated that the script sends empty emails, so how do you check for this situation—if an email’s body is empty or not? That is the OP’s question. – Alex Jun 25 '12 at 13:11
@Alex: See the edits. – dnbrv Jun 25 '12 at 13:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.