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

23
LINES

< > BotCompany Repo | #1003301 // gmailDefaultFolder

JavaX fragment (include)

1  
!include once #1015973 // JavaMail
2  
3  
import com.sun.mail.imap.IMAPMessage;
4  
5  
static Folder gmailDefaultFolder() {
6  
  ret gmailDefaultFolder(gmailDefaultUser());
7  
}
8  
9  
static Folder gmailDefaultFolder(S user) {
10  
  ret gmailDefaultFolder(user, findGMailPassword(user));
11  
}
12  
  
13  
static Folder gmailDefaultFolder(S user, S pass) ctex {
14  
  new Properties props;
15  
  props.setProperty("mail.store.protocol", "imaps");
16  
17  
  Session session = Session.getInstance(props, null);
18  
  
19  
  Store store = session.getStore();
20  
  store.connect("imap.gmail.com", user, pass);
21  
  
22  
  ret store.getDefaultFolder();
23  
}

Author comment

Began life as a copy of #1003300

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003301
Snippet name: gmailDefaultFolder
Eternal ID of this version: #1003301/6
Text MD5: 7d68c30d6e0f8505051b6be219a9bef8
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-25 21:51:35
Source code size: 598 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 600 / 583
Version history: 5 change(s)
Referenced in: [show references]