Fix: Mail fetching stops due to invalid characters in the attachment name

Fix: Mail fetching stops due to invalid characters in the attachment name

Issue:

Mail fetching being stopped due to invalid characters "?" , ":" in the filename. In this case, the eml file's subject contains ":" character and so, while uploading the .eml as attachment, error is thrown (Only in windows server)

Trace:

[00:49:53:547]|[01-31-2024]|[com.manageengine.servicedesk.v3api.utils.AttachmentAPIUtil]|[SEVERE]|[383]: Exception while writing Attachment file| 
java.nio.file.InvalidPathException: Illegal char <?> at index 73: C:\Users\admin\AppData\Local\Temp\2\SDPAttachment\a9fb54f26e\Testing _ _ ? : characters.eml
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.io.File.toPath(File.java:2273)
at com.manageengine.servicedesk.v3api.utils.AttachmentAPIUtil.uploadStreamAsAttachment(AttachmentAPIUtil.java:1594)
at com.manageengine.servicedesk.mailutils.MailAPI.uploadAttachment(MailAPI.java:2851)
at com.manageengine.servicedesk.mailutils.ModuleHandler.handleMailObject(ModuleHandler.java:107)
at com.adventnet.servicedesk.mailutils.MailProcessor.processEMail(MailProcessor.java:71)
at com.manageengine.servicedesk.mail.core.fetcher.JavaMailFetcher.fetchAndProcessMails(JavaMailFetcher.java:209)
at com.manageengine.servicedesk.mail.core.fetcher.MailFetcher.startFetching(MailFetcher.java:306)
at com.adventnet.servicedesk.helpdesk.mail.task.MailFetchingTask.executeTask(MailFetchingTask.java:39)
at com.adventnet.taskengine.internal.SchedulerBean.executeTask(SchedulerBean.java:698)
at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.adventnet.mfw.bean.BeanProxy.lambda$invoke$0(BeanProxy.java:51)
at com.zoho.mickey.api.DefaultCodeBlock.execute(CodeBlock.java:682)
at com.adventnet.mfw.bean.BeanProxy.invoke(BeanProxy.java:48)
at com.sun.proxy.$Proxy2.executeTask(Unknown Source)
at com.adventnet.taskengine.internal.ScheduleExecutor.executeNextTask(ScheduleExecutor.java:334)
at com.adventnet.taskengine.internal.ScheduleExecutor.run(ScheduleExecutor.java:225)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)

[00:49:53:548]|[01-31-2024]|[com.manageengine.servicedesk.mail.core.MailScheduleBean]|[INFO]|[383]: __errormail__ : Error Mail is encountered for the first time. Skipping it to process again|

Fix:

     SDP now replaces the problematic characters "?", ":" with "_" character. With this, the attachment will be uploaded properly.

Steps to apply the fix:

1. Download the fjar file compatible to your build version. Check the compatibility in the below table.

2. Click here on steps to apply the fjar file.

3. Restart the application service.

4. Check for the issue.

5. If the issue occurs, immediately zip the logs (<server_home>\logs folder. For eg: C:\Program Files\ManageEngine\ServiceDesk\logs folder) and share it with us for analysis. If the size of the log file is huge, you can send it to us using our FTP link https://bonitas2.zohocorp.com/. Select the product as "ServiceDesk Plus" and provide the proper ticket number.


Affected versions: Since 14610

Issue ID: SD-118369


Compatible Fjar files:


Build
Fjar name
14610-14620
14610_9573341.fjar

14700
14700_9670828.fjar

                  New to ADManager Plus?

                    New to ADSelfService Plus?

                      • Related Articles

                      • Mail Fetching - Error while processing attachment and inline image.

                        Issue During the process of fetching emails, attachments are dropped as a result of the presence of directory traversal characters. Furthermore, an issue arises when processing inline images, this particular error related to inline images results in ...
                      • Mail Fetching Stopped Due to Inline Image Handling

                        Issue Cause : While fetching a mail, in certain mail servers, cid of inline image is not parsed correctly. Once inline stream is converted to image, cid in src attr will be replaced with image url. cid for uploaded inline image in mail content is not ...
                      • Fix JAR for Parse Error Exception Raised during Mail Fetching

                        Issue : Some mail are fetched and created as ticket without description due to message corruption temporarily. The issue is can be identified with the below trace. Fix : The issue is not recreated when the mail is skipped to next schedule and fetched ...
                      • Attachment Dropping: Failure to Decode File Names Properly During Mail Fetching

                        Issue: The attachment is dropped due to invalid extension. After decoding, the file name appears as: Orange Załącznik nr 1 - Podsumowanie - uzupełnienie. xlsx(Contains space in the extension) However, the actual file name should be: Orange Załącznik ...
                      • List of mail fetching issues and solutions

                        Scenario 1 : Mail fetching issue due to Invalid or No PKIX certificate .   Log traces for Mail Fetching  issues Exception when connecting to store.|javax.mail.MessagingException: sun.security.validator.ValidatorException: PKIX path building failed: ...