Added type-safe deserialization for abstract Mail class.