public void StoreAttachmentWithoutQuota(int tenant, string user, MailAttachment attachment, IDataStore storage) { try { if (attachment.data == null || attachment.data.Length == 0) { return; } if (string.IsNullOrEmpty(attachment.fileName)) { attachment.fileName = "attachment.ext"; } var contentDisposition = MailStoragePathCombiner.PrepareAttachmentName(attachment.fileName); var ext = Path.GetExtension(attachment.fileName); attachment.storedName = CreateNewStreamId(); if (!string.IsNullOrEmpty(ext)) { attachment.storedName = Path.ChangeExtension(attachment.storedName, ext); } attachment.fileNumber = !string.IsNullOrEmpty(attachment.contentId) //Upload hack: embedded attachment have to be saved in 0 folder ? 0 : attachment.fileNumber; var attachmentPath = MailStoragePathCombiner.GerStoredFilePath(attachment); using (var reader = new MemoryStream(attachment.data)) { var uploadUrl = storage.UploadWithoutQuota(string.Empty, attachmentPath, reader, attachment.contentType, contentDisposition); attachment.storedFileUrl = MailStoragePathCombiner.GetStoredUrl(uploadUrl); } } catch (Exception e) { _log.Error("StoreAttachmentWithoutQuota(). filename: {0}, ctype: {1} Exception:\r\n{2}\r\n", attachment.fileName, attachment.contentType, e.ToString()); throw; } }