Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1003951 // listMailsTo

JavaX fragment (include)

1  
import javax.mail.search.*;
2  
import static javax.mail.Message.RecipientType;
3  
4  
// find any type (To, CC, BCC)
5  
static L<Message> listMailsTo(Folder f, S address) {
6  
  ret listMailsTo(f, address, null);
7  
}
8  
9  
static L<Message> listMailsTo(Folder f, S address, RecipientType type) ctex {
10  
  f.open(f.READ_ONLY);
11  
  Address a = new InternetAddress(address);
12  
  SearchTerm term;
13  
  if (type == null)
14  
    term = new OrTerm(new SearchTerm[] {
15  
      new RecipientTerm(RecipientType.TO, a),
16  
      new RecipientTerm(RecipientType.CC, a),
17  
      new RecipientTerm(RecipientType.BCC, a)
18  
    });
19  
  else
20  
    term = new RecipientTerm(type, a);
21  
  ret asList(f.search(term));
22  
}

Author comment

Began life as a copy of #1003948

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003951
Snippet name: listMailsTo
Eternal ID of this version: #1003951/1
Text MD5: 8bef497ae7237a8d07cf90512ff067f1
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-31 17:35:42
Source code size: 670 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 557 / 560
Referenced in: [show references]