I recently wrote about using PowerShell to archive snapshots. One of the reasons I wanted to start using PowerShell instead of batch scripts was because PowerShell has the ability to send emails. As I was about to dig into how to write that code, a wonderful thing happened. Oracle released a new EPM Automate command to send email. This just made life a whole lot easier.
The EPM Automate command sendMail is straightforward and easy to understand. Per Oracle documentation:
epmautomate sendMail ToAddresse Subject [Body=”MessageBody”] [Attachments=FILE1,FILE2] where:
- ToAddresse identify semicolon separated email addresses of recipients. Example, jdoe@example.com;jane.doe@example.com
- Subject identifies the email subject.
- Body=”MessageBody”, optionally, is the email content. If not specified, there is no body to the email.
- Attacments, optionally, identifies a comma separated list of files available in EPM Cloud to be attached to the email. For example, outbox/errorFile.txt,inbox/users.csv or outbox/use*.txt. In this example, the wildcard is applied only to one character in the string. Using outbox/use*.txt allows you to attach all files in the outbox with four letter file names that fit the pattern.
Using the PowerShell script we created for archiving snapshots, I added a line at the end to send an email.

Here’s the email that is received.

This is a very basic example. We can get more creative and send different emails depending on success or failure of the different steps in the script. But the beauty of using this EPM Automate command is that it’s so simple. There’s no need-to-know SMTP information and credentials, just enter one or more email addresses, a subject, and a message. You can also include attachments from the EPM Cloud inbox/outbox. One last note, this is a brand-new feature in EPM Automate that was introduced in the 20.04 cloud update. Be sure to download and install the latest version of EPM Automate to take advantage of new features each month.
As always, happy EPM’ng!
how to send the local files from this epmautomate sendmail command.
LikeLike
At this time, only files from the EPM Cloud inbox/outbox can be attached. You could include in the script commands to upload local files to the inbox and then you would be able to attach the file to the email.
LikeLike
Can you include line breaks at the body of the email?
LikeLike
Interesting question, I’d have to test it out. Possibly using CR+LF in the body where you want a new line to start.
LikeLike
How to send notification depending on success or failure?
LikeLike
I don’t have any coding handy, but you should be able to use standard IfThen logic in either batch script or PowerShell to execute the EPM Automate command.
LikeLike
Yeah. I guess files in the Inbox/Outbox in Overview show up without a folder prefix:
Data.csv
Where the same file in the ‘outbox’ in Data Managment show up as:
outbox/Data.csv
And a bunch of other system files etc. So what I did was just upload the log files to the directory:
Inbox/Jobs
Then I attach to email from there. For life of me could not figure out how to attach from the Inbox/Outbox in Overview 😦
LikeLike
I have uploaded a file to the inbox/outbox in Overview. For the life of me, I can’t figure out how to attach it to the sendMail. I have tried all kinds of paths. What is the path to that location? I thought it was /u03/lcm/. That is where data exports reside. Is this even possible from that location?
LikeLike
Looking at the EPM Automate commands, you should be able to attach files from default locations like “outbox” and “inbox”. Try the listFiles command to see where the files are located. https://docs.oracle.com/en/cloud/saas/enterprise-performance-management-common/cepma/epm_auto_send_mail.html and https://docs.oracle.com/en/cloud/saas/enterprise-performance-management-common/cepma/epm_auto_list_files.html
LikeLike