feat(mail): download message as .eml file

This commit is contained in:
Francis Lachapelle
2021-08-11 13:44:48 -04:00
parent 36100b0419
commit ef5e7775cd
5 changed files with 56 additions and 9 deletions
+20
View File
@@ -370,4 +370,24 @@
return response;
}
- (id <WOActionResults>) exportAction
{
NSString *disposition, *source;
SOGoMailObject *co;
WOResponse *response;
co = [self clientObject];
source = [co contentAsString];
response = [self responseWithStatus: 200];
[response setHeader: @"message/rfc822; charset=utf-8"
forKey: @"content-type"];
disposition = [NSString stringWithFormat: @"attachment; filename=\"%@.eml\"", [co nameInContainer]];
[response setHeader: disposition forKey: @"Content-Disposition"];
[response setContent: [source dataUsingEncoding: NSUTF8StringEncoding]];
return response;
}
@end