diff --git a/.gitignore b/.gitignore
index 1b58a932618a4de5ed7cea69c5b4ac23fd04787a..585abce2b3edb78d0d5e1b4aa2f0db528c23fccb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 vendor/*
 !vendor/.htaccess
+.vscode/*
\ No newline at end of file
diff --git a/modules/Emails/views/MassSaveAjax.php b/modules/Emails/views/MassSaveAjax.php
index db74b8a1f015b44c34be00cb2da08464d0eaa8a6..f2ec042ee14ff9c22fd28471e5186c49caab7481 100644
--- a/modules/Emails/views/MassSaveAjax.php
+++ b/modules/Emails/views/MassSaveAjax.php
@@ -196,8 +196,12 @@ class Emails_MassSaveAjax_View extends Vtiger_Footer_View {
 					 * Ex: for PDF: if filename - abc_md5(abc).pdf then raw filename - abc.pdf
 					 * For Normal documents: rawFileName is not exist in the attachments info. So it fallback to normal filename
 					 */
-					$rawFileName = $existingAttachInfo['attachment'];
+					$rawFileName = $existingAttachInfo['storedname'];
 					$file_name = $existingAttachInfo['storedname'];
+					if(!$rawFileName) {
+						$rawFileName = $existingAttachInfo['attachment'];
+						$file_name = $existingAttachInfo['attachment'];
+					}
 					$path = $existingAttachInfo['path'];
 					$fileId = $existingAttachInfo['fileid'];