Sending a mail (with SMTP) and storing it in the Sent folder (with IMAP) are two different things, although most mail client does this concurrently. There are very specific SMTP servers (best example is the gmail), who can store a copy of the sent mails in the "Sent" IMAP-Folder of the actual user, but this is an extraordinary feature and most server doesn't do this.
The php mailing library, which you are using, is probably capable to do this as well.
But in your code fragment there is nothing about the IMAP configuration. You should set it also up.