Question: Can an attachment be added to an e-mail action sent from a rule? If so, how can an attachment be added?
Answer: Yes, you can send a file that resides on the FMS host as an attachment within an e-mail action. You will need to add a Severity or Rule Level variable to designate the file that will be attached. Next you will want to set the mail.attachment and the mail.attachment.file.name action parameters under the e-mail action.
Following are the steps to add an attachment to an e-mail message:
__________________________________________________________________
1). Add a Severity Level Variable to designate the file attachment, as follows:
filetomail = new File("path to file")
return filetomail.getBytes();
Where "path to file" is the normal path to the file on a Unix/Linux host. On Windows double-slashes must be used in place of single slashes.
For example, on a Unix FMS host, if you would like to send the PerfReport.pdf file as an attachment, and it resides in the /Quest_Software/Foglight555-ORA/logs directory you can create a variable with the following Expression/Message:
filetomail = new File("/Quest_Software/Foglight555-ORA/logs/PerfReport.pdf")
return filetomail.getBytes();
Please see page 1 in the attached file (email_attachment.pdf).
As another example, on a Windows host, if you would like to send a text file (foglight.config) as an attachment, and it resides in the D:\Program Files\Quest Software\vFoglight\config directory you can create a variable with the following Expression/Message:
filetomail=new File("D:\\Program Files\\Quest Software\\vFoglight\\config\\foglight.config")
return filetomail.getBytes();
Please see page 3 in the attached file (email_attachment.pdf).
2). Set the following parameters in the e-mail action. Please see pages 2 and 4 in the attached file (email_attachment.pdf).
* mail.attachment.file.name - Set the mailattachment.file.name to what you want the attachment to be named. You don't have to use the correct extension for the file (".pdf" if it is a pdf file, and "txt" if it is a text file) if you don't want to, but it will make opening the file easier when it is received.
* mail.attachment - Set the mail.attachment to the Severity Level variable you created in step 1.
You can leave the mail.attachement.mime.type as Default ("application/pdf")
3). Set the following parameters in the e-mail action as normal:
mail.recipient
mail.message
mail.subject
__________________________________________________________________
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center