I am working a java-ee project which has a feature of sending and reading mail. So, I want to send mail which goes to a custom subfolder(that I'll be able to create if not exist) inside inbox, so that I can search for that mail in that subfolder by giving certain header value.
I am using outlook.office.com as host imap protocol.
Is there any way to do this? I would appreciate any help. regards
You don't "send" mail to a folder, you "save" it in a folder. Use the Folder.appendMessages method to append the message to a Folder.