Archived Forum Post

Index of archived forum posts


How to Makr a Email as Spam/Junk Using IMAP?

Jan 20 '15 at 09:20

Greetings, i am very much interested to know how to mark a email as spam. i have seen flags like Deleted", "Seen", "Answered", "Flagged", "Draft", and "Answered. But what about spam/junk? for example i like to check unread email in inbox and if it as some bad text then i like to mark that as spam/junk?


thanks in advance

best regards


Shouldn't mail that is spam/junk be moved to the spam/junk folder? There are no standard IMAP flags for junk, although if Chilkat supports it you could add a custom /Junk flag, but this would also require the mail client to understand what to do with that flag - which would normally be to move the message to the spam/junk folder, so why not just move it there in your application anyway? The user can then clearly see it is spam due to the folder it is in, and they can then decide whether to delete it or to move it to the inbox or other folder if they want to keep it.



Check out these 2 examples:

Copy a message from one box to another:

Delete a message:


The flagName argument in any of the methods for setting flags (such as SetFlag, SetFlags, SetMailFlag, etc.) can be anything. The name you'll need to use depends on what is expected by the software implementations (such as the IMAP server or an email client such as Thunderbird). Setting a flag doesn't move or delete an email.


thanks a first reply, but i didn't ask for this post.. i this is less important..

i have asked for :

please try to help me on that :)

thanks again.. you always rocks on helps