on 02-22-2007 10:16 AM
Hi All
I m facing a problem in implementing a custom mail adapter module.
The scenario is to set the content type based on the file type. eg: if the file being sent is a pdf then content type should be "application/pdf".
I hope the scenario is clear, please feel free to ask for clarifications.
awaiting your replies.
Regards
Kapil
Hi All
I am able to fetch the file name now and set the content type based on the file name. But I m not able to change the name of attachment of mail. For reference, I m pasting the code here, please suggest how to do the latter part
try {
// CS_GETCHADAT START
cid = moduleContext.getChannelID();
Channel channel = new Channel(cid);
// Example to access a channel configuration parameter in a module: String someParameter = channel.getValueAsString("YourAttributeName");
// CS_GETCHADAT END
fileName = msgg.getMessageProperty("http://sap.com/xi/XI/System/File","FileName");
Payload attachment = msgg.getAttachment("MainDocument");
StringTokenizer st = new StringTokenizer(fileName, ".");
while(st.hasMoreTokens()){
extension = st.nextToken();
}
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: filename " + fileName);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: extension " + extension);
// create new payload
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: attchmntName " + attachment.getName().toString());
//provide attributes and content for the new payload
attachment.setName("Attachment :" + fileName);
// msgg.setMessageProperty("http://sap.com/xi/XI/System/File","content-description",fileName);
attachment.setContentType("application/" + extension );
inputModuleData.setPrincipalData(msgg);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kapil,
What do u mean by a custom mail adapter module which will handle any type of xtension or r u using the standard module MessageTransformBean module. Nut, the standard module will be able to handle ur case.
Check the following link
<a href="https://websmp109.sap-ag.de/form/sapnet?_SHORTKEY=01200252310000071155&_SCENARIO=01100035870000000202&_OBJECT=011000358700004556712005E">https://websmp109.sap-ag.de/form/sapnet?_SHORTKEY=01200252310000071155&_SCENARIO=01100035870000000202&_OBJECT=011000358700004556712005E</a>
<a href="/people/sravya.talanki2/blog/2006/11/28/e-mail-xml-messages-in-pdf-format-from-sap-xi:///people/sravya.talanki2/blog/2006/11/28/e-mail-xml-messages-in-pdf-format-from-sap-xi
Regards,
Akshay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kapil,
could MessageTransformBean a solution?
You can set the type of your payload using the following modules parameters:
localejbs/AF_Modules/MessageTransformBean | Local Enterprise Bean | transform
transform | Transform.ContentType | XYZ
You need to replace XYZ by the type.
Regards,
Torsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.