An example to delete emails

2010-07-20
2013-04-25
  • Casey Harris
    Casey Harris
    2010-07-20

    Are there any short examples that note how to delete an email from an inbox?
    TIA

     
  • Casey Harris
    Casey Harris
    2010-07-22

    I saw the following as an example

    // Get a reference to the folder
    vmime: : ref <vmime: : net : : folder> folder = store􀀀>getDefaultFolder ( ) ;
    folder􀀀>deleteMessage (3);
    folder􀀀>deleteMessage (2);

    What I needed was is seen in the following example:

    list = read emails from server for email ID

    i = 0

    while not end list_ do
        return_code =  process_email(list)
        if return_code == good
              message_id = get_message_id_from_email(list)   <-- ???
              delete(message_id)                                                           <-- ???
        end
       i ++;
    end

    For the lines with "???", how does one get the mail ID from the message? I have seen examples for "Subject", "From", "To" and even attachments - but not for mail_id….

    TIA

    _

     
  • Hello,

    The deleteMessage() method takes a message number in argument, not a message ID.
    Use getNumber() on the vmime::net::message object to get it.

    Vincent