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

32
LINES

< > BotCompany Repo | #1005141 // GMail: Show last mails in inbox

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 4463K of libraries. Click here for Pure Java version (6197L/42K/150K).

1  
!7
2  
3  
static int numMsgs = 20;
4  
5  
p {
6  
  veryBigConsole();
7  
  if (empty(gmailDefaultUser())) {
8  
    print("Run #1005140 to set gmail user name!");
9  
    ret;
10  
  }
11  
  
12  
  Folder inbox = gmail_inbox();
13  
  printLastMails(inbox);
14  
}
15  
16  
svoid printLastMails(Folder inbox) ctex {
17  
  inbox.open(Folder.READ_ONLY);
18  
  int count = inbox.getMessageCount();
19  
  for (int i = count; i >= max(1, count-numMsgs+1); i--) {
20  
    print("\nLoading message " + i + "\n");
21  
    Message msg = inbox.getMessage(i);
22  
    print("  From: " + InternetAddress.toString(msg.getFrom()));
23  
    print("  Subject: " + msg.getSubject());
24  
    print("  Message number: " + msg.getMessageNumber());
25  
    print("  Sent/Received: " + msg.getSentDate() + "/" + msg.getReceivedDate());
26  
    //print("  Class: " + getClassName(msg));
27  
    //O content = msg.getContent();
28  
    //print("  Content type: " + getClassName(content));
29  
    print("  Size: " + msg.getSize());
30  
    print("  Content type: " + msg.getContentType());
31  
  }
32  
}

Author comment

Began life as a copy of #1003302

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: #1005141
Snippet name: GMail: Show last mails in inbox
Eternal ID of this version: #1005141/15
Text MD5: 30dd274177acb0c8fb9d0aaabe5b99e5
Transpilation MD5: 515456076755c0308d1ec26babe668a1
Author: stefan
Category: javax / gmail
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-14 18:12:06
Source code size: 989 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 530 / 800
Version history: 14 change(s)
Referenced in: [show references]