Please take a look at SCRYPTmail.com. AFAIK they're the farthest ahead with fully encrypting metadata.
Specific questions about the programming can be asked in their forum -
SCRYPTmail
Sergei is busy with the new release, so any questions I can't help with might take a little longer than normal right now.