How can i get email from spam/junk folder via pop3
The answer is that you cannot.
The POP3 protocol works only with the main Inbox. This is not a limitation of Chilkat, but is the definition of the POP3 protocol. POP3 is designed with the intention that email only resides on the server (in the Inbox) as a temporary holding place until download. The intent is that your email is stored on your local computer and organized by your email client (Outlook, Thunderbird, etc.) in some client-side database (file-based, relational database, or whatever).
To access other folders on the server, you would need to use the IMAP protocol. The intent of that protocol is the opposite -- that email is managed and stored long-term on the server. You would need to use the Chilkat IMAP API to select the Junk/SPAM folder and then read emails from it. Also, the specific name of the Junk/SPAM folder could be anything -- it depends on the IMAP mail server implementation. You may need to list mailboxes and then surmise which is the Junk folder based on the name. Also, mailboxes can have flags, and you can find the mailbox that has the "\Junk" flag.
For example, in RFC6154:
The new attributes defined here are as follows:
\All This mailbox presents all messages in the user's message store. Implementations MAY omit some messages, such as, perhaps, those in \Trash and \Junk. When this special use is supported, it is almost certain to represent a virtual mailbox.
\Archive This mailbox is used to archive messages. The meaning of an "archival" mailbox is server-dependent; typically, it will be used to get messages out of the inbox, or otherwise keep them out of the user's way, while still making them accessible.
\Drafts This mailbox is used to hold draft messages -- typically, messages that are being composed but have not yet been sent. In some server implementations, this might be a virtual mailbox, containing messages from other mailboxes that are marked with the "\Draft" message flag. Alternatively, this might just be advice that a client put drafts here.
\Flagged This mailbox presents all messages marked in some way as "important". When this special use is supported, it is likely to represent a virtual mailbox collecting messages (from other mailboxes) that are marked with the "\Flagged" message flag.
\Junk This mailbox is where messages deemed to be junk mail are held. Some server implementations might put messages here automatically. Alternatively, this might just be advice to a client-side spam filter.
\Sent This mailbox is used to hold copies of messages that have been sent. Some server implementations might put messages here automatically. Alternatively, this might just be advice that a client save sent messages here.
\Trash This mailbox is used to hold messages that have been deleted or marked for deletion. In some server implementations, this might be a virtual mailbox, containing messages from other mailboxes that are marked with the "\Deleted" message flag. Alternatively, this might just be advice that a client that chooses not to use the IMAP "\Deleted" model should use this as its trash location. In server implementations that strictly expect the IMAP "\Deleted" model, this special use is likely not to be supported.
All of the above attributes are OPTIONAL, and any given server or message store may support any combination of the attributes, or none at all. In most cases, there will likely be at most one mailbox with a given attribute for a given user, but in some server or message store implementations it might be possible for multiple mailboxes to have the same special-use attribute.