I would suggest you break down your mail setup into discrete tasks/functions, and focus on one at a time.
(1) Incoming mail. Here you'll focus on the postfix and postfix admin setup and aim to get postfix successfully accepting mail from external sources and written to disk in the user's mail directory. Test by sending mail from an outside account (e.g. Gmail), tailing your mail log, and examining directory contents to see where messages are being saved.
(2) POP/IMAP. Next focus on the setup of your POP/IMAP server (Dovecot or Courier-imap), so you can successfully log in with a client (e.g., Thunderbird or Outlook) and "check mail". Focus first on getting the POP/IMAP working on the standard "insecure" ports -- 110 for POP and 143 for IMAP, and once that's done you can investigate what you need to do to enable and use the secure ports.
(3) Outgoing mail. Next focus on adding the ability to send mail from Thunderbird/Outlook via your server. Here you'll add an authentication mechanism, SASL, to your SMTP server.
(4) Webmail. Finally, focus on the webmail setup. Once you've satisfied the http/php requirements of the application, and you've successfully got your POP/IMAP server working (#2 above) then read though the webmail application's config file and adjust as necessary. Typically you'd need to at least set the server host (localhost) and the port (143 for IMAP).
Just take it a step at a time, get one thing working before moving on. It's much less confusing that way
Good luck with it...