Go back to top

vivaldi.mailPrivate Modders API Reference

Vivaldi mail api. API for reading/writing mails.

Types

#message

Message object. Used to create message in full text database table.

Properties:

searchListId
integer

⚠ NO DESCRIPTION PROVIDED

subject
string

The message subject.

body
string

The message body.

to
string

The message to address .

cc
string

The message cc address .

from
string

The message from address .

replyTo
string

The message reply address .

#migration

Migration object. Returns search db version and if migration of search db is needed.

Properties:

dbVersion
integer

The mail search db version.

migrationNeeded
boolean

If database migration is needed.

#SearchResults

Results object from mail search.

Properties:

message
string

Error message. If any.

search_list_ids

Resulting search list ids.

Array of:

  • number
success
boolean

Indicates if error occurred.

Listeners

How to use listeners

Each listener type has the same functions, used for each listener API in the same way:

.addListener(function callback)

Adds a function to a listener for an event

.removeListener(function callback)

Removes a function to a listener for an event

.hasListener(function callback)

Returns a boolean if a function is attached to a listener for an event

.hasListeners()

Returns a boolean if a listener has any attached functions

.dispatch()

Returns array of promises dispatched to the listener

#onUpgradeProgress

Reports import progress.

Parameters:

progress
integer

Number of rows upgraded.

total
integer

Total number of rows to be upgraded.

msg
string

Message to be printed out.

#onDeleteMessagesProgress

Reports progress when deleting messages.

Parameters:

delete_progress_count
integer

Number of messages deleted.

Methods

#getFilePaths

Returns array of file paths under a given directory.

Parameters:

path
string

The root folder from where to build up the file paths.

#getFullPath

Given a file entry, return full path of the file

Parameters:

filesystem
string

The file entry to be looked up

path
string

The path

#getMailFilePaths

Returns array of file paths under the default profile /Mail directory.

#writeTextToMessageFile

Saves a mail to disk. The root folder location is the profile directory of the current running instance /Mail

Parameters:

paths

String array that is used to create a folder structure, starting at user default profile /Mail The function returns error if empty

Array of:

  • string
fileName
string

The file name to be created/saved/overridden.

raw
string

The raw mail content.

append
(optional)
boolean

Whether to append to file instead of write.

#writeBufferToMessageFile

Saves a mail to disk. The root folder location is the profile directory of the current running instance /Mail

Parameters:

paths

String array that is used to create a folder structure, starting at user default profile /Mail The function returns error if empty

Array of:

  • string
fileName
string

The file name to be created/saved/overridden.

raw
binary

The raw mail content as arrayBuffer

append
(optional)
boolean

Whether to append to file instead of write.

#deleteMessageFile

Deletes a file. The root folder location is the profile directory of the current running instance /Mail

Parameters:

paths

String array that is used to build path to the file. Starting at user default profile/Mail.

Array of:

  • string
fileName
string

The file name to be deleted. With ending.

#renameMessageFile

Renames a file. The root folder location is the profile directory of the current running instance /Mail

Parameters:

paths

String array that is used to build path to the file. Starting at user default profile/Mail.

Array of:

  • string
fileName
string

The file name to be renamed.

newFileName
string

The new name for the file.

#readFileToBuffer

Reads the contents of a file. Returns the content as arrayBuffer

Parameters:

fileName
string

Absoloute path to the file to be read.

#readMessageFileToBuffer

Reads a mail. The root folder location is the profile directory of the current running instance /Mail

Parameters:

paths

String array that is used to build path to the file. Starting at user default profile/Mail.

Array of:

  • string
fileName
string

The file name to be read.

#messageFileExists

Check if file exists.Returns true if the file exists.

Parameters:

paths

String array that is used to build path to the file. Starting at user default profile/Mail.

Array of:

  • string
fileName
string

The file name to be checked.

#readFileToText

Reads a file. Returns the file content as text.

Parameters:

path
string

Absoulout path to the file to be read.

#getFileDirectory

Returns the user mail data directory and verfies that the directory exists.

Parameters:

hashedAccountId
string

First 6 characters from the MD5 hash of the accountId. Appended to the end of the default mail data directory

#createFileDirectory

Creates the user mail data directory.

Parameters:

hashedAccountId
string

First 6 characters from the MD5 hash of the accountId. Appended to the end of the default mail data directory

#createMessages

Creates messages for full text search.

Parameters:

messages

⚠ NO DESCRIPTION PROVIDED

Array of:

  • message

#deleteMessages

Deletes messages from full text search.

Parameters:

messages

⚠ NO DESCRIPTION PROVIDED

Array of:

  • integer

#updateMessage

Updates a message. All properties needs to be specified both new and previous ones.

Parameters:

message
message

⚠ NO DESCRIPTION PROVIDED

#searchMessages

Searches messages with certain query.

Parameters:

searchValue
string

The value to search for

#matchMessage

Does search value match certain message.

Parameters:

searchListId
integer

The searchListId of the message to be checked.

searchValue
string

The value to search for

#getDBVersion

Returns SQLite database version for MailDB.

#startMigration

Migrates the full text database index to contentless. Track progress in the listener: onUpgradeProgress. This can be slow.

#deleteMailSearchDB

Deletes MailSearchDB and MaildSearchDB-journal file. Re-creates the files afterwards. This action cannot be reverted.

#checkMailSearchDBHealth

Checks mail search db for errors.