This discussion is archived
6 Replies Latest reply: Aug 30, 2012 6:51 PM by 956999 RSS

Saved message in a specific folder

956999 Newbie
Currently Being Moderated
Hello,

Possible so that the messages sent by the client are saved in a specific folder?

Thanks.
  • 1. Re: Saved message in a specific folder
    DrClap Expert
    Currently Being Moderated
    If your code is able to access that folder, then yes.

    Perhaps you're accustomed to your mail client automatically putting a copy of all sent messages into a folder named something like "Sent Items"? Then yes, you can do that too. You just have to write the code which puts the message into an (IMAP) folder after you send it (via SMTP).
  • 2. Re: Saved message in a specific folder
    956999 Newbie
    Currently Being Moderated
    Thanks DrClap,

    To the message sent so I have no problem, is stored in [AppName]/Sent


    Session s = MailConfig.getSession();
                        Store store = s.getStore("imap");
                        store.connect(HOST_IMAP, PORT_IMAP, ACCOUNT, PASSWD);
                        Folder folder = store.getFolder(ConfigAppValues.getSent());
                        folder.open(Folder.READ_WRITE);
                        msg.setFlag(Flag.SEEN, true);
                        folder.appendMessages(new Message[] {msg});
                        folder.close(true);


    Where I have questions is how to make that message into the [AppName]/Inbox folder of the recipient.

    Any idea is welcome. (I have one that I think might work but I think it's crazy, ).


    Regards
  • 3. Re: Saved message in a specific folder
    bshannon Pro
    Currently Being Moderated
    That's not your job, that's the job of the mail server. You send the message to the mail server using SMTP,
    the mail server puts the message in the recipient's Inbox. Possibly the mail server supports some sorting
    or filtering options that allow the recipient to control exactly what happens to incoming messages.
  • 4. Re: Saved message in a specific folder
    956999 Newbie
    Currently Being Moderated
    Ok, I understand.

    But the user would not have to configure anything.

    I find it a nuisance to the user.

    Thanks
  • 5. Re: Saved message in a specific folder
    DrClap Expert
    Currently Being Moderated
    Then you're looking at it the wrong way.

    As the user of an e-mail account, I'm the one who should decide what happens to mail which arrives at my account. If I want to put it into a folder, I will do that. If I want to delete it without reading it, I will do that too. It is absolutely not all right that anybody sending me e-mail can do anything with my e-mail account except send messages to it.
  • 6. Re: Saved message in a specific folder
    956999 Newbie
    Currently Being Moderated
    Hello,

    My crazy idea works, however I think it is not the best approach, but works for the moment.

    When a message arrived to Inbox folder, the client (Android in this case), move the message from Inbox folder to [AppName]/Inbox folder.

    Thanks.

    Regards

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points