#Criteria

2 messages · Page 1 of 1 (latest)

hard turret
#
    criteria := imap.NewSearchCriteria()
    criteria.WithoutFlags = []string{imap.SeenFlag}
    criteria.Header = textproto.MIMEHeader{
        "From": []string{
            "[email protected]",
        },
    }
    tenSecondsAgo := time.Now().Add(-10 * time.Second)
    // Email may not be older than 10 seconds in the past, any email that are received now and younger than 10 seconds will be allowed
    criteria.Since = tenSecondsAgo
    criteria.SentSince = tenSecondsAgo

For some reason it still picks emails older than 10 seconds and if I set any other criteria fails to find mails. Basically, what I want to happen is to have criteria filter that only mails from now to 10 seconds ago may be searched for anything older is disregarded.

#

I think this does it