Methods
(async, static) connect(config) → {ProtonMail}
Get a ProtonMail instance that is connected and ready to use.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
Properties
|
Returns:
- Type
- ProtonMail
(async) close()
Closes the ProtonMail session and headless browser.
(async) createFolder(name) → {Folder}
Create a new folder.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Must be unique |
Returns:
- Type
- Folder
(async) createLabel(name) → {Label}
Create a new label.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Must be unique |
Returns:
- Type
- Label
(async) getConversation(id) → {Conversation|undefined}
Get a conversation by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
- Type
- Conversation | undefined
(async) getConversationCounts()
Returns same as getEmailCounts() but counted by conversation.
See getEmailCounts() for example response.
(async) getConversations(folderOrLabel, page) → {Array.<Conversation>}
Get array of conversations.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
folderOrLabel |
string | Label | Folder |
all
|
|
page |
number |
0
|
Returns:
- Type
- Array.<Conversation>
(async) getEmail(id) → {Email|undefined}
Get an email by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
- Type
- Email | undefined
(async) getEmailCounts() → {Object}
Example
{
labels: {
foobar: { total: 5, unread: 1 }
},
folders: {
inbox: { total: 22, unread: 18 },
trash: { total: 0, unread: 0 },
spam: { total: 5, unread: 0 },
all: { total: 32, unread: 19 },
archive: { total: 0, unread: 0 },
sent: { total: 3, unread: 0 },
drafts: { total: 0, unread: 0 },
myfolder: { total: 2, unread: 1 }
}
}
Returns:
- Type
- Object
(async) getEmails(folderOrLabel, page) → {Array.<Email>}
Get array of emails.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
folderOrLabel |
string | Label | Folder |
all
|
|
page |
number |
0
|
Returns:
- Type
- Array.<Email>
getFolderById(id) → {Folder|undefined}
Get a folder by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
- Type
- Folder | undefined
getFolderByName(name) → {Folder|undefined}
Get a folder by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
Returns:
- Type
- Folder | undefined
getLabelById(id) → {Label|undefined}
Get a label by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
- Type
- Label | undefined
getLabelByName(name) → {Label|undefined}
Get a label by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
Returns:
- Type
- Label | undefined
(async) sendEmail(options) → {Email}
Send an email.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Returns:
- Type