cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring Receiver mail adapter with dynamic email addresses

Former Member
0 Kudos

Hi,

I'm a newbie to XI and I have problems in configuring the Receiver mail adapter with the "Use Mail package" option selected. I am trying pickup a file (using file adapter on Sender side, picks up a simple XML file) and after mapping in XI, send the message as an email message to dynamic email addresses.

Everything works fine if I did not select the "Use Mail Package". But when I choose that option it errors out. I followed this blog posted on SDN -

/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address

The following XML message is my source

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/Somenamespace">

<ns0:Message1>

<ns1:studentlisttest xmlns:ns1="urn:karthiksender_to_karthikreceiver">

<Student>

<studentid>1</studentid>

<lastname>Studentlastname</lastname>

<firstname>Studentfirstname</firstname>

</Student>

<Mail>

<From>abc@abc.com</From>

<To>def@def.com</To>

<Subject>Test mail adapter</Subject>

</Mail>

</ns1:studentlisttest>

</ns0:Message1>

</ns0:Messages>

What I want to accomplish is, I have a simple message mapping where the Studentdetails are mapped to, lets say Customer details. For convenience lets keep it simple, StudentId --> Customerid, (student)Firstname --> (customer)Firstname, (Student)Lastname --> (customer)Lastname

I would like to get the Customer details as an XML attachment or in the body of an email with from, to and subject corresponding to that specified in the <Mail> node.

I followed the instructions posted on the blog and it works fine if I don't map the studentdetails to customerdetails. I did multimapping, with one source message (the xml file I posted above) and two target messages (customerdetails and Mail, which is the external definition posted on the blog). I beleive I'm missing something here. Could somebody please guide me through this?

Thanks

Karthik

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

you strcture has to be the same as in my weblog

(exactly)

https://websmp205.sap-ag.de/~sapidb/012006153200000361852004E/ximail30_xsd.txt

you cannot have additional fields ,segments etc

Regards,

michal

MichalKrawczyk
Active Contributor
0 Kudos

if you have sp14 for your XI

use dynamic properties:

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

with this you can set the address (e-mail)

in the mapping and you can have any mail

structure as you like

Regards,

michal

Former Member
0 Kudos

Hi Michal,

Thanks for the quick response. How should I proceed in order to get the mapping working and also mail it to the address in the message? According to my understanding, I would have one source message (the sample I gave above) and 2 target messages (one is the target customerlist message and the other one is the Mail message conforming to your schema). Am I correct? Please let me know if I'm moving in the right direction.

Thanks

Karthik

Former Member
0 Kudos

Michal,

continuing on the previous message, or should I incorporate my customer details onto your xml schema and use that as the target message?

MichalKrawczyk
Active Contributor
0 Kudos

yes

Regards,

michal

MichalKrawczyk
Active Contributor
0 Kudos

hi,

check if you have sp14 and maynbe you can put the

address in the mapping as in the weblog that I've shown you

this will be much much easier

Regards,

michal

Former Member
0 Kudos

hi,

I still have not found the solution for this problem. Michal, your blog works fine when my source message has got only the mail details. As per your advice, I tried modified the structure of the xsd file as follows

<xs:schema targetNamespace="http://sap.com/xi/XI/Mail/30"

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

xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!--

  • Mail

-->

<xs:element name="Mail">

<xs:annotation>

<xs:documentation>Mail package for XI - Mail Adapter</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence>

<xs:element name="Subject" type="xs:string" minOccurs="0"/>

<xs:element name="From" type="xs:string" minOccurs="0"/>

<xs:element name="To" type="xs:string" minOccurs="0"/>

<xs:element name="Reply_To" type="xs:string" minOccurs="0"/>

<xs:element name="Content_Type" type="xs:string" minOccurs="0"/>

<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>

<xs:element name="Message_ID" type="xs:string" minOccurs="0"/>

<xs:element name="X_Mailer" type="xs:string" minOccurs="0"/>

<xs:element name="Content" minOccurs="0">

<xs:annotation>

<xs:documentation>any type</xs:documentation>

</xs:annotation>

</xs:element>

</xs:sequence>

<xs:attribute name="encoding" type="xs:string"/>

</xs:complexType>

</xs:element>

<xs:element name="MailReceipt">

<xs:annotation>

<xs:documentation>Mail Receipt for XI - Mail Adaper</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence>

<xs:element name="Server" type="xs:string"/>

<xs:element name="Format" type="xs:string"/>

<xs:element name="UseMailPackage" type="xs:boolean"/>

<xs:element name="Encoding" type="xs:string"/>

<xs:element name="Subject" type="xs:string" minOccurs="0"/>

<xs:element name="From" type="xs:dateTime" minOccurs="0"/>

<xs:element name="To" type="xs:string" minOccurs="0"/>

<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="CustomerlistExternal">

<xs:annotation>

<xs:documentation>Customer List</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence>

<xs:element name="Customername" type="xs:string"/>

<xs:element name="Customerid" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

My source message will be something like

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:studentlisttest xmlns:ns1="urn:karthiksender_to_karthikreceiver">

<Student>

<studentid>1</studentid>

<lastname>abclname</lastname>

<firstname>abcfname</firstname>

</Student>

<Mail>

<From>abc@gmail.com</From>

<To>abc@gmail.com</To>

<Subject>Testing Mail adapter</Subject>

</Mail>

</ns1:studentlisttest>

</ns0:Message1>

</ns0:Messages>

I have mapped the <student></student> information to customerlist, with customerid --> studentid and customername --> firstname or lastname (for symplicity). This was a multimapping with one source and two target messages. My test mapping output is

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

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

<Subject>Testing Mail adapter</Subject>

<From>abc@gmail.com</From>

<To>abc@gmail.com</To>

</ns2:Mail>

</ns0:Message1>

<ns0:Message2>

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

<Customername>abclname</Customername>

<Customerid>1</Customerid>

</ns2:CustomerlistExternal>

</ns0:Message2>

</ns0:Messages>

So how would I get this part of the <CustomerlistExternal></CustomerlistExternal> part of the message as an attachment to the mail address specified in the <ns2:Mail></ns2:Mail> tags.

I'm definitely not understanding it right and am missing something. Could you give me step by step instructions to acheive this. I apologize for the trouble..this would be of great help to me.

Thanks

Karthik

Former Member
0 Kudos

Hi Karthik,

Did you get a solution to this problem ? Even i am stuck with a similar situation and the only two choices left to me are either making a custom adapter module or upgrading to SP14. I've tried every other possible way, but it fails.. If you have solved this then please let me know how you did it. You can mail me @ Qadeer786@gmail.com

Regards,

Qadeer

Former Member
0 Kudos

Qadeer,

No I haven't. I had to swtich over to another project. Let me know if you make any breakthrough.

Thanks

Karthik

Answers (0)