Deleting a single email message

Top  Previous  Next

Upon establishing a connection to an IMAP server you can mark an individual message for deletion from the mailbox by invoking the Imap#deleteMessage method with an argument of the message id to delete. Message id's are one (1) based with the first message in mailbox being 1, the second 2 etc. To delete any messages marked for deletion you must invoke the Imap#expunge method.

 

Example

 

// establish connection

imap.connect();

 

// mark first message in mailbox for deletion

imap.deleteMessage(1);

 

// delete any messages marked for deletion and disconnect

imap.expunge();

imap.disconnect();





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC