View Source Yugo.Filter (Yugo v0.2.0)
A construct that enables you to specify which emails you would
like a Client
to notify you about.
example
Example
To create a filter that only accepts emails that have been read and not replied to, and whose subject contains "Order Information":
alias Yugo.Filter
my_filter =
Filter.all()
|> Filter.has_flag(:seen)
|> Filter.lacks_flag(:answered)
|> Filter.subject_matches(~r/Order Information/)
Link to this section Summary
Functions
Only accepts emails that have the specified flag.
Only accepts emails that do not have the specified flag.
See has_flag/2
for more information about flags.
Accepts emails where the email address of the sender matches the given Regex
.
Accepts emails whose "subject" line matches the given Regex
.
Link to this section Types
Link to this section Functions
@spec all() :: t()
Returns a Filter
that accepts all emails.
Only accepts emails that have the specified flag.
"Flags" are tags that are associated with an email message.
flags
Flags
IMAP defines several flags that can be set by clients. Possible flags are:
:seen
- Message has been read.:answered
- Message has been answered.:flagged
- Message is "flagged" for urgent/special attention.:draft
- Message has not completed composition (marked as a draft).:deleted
- Message is "deleted". In most email clients, this means it was moved to the trash folder.
example
Example
alias Filter
# build a filter that only allows messages that have been seen.
Filter.all()
|> Filter.has_flag(:seen)
Only accepts emails that do not have the specified flag.
See has_flag/2
for more information about flags.
example
Example
alias Filter
# build a filter that allows all messages that do not have the :deleted flag
Filter.all()
|> Filter.lacks_flag(:deleted)
Accepts emails where the email address of the sender matches the given Regex
.
example
Example
alias Yugo.Filter
# make a filter that only accepts emails sent from "peter@example.com" or "alex@example.com"
Filter.all()
|> Filter.sender_matches(~r/(peter|alex)@example.com/i)
Accepts emails whose "subject" line matches the given Regex
.