cancel
Showing results for 
Search instead for 
Did you mean: 

Mail Adapter - attachment file?

Former Member
0 Kudos

Hi,

I use the Mail Adapter (XIPAYLOAD) in order to send an email from XI to a Mail Server (Lotus Notes); but content of my email is inside an attachment file.

If I choose "keep attachement", then I have an attachement file with "xxxx<b>.xml</b>".

e.g: payload-fd162890864a11d9c44ded480a1ed732@sap.com.xml

If I don't choose "keep attachment", then I have an attachement file with "xxxx<b>.dat</b>".

e.g: att4a5o8.dat

Is there a solution to have the content directly in the email and not inside an attachement?

And is it possible to change the file name?

Regards

Mickael.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure

MessageTransformBean

http://help.sap.com/saphelp_nw04/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm

Thanks

stefan_grube
Active Contributor
0 Kudos

You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.

In the Mail Receiver Channel got to tab "Module"

As first module (before the mail module) enter:

localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key

For this module key you can use in the module configuration following entries:

Transform.ContentDisposition inline|attachment

Transform.ContentDescription <Filename>

Transform.ContentType <MimeType>/<SubType>

If you want to send an attachment, use:

Transform.ContentDisposition attachment

Transform.ContentDescription MyFile

Transform.ContentType application/xml

If you want to send the payload as mail content, use:

Transform.ContentDisposition inline

Hope that helps,

Stefan

elko_hasse
Participant
0 Kudos

Hello,

how can I set the filename dynamic from the payload using the mentioned <i>MessageTransformBean</i> ??

Thanks

Elko

Former Member
0 Kudos

Hi Stefan,

I am working on a file to mail scenario, i have to set the name of the attachments dynamically as the same name of the files I am sending ...so whether i have to use a java mapping or is there any module avilable for achiving this ...

I used the following java Mapping but,it s not setting the name dynamically

public class Dfilename extends AbstractTransformation {

public void transform(TransformationInput in, TransformationOutput out)

throws StreamTransformationException {

  // TODO Auto-generated method stub

  Collection<String> contentid=null;

  if(in.getInputAttachments().areAttachmentsAvailable())

  {

   contentid=in.getInputAttachments().getAllContentIds(true);

  }

  for(String id:contentid)

  {

   Attachment attachment=in.getInputAttachments().getAttachment(id);

   byte[] content=attachment.getContent();

   String contenttype=attachment.getContentType();

  

   out.getOutputAttachments().setAttachment(out.getOutputAttachments().create(id, contenttype, content));

  

  }

 

 

}  }

Former Member
0 Kudos

Do you find any possibility to change the attachement file name.

Thanks. Marc Stolzenberg.

Former Member
0 Kudos

Not yet.

stefan_grube
Active Contributor
0 Kudos

Use the Option 'Use Mail Package'. In this case the message will be sent out inside the mail.

The mail package is a special message type you have to provide to the mail adapter. You have to do a mapping from your message to the mail package message type.

Here is a sample XSLT for creating a mail package out of any XML Message:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" indent="yes" />

<xsl:template match="*">

<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">

<Subject>Hallo</Subject>

<From>SenderAccount@SenderCompany.com</From>

<To>ReceiverAccount@ReceiverCompany.com</To>

<Content><xsl:copy-of select="/"/></Content>

</ns:Mail>

</xsl:template>

</xsl:stylesheet>

Regards

Stefan