I agree with the comments to your question. What you're asking for doesn't really exist... Let me try to explain.
Sending and receiving messages is done with the SMTP protocol, so you need an SMTP server. Just after receiving the message, the SMTP server (or the MTA, Message Transport Agent) calls an MDA (Message Delivery Agent) that actually stores the message. Then you need an access to this message storage. This is where you usually use IMAP (Internet Message Access Protocol) or POP3 (Post Office Protocol) that provide remote access to this storage (and/or local access using the localhost interface). An alternative would be to directly access the message store, using one of the most common storage format: maildir
or mailbox
.
IMAP is a protocol, which means it needs a server and a client. Your webmail is the client part, now you need a server part. Having the webmail application containing both the client and the server part of the IMAP protocol (the IMAP layer as you call it in your question) doesn't really make sense, because then you wouldn't need IMAP at all.
At the end you either need:
- a webmail which can directly access the message storage used by your SMTP server (usually the
maildir
format), which exists but is not very common (see my answer on your similar question),
- an IMAP server provided by a separate piece of software.
You might also want to check SMTP vs mail retrieval.