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

22
LINES

< > BotCompany Repo | #1003951 // listMailsTo

JavaX fragment (include)

import javax.mail.search.*;
import static javax.mail.Message.RecipientType;

// find any type (To, CC, BCC)
static L<Message> listMailsTo(Folder f, S address) {
  ret listMailsTo(f, address, null);
}

static L<Message> listMailsTo(Folder f, S address, RecipientType type) ctex {
  f.open(f.READ_ONLY);
  Address a = new InternetAddress(address);
  SearchTerm term;
  if (type == null)
    term = new OrTerm(new SearchTerm[] {
      new RecipientTerm(RecipientType.TO, a),
      new RecipientTerm(RecipientType.CC, a),
      new RecipientTerm(RecipientType.BCC, a)
    });
  else
    term = new RecipientTerm(type, a);
  ret asList(f.search(term));
}

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: 558 / 560
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)