incoming mail server should be mail.YOURDOMAIN.com
outgoing mail server should be mail.YOURDOMAIN.com:587
then click on the advanced button and under mailbox behaviors map the drafts, sent and deleted mail boxes to the correct boxes on the iphone.
incoming settings: SSL = on, authentication = password, server posrt = 993
outgoing settings: SSL = on, authentication = password, server posrt = 587
dreamhost IMAP accounts work fine on my iphone as does my .mac mail