From 6c111956303753537afc3796098bce3c639053d4 Mon Sep 17 00:00:00 2001
From: "madhu.sr" <madhu.sr@vtigersolutions.com>
Date: Wed, 6 Mar 2024 07:17:46 +0530
Subject: [PATCH] #Fixes::158428588::madhusr::PDF attachment is not sending
 when we click on the 'send email as attachment'

---
 modules/Emails/views/MassSaveAjax.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/Emails/views/MassSaveAjax.php b/modules/Emails/views/MassSaveAjax.php
index db74b8a1f..f2ec042ee 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'];
 
-- 
GitLab