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

23
LINES

< > BotCompany Repo | #1003301 // gmailDefaultFolder

JavaX fragment (include)

!include once #1015973 // JavaMail

import com.sun.mail.imap.IMAPMessage;

static Folder gmailDefaultFolder() {
  ret gmailDefaultFolder(gmailDefaultUser());
}

static Folder gmailDefaultFolder(S user) {
  ret gmailDefaultFolder(user, findGMailPassword(user));
}
  
static Folder gmailDefaultFolder(S user, S pass) ctex {
  new Properties props;
  props.setProperty("mail.store.protocol", "imaps");

  Session session = Session.getInstance(props, null);
  
  Store store = session.getStore();
  store.connect("imap.gmail.com", user, pass);
  
  ret store.getDefaultFolder();
}

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: 601 / 583
Version history: 5 change(s)
Referenced in: #1003711 - gandiDefaultFolder
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010554 - imapDefaultFolder
#1016626 - googleCode_gmailDefaultFolder