Wrong content type for email attachment
The attachment use a MIMEApplication but does not define any subtype so it uses 'octet-stream'. Many email clients do not care about the 'Content-Disposition' and so propose to download with for example with '.dat' extension. Indeed we should use correct main- and sub- type.