File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,17 @@ client.createMailbox('INBOX/Foo').then(() => { ... });
232232// Do the same on a server where the personal namespace is ''
233233client .createMailbox (' Foo' ).then (() => { ... });
234234```
235+ ## Delete mailbox
236+
237+ Delete a folder with the given path with ` deleteMailbox(path) ` , automatically handling utf-7 encoding.
238+
239+ Command: [ DELETE] ( http://tools.ietf.org/html/rfc3501#section-6.3.4 )
240+
241+ Example
242+
243+ ``` javascript
244+ client .deleteMailbox (' Foo' ).then (() => { ... });
245+ ```
235246
236247## Select mailbox
237248
Original file line number Diff line number Diff line change @@ -359,6 +359,27 @@ export default class Client {
359359 }
360360 }
361361
362+ /**
363+ * Delete a mailbox with the given path.
364+ *
365+ * DELETE details:
366+ * https://tools.ietf.org/html/rfc3501#section-6.3.4
367+ *
368+ * @param {String } path
369+ * The path of the mailbox you would like to delete. This method will
370+ * handle utf7 encoding for you.
371+ * @returns {Promise }
372+ * Promise resolves if mailbox was deleted.
373+ */
374+ async createMailbox ( path ) {
375+ this . logger . debug ( 'Deleting mailbox' , path , '...' )
376+ try {
377+ await this . exec ( { command : 'DELETE' , attributes : [ imapEncode ( path ) ] } )
378+ } catch ( err ) {
379+ throw err
380+ }
381+ }
382+
362383 /**
363384 * Runs FETCH command
364385 *
You can’t perform that action at this time.
0 commit comments