How to redirect domain without breaking the email?
The answer to your question will depend on the URLs you want your users to use.
If you want users to access your application via http://app.domain.com/ or http://www.domain.com/ you can either use an A record to point app or www to the IP address of the application server, or add a CNAME record to point to the real name of the app server.
server01.domain.com. A 192.0.2.1 ; Either app.domain.com. CNAME server01.domain.com. ; OR app.domain.com. A 192.0.2.1
If you want http://domain.com/ to point to your application things are trickier. The correct answer it to point the A record for domain.com to the IP of your application server. A CNAME might seem tempting; however when you use a CNAME to specify the canonical name for a host you are not allowed to have any other resource records for that host. Your zone will need to have at least SOA and NS records as well as MX records to function properly so a CNAME will not work.
domain.com. SOA ( ns0.domain.com. hostmaster.domain.com. 2009061501 86400 7200 3600000 3600 ) @ NS ns0.domain.com. @ NS ns1.domain.com. @ MX 5 mail.domain.com. @ MX 10 relay.domain.com. ; This is invalid: @ CNAME server01.domain.com. ; This is valid: @ A 192.0.2.1
For information on common DNS mistakes, including CNAME limitations, see RFC1912.
MX records are used to direct where your email is delivered. Changing your A records or CNAMEs will not change where email is delivered. BUT you probably should confirm how Dreamhost has your DNS setup before changing anything.