function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sheetal agrawalsheetal agrawal 

attachment content type

Hi,

the code below gives attachment name as SoSME DQ Extract..... , ignoring the '/' bettween
"So SME". Can anyone help me getting the '/' in attachment name

Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('So/SME DQ Extract'+System.now()+'.csv');
        attachment.setBody(b);
        attachment.setContentType('text/csv');
Gaurish Gopal GoelGaurish Gopal Goel
Hi Sheetal,

Special characters are omitted in EmailFileAttachments. If these are not omitted then there will be a problem while downloading and viewing those attachments. So you can't put forward slash in the email file attachment name. It will be omitted before getting attached.

If this answer solves your problem then mark it as the solution to help others. Thanks.
sheetal agrawalsheetal agrawal
Thanks Gaurish,
Is tehre anyway to get the special characters? can i use Cutom lables and call in EmailFileAttachments.?
Gaurish Gopal GoelGaurish Gopal Goel
No we can't use custom labels. Its something to do with EmailFileAttachment only so we can't use special characters. If you try to create a folder/file on your system then also we are not allowed to use special characters. Please see the below image for reference.

User-added image