You should have an MX record for mydomain.com, not
www.mydomain.com, unless you have email addresses of the form @www.mydomain.com.
Also, MX records must always point to A records; CNAME records are not allowed. So you could create an A record mail.mydomain.com that points to your server's IP, and then you create an MX record for mydomain.com which points to mail.mydomain.com.