Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you know something about the file name, you can use the <a href="https://developers.google.com/google-apps/gmail/imap_extensions" rel="nofollow">X-GM-RAW gmail extensions for imap SEARCH command</a>. These extensions let you use any <a href="http://support.google.com/mail/bin/answer.py?hl=en&amp;answer=7190" rel="nofollow">gmail advanced search</a> query to filter the messages. This way you can restrict the downloads to the matching messages, or exclude some messages you don't want.</p> <pre><code>mail.uid('search', None, 'X-GM-RAW', 'has:attachment filename:pdf in:inbox -label:parsed')) </code></pre> <p>The above search for messages with PDF attachments in INBOX not labeled "parsed".</p> <p>Some pro tips:</p> <ul> <li>label the messages you have already parsed, so you don't need to fetch them again (the -label:parsed filter in the above example)</li> <li>always use the uid version instead of the standard sequential ids (you are already doing this)</li> <li>unfortunately MIME is messy: there are a lot of clients that do weird (or plain wrong) things. You could try to download and parse only the headers, but is it worth the trouble?</li> </ul> <p>[edit]</p> <p>If you label a message after parsing it, you can skip the messages you have parsed already. This should be reasonable enough to monitor your class mailbox.</p> <p>Perhaps you live in a corner of the world where internet bandwidth is more expensive than programmer time; in this case, you can fetch only the headers and look for "Content-disposition" == "attachment; filename=somefilename.ext".</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload