on 09-07-2016 4:12 PM
Hey All,
I need to build a File to Mail scenario. PI needs to pick files from a NFS folder (PDF,JPG,TIF etc) and send to a mailbox as an attachment. The attachment name must be same as source filename and the mail Content (aka body) must have some dummy data (e.g. E-Mail from PI. Do Not reply).
I have build the scenario using dummy Message Types (not using Mail Package) and below UDF and the process works fine but I am not able to find how to add some dummy content to mail body, can someone please help me with it
MappingTrace setAttachmentName_trc;
setAttachmentName_trc = container.getTrace();
String mailHeaderValue = "";
DynamicConfiguration conf = (DynamicConfiguration) container .getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
// try to create a key
try {
DynamicConfigurationKey keyM1 = DynamicConfigurationKey.create( "http:/" + "/sap.com/xi/XI/System/Mail", "XHeaderName1");
mailHeaderValue = "attachment; filename=" + input;
conf.put(keyM1, mailHeaderValue);
} catch (Exception e) {
setAttachmentName_trc.addWarning("caught exception: " + e + " - probably no adapter-specific message attribute.");
e.printStackTrace(); }
return input;
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Saif,
Addition to the above blog use the code from thread FTP to Proxy With Attachment | SCN which sets the input file as an output payload attachment.
Br,
Manoj
Very Sorry, the code formatting didn't come out properly in my question
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.