You can also install LNET from lazarus-ccr, it comes with nice examples for everything.
But how do you mean "sending mail using IMAP"? AFAIR, IMAP is only used to fetch mail, like POP, and you send by SMTP in any case... For example, google uses IMAP/SMTP combination (or POP/SMTP, whatever you choose).