Skip to Content
author's profile photo Former Member
Former Member

sending file(from the application server) as an attachment in mail in backg

hi all,

I am having one problem and it goes like this:

i am having one XML file in the application server and i want to send this XML file as an attachment via email in back ground,

can any one help me in this???




Edited by: Alvaro Tejada Galindo on Jan 29, 2008 11:40 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 04:54 PM



    *Configuring the Receiver Mail Adapter*

    For outgoing mails, you need SMTP or IMAP4 access to your mail server. To access the mail server, enter the following URL:

    smtp://YourServer or imap://YourServer/YourInbox

    By selecting the Use Mail Package checkbox, you can include additional information to the XI message payload, that is, the mail sender.

    If the mail has a plain-text format, you can select the Use Mail Package checkbox to convert the mail message to XML.

    Working with Mail Packages

    You can dynamically set the sender, receiver, and mail title by using the mail package format. When the mail package format is used, your structure of the payload must adhere to the structure of the mail package.

    You can create the mail package structure using the graphical mapping tool. The XSD of the mail package is provided as an attachment in SAP Note 748024.

    Creating a Mail Package with XSLT Mapping

    If you want to determine the mail receiver dynamically from a payload field, but want the

    payload to be sent unchanged, sometimes it is too complicated to use the graphical

    mapping tool to create the mapping. The following figure provides an XSLT example that you can use, if your original payload provides the tags sender, receiver, and subject. The XSLT will set these values and copy the whole payload to the Content tag. The original payload will be the mail body."


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

    <xsl:template match="*">">

    <Subject><xsl:value-of select="//subject"/></Subject>

    <From><xsl:value-of select="//sender"/></From>

    <To><xsl:value-of select="//receiver"/></To>

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




    When you use the MessageTransformBean module in the module processor

    configuration of the communication channel, you can directly apply the XSLT mapping to the adapter module.

    Enter localejbs/AF_Modules/MessageTransformBean as the first module. Select

    the Type Local Enterprise Bean and select a value for Module Key.

    You can also use the XSLT file for an interface mapping in the Integration Repository.

    Changing the Name and Type of the Payload

    By default, the payload of the XI message is sent as an attachment. If you use mail

    package, the mail text in the Content tag is sent as a mail body (inline). If you want to change this or influence the name of the attachment, you can do this using the

    MessageTransformBean module.

    Enter localejbs/AF_Modules/MessageTransformBean as the first module.

    Select the Type Local Enterprise Bean and select a value for Module Key.

    If you use the Mail Package, then you have to apply the Mime type in the tag



    <Content>This is a mail</Content>

    <Content_Type>text/plain; charset="ISO-8859-1";



    Exactly how the mail content is displayed at the receiver end depends on the mail client. If the customer has a different mailing system, the mail look may look different at the customer side.

    Sending a Mail with Attachment (That is what you need)

    If you want to send a mail with a body and attachment, or with several attachments, the message sender has to provide an XI message with additional attachments. For each additional payload of the XI message, the mail adapter creates an attachment for the mail. To enable this feature, you select the Keep Attachments checkbox when configuring the mail adapter. By default, the payload of the message is also sent as an attachment. If you do not want the payload to be sent as an attachment, set ContentDisposition to inline. If you want to give each attachment a certain name, you can use the swap module. The swap module changes the main payload.

    Enter the localejbs/AF_Modules/PayloadSwapBean module as Local

    Enterprise Bean between the two modules that change the attachment names.

    Select a value for Module Key.

    You can find the name of the payload that you want to set as the main payload in the XI message monitor (SXMB_MONI).

    Useful SAP Notes

    SAP Note 748024: Here you can download the XSD structure of the Mail Package.

    SAP Note 794943: Description of the module “PayloadSwapBean”

    SAP Note 793922: Description of the module



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi mrutyunjaya,

      I have no idea about XI, i am using simple call transformation to convert the abap code to xml and storing the file to application server, without using xi can i send the file from application server as an attachment via mail,

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.