Sender Email Adapter: Process multiples attachments of a single email
Hello all,
is there any way to process all the attachments in a single email as different messages? I have the scenario that i receive an email with multiples attachments and i would like to process all of them as if they were single messages. Is it possible?
Thanks in advance.
Hi,
>>>I have the scenario that i receive an email with multiples attachments and i would like to process all of them as if they were single messages. Is it possible?
yes and no
no - you cannot process them as XI messages - only as one message with multiple attachments
yes - you can combine them all into one message and then split with different mappings to the same receiver
(multiple lines in interface determination)
or you can even split them one by one in the adapter module and send to XI as many messages as
attachments that you have (this approach requires some dev in the adapter module but it's doable)
Regards,
Michal Krawczyk
Similar Messages
-
Sender Mail Adapter Configuration - Process Multiple Attachments
Dear sirs,
I need to process several attachments at the same mail message as individual payloads.
In default configuration of sender mail adapter only the body of message is used as payload.
So I added PayloadSwapBean Module at Processing Sequence and it processed the attachment I set in Module Configuration. I'm not able to process all attachments available, just one attachment is sent to PI pipeline.
How can I process all attachments of a single mail message?
Thank you in advance.
Fabio PurcinoHi Jose,
We are trying to implement reading multiple attachment in sender mail adapter.
Our Requirement is : Reading a mail having multiple .xls files. This should be read and converted to payload .
package multiswap;
//import com.sap.aii.adapter.xi.ms.XIMessage;
import com.sap.aii.af.lib.mp.module.*;
import com.sap.aii.af.lib.trace.Trace;
import com.sap.aii.af.sdk.xi.mo.Message;
import com.sap.aii.af.sdk.xi.mo.MessageContext;
import com.sap.aii.af.sdk.xi.mo.xmb.XMBMessageOperator;
import com.sap.aii.af.sdk.xi.mo.xmb.XMBPayload;
import com.sap.aii.af.sdk.xi.util.PayloadType;
import com.sap.aii.af.service.auditlog.Audit;
import com.sap.aii.af.service.cpa.*;
import com.sap.engine.interfaces.messaging.api.MessageDirection;
import com.sap.engine.interfaces.messaging.api.MessageKey;
import com.sap.engine.interfaces.messaging.api.Payload;
import com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import javax.ejb.*;
public class MultiSwapRead
implements SessionBean, Module
private static final String VERSION_ID = "$Id: //tc/xpi.af/NW731EXT_07_REL/src/_af_application_ejb_module/ejbm/api/com/sap" +
"/aii/af/app/modules/PayloadSwapBean.java#1 $"
private static final Trace TRACE = new Trace("$Id: //tc/xpi.af/NW731EXT_07_REL/src/_af_application_ejb_module/ejbm/api/com/sap" +
"/aii/af/app/modules/PayloadSwapBean.java#1 $"
private static final String SIGNATURE_PROCESS = "process(ModuleContext , ModuleData)";
protected Hashtable cachedChannels;
protected SessionContext myContext;
public MultiSwapRead()
cachedChannels = new Hashtable();
public void ejbRemove()
public void ejbActivate()
public void ejbPassivate()
public void setSessionContext(SessionContext context)
myContext = context;
public void ejbCreate()
throws CreateException
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
throws ModuleException
if(TRACE.beLogged(200))
TRACE.entering("process(ModuleContext , ModuleData)", new Object[] {
moduleContext, inputModuleData
ModuleData outputModuleData;
Iterator itr;
outputModuleData = inputModuleData;
String chid = moduleContext.getChannelID();
TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, (new StringBuilder()).append("performing payload swap for channel ").append(chid).toString());
LookupManager lman = LookupManager.getInstance();
Channel chan = null;
try {
chan = (Channel)LookupManager.getInstance().getCPAObject(CPAObjectType.CHANNEL, chid);
} catch (CPAObjectNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (CPAException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Direction direction = chan.getDirection();
String swapkey = moduleContext.getContextData("swap.keyName");
String keyvalue = moduleContext.getContextData("swap.keyValue");
Object obj = inputModuleData.getPrincipalData();
Object pivotedObj = inputModuleData.getSupplementalData("mp.pivoted");
boolean pivoted = pivotedObj == null || !(pivotedObj instanceof Boolean) ? false : ((Boolean)pivotedObj).booleanValue();
Message mo = null;
if(obj instanceof com.sap.engine.interfaces.messaging.api.Message)
mo = (Message)((com.sap.engine.interfaces.messaging.api.Message)obj);
} else
if(obj instanceof MessageContext)
mo = ((MessageContext)obj).getMessage();
} else
TRACE.warningT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, "no message found");
if(mo != null && XMBMessageOperator.numberOfPayloads(mo) > 0)
// String midstr = XMBMessageOperator.getMessageId(mo).toString();
MessageKey auditkey = new MessageKey(((com.sap.engine.interfaces.messaging.api.Message) mo).getMessageId(), com.sap.engine.interfaces.messaging.api.MessageDirection.INBOUND);
itr = (Iterator) mo.getAttachments();
if(swapkey != null && keyvalue != null)
StringBuffer textSwappingbyBuf = new StringBuffer();
textSwappingbyBuf.append("Swap: swapping by '").append(swapkey).append("' ? '").append(keyvalue).append("'");
String textSwappingby = textSwappingbyBuf.toString();
TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, textSwappingby);
Audit.addAuditLogEntry(auditkey, AuditLogStatus.SUCCESS, textSwappingby);
while (itr.hasNext()){
boolean swappedp = swapPayloads(mo, swapkey, keyvalue);
String swappedStatus = swappedp ? "Swap: successfully swapped" : "Swap: no matching payload found";
Audit.addAuditLogEntry(auditkey, AuditLogStatus.SUCCESS, swappedStatus);
} else
StringBuffer textInvalidBuf = new StringBuffer();
textInvalidBuf.append("Swap: parameter missing ");
if(swapkey == null)
textInvalidBuf.append("swap.keyName");
if(swapkey == null && keyvalue == null)
textInvalidBuf.append(" and ");
if(keyvalue == null)
textInvalidBuf.append("swap.keyValue");
String textInvalid = textInvalidBuf.toString();
TRACE.warningT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, textInvalid);
Audit.addAuditLogEntry(auditkey, AuditLogStatus.WARNING, textInvalid);
} else
String messageEmpty = "Swap: message is empty or has no payload";
TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, messageEmpty);
return outputModuleData;
private static boolean swapPayloads(Message mo, String swapkey, String keyvalue)
swapkey = swapkey.toUpperCase(Locale.ENGLISH);
keyvalue = keyvalue.toUpperCase(Locale.ENGLISH);
int ifound = -1;
for(int i = 0; i < XMBMessageOperator.numberOfPayloads(mo); i++)
XMBPayload pldi = XMBMessageOperator.getPayload(mo, i);
String pldivalue = null;
if(swapkey.equals("PAYLOAD-DESCRIPTION"))
pldivalue = pldi.getPayloadDescription();
} else
if(swapkey.equals("PAYLOAD-NAME"))
pldivalue = pldi.getPayloadName();
} else
pldivalue = pldi.getContentAttribute(swapkey);
if(pldivalue == null)
continue;
pldivalue = pldivalue.toUpperCase(Locale.ENGLISH);
if(pldivalue.indexOf(keyvalue) < 0)
continue;
ifound = i;
break;
if(ifound >= 0)
XMBPayload pldfound = XMBMessageOperator.getPayload(mo, ifound);
if(pldfound.getPayloadType() != PayloadType.APPLICATION)
XMBPayload pldapp = XMBMessageOperator.getApplicationPayload(mo);
if(pldapp == null)
pldfound.setPayloadType(PayloadType.APPLICATION);
} else
pldapp.setPayloadType(PayloadType.APPLICATION_ATTACHMENT);
pldfound.setPayloadType(PayloadType.APPLICATION);
TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, "successfully swapped");
return true;
} else
TRACE.warningT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, "no matching found");
return false;
We couldn't go further. Please have a look in highlighted code.
Regards,
Kesava. -
Does the sender SOAP adapter support multiple operations per interface
Hi guys,
does the sender SOAP adapter support multiple operations per interface? (interface type of 7.1)?
Thanks,
Andrzejtheoretically Yes.
Do have a look into this when you get time
/people/shabarish.vijayakumar/blog/2010/09/08/service-interface-and-multiple-operations--is-it-just-an-hype -
Using Windows Gallery to send email photos - wioth each selection T'Bird opens a new email form. How can I set T'Bird to accept multiple attachments (similar to Gmail ).
Using W'Gallery has the benefit of rteducing size of emailed pic to a few hundre kb.
ThanksYou best ask the windows gallery people. Thunderbird opening more than one window is based on yhow the request is made, not on Thunderbird,
Selecting multiple files in explorer simply adds them to a mail, therefore the Windows gallery is the problem. -
Multiple attachments (TIF-files) in Emails
hi all,
I'm trying to send an eMail with multiple attachments (TIF-files) with the function SO_NEW_DOCUMENT_ATT_SEND_API1.
The eMail with the attachments arrives well. The problem is, when opening the attachments all look the same as the 1. attachment. The archived TIFFs are not the same and I can see that the arrived attachments have different file-lenghts.
The packing list looks like:
HEAD_START HEAD_NUM BODY_START BODY_NUM
1 1 1 57
1 1 58 198
1 1 199 415
The table-length of the first object is 57, the second object 141, the third 217.
The contents_bin table has 415 lines. I appended all object-tables to the contents_bin table.
Is there something which I have to consider especially?
Thanks and regards
OliverI had to write something similar for text files, so this may or may not be a useful tip. BODY_NUM represents the length of the text, i.e. the number of lines not the final line number. So the packing list should be
1 1 1 57
1 1 58 141
1 1 199 217
Hope this helps...although probably very out of date by now...
D. -
Why am I getting multiple copies of a single email?
I'm using Yosemite 10.10 on my mid-2012 iMac.
I've noticed that I'll often get multiple "copies" of the same email. E.g., this morning I received an email that was forwarded to me as a contact through one of my weblogs. In the Mail Inbox for the specific email account the same email appeared three times.
I've noticed this same behavior in other email Inboxes (different accounts) in Mail.
Any idea what's going on?This may have to do with the server, what kind of email are you using, and is it a group email?
Can you please provide steps you are taking with a little more detail as well? It may be a known issue, but I do not know.
I look forward to your reply! -
Outlook 2010 - can you add multiple signatures to a single email?
Basically using 2 or 3 signatures to create a quick email? By adding a 2nd or 3rd signature to a new email. I can't get this to work like it did in 2007.
Thank you for any help.Hi,
Thank you for using Outlook IT Pro Discussions forum.
We can certainly add multiple signatures to a new email.
In Outlook 2010, click
File > Options > Mail > Signature. We can add multiple signatures there, and set a default signature.
After that, when we compose an email, click the
Insert tab, click Signature in the
Include group, we can choose other signatures.
If you encounter any problems when trying to add the signatures, please let me know.
Best Regards,
Sally Tang -
I have tried creating the portfolio from Outlook directly, but only the first email is viewable in the portfolio including a hyperlink to the attachment (but the attachment is missing otherwise). This seems to be a setting issue, but I have had no luck with finding any setting options to change this.
I have also tried to create a portfolio from my desktop but when opening the portfolio, nothing shows up as if it didn't take the .msg files.
The obvious option of creating a pdf from each individual email and combining it with the pdf attachment would take forever and is unrealistic as the emails are in thousands.
Thanks for your time and help on this issue!Hey Bob%20Sacks,
Could you please specify what version of Acrobat are you using.
You can go to Preferences under Adobe PDF option in the menu bar and choose 'Include all attachments' option under Attachments label.
Then, select the desired messages in Outlook and create a PDF portfolio by right-clicking and choosing Convert to Adobe PDF option from the context menu.
Now, open the portfolio and it will appear as shown in the screenshot below:
You can view all your files by clicking on the navigation arrows on the left-hand side.
Regards,
Anubha -
I want to forward an email to multiple recipients, but instead of putting them all in BCC:, I want all the recipients to get the forward addressed just to them so it looks personalized. Any way to do this?
I'm assuming that I would have to "import" my old drive into the library
You don't import anything since your library is the same as it was. All those items are still in iTunes in the same location. The ONLY thing different is iTunes prefs -> Advanced.
Or am I wrong and it will have my previous media folder still in the library, and anything new would be put in the new media folder?
Yes & yes. Everything in iTunes will still be in iTunes, stay in the same location it is now and iTunes will use it from there.
Anything new added to iTunes will go to the location you set in iTunes prefs -> Advanced. -
Can multiple users share a single Email Account?
I set up my email account last night and everything worked perfectly. Messages downloaded from my ISP with no problems. Then I logged out of my user account and logged into my wife's user account. When I clicked on mail to test it, I realized that it is assuming she will be checking mail from a different email account. Is there a way that our seperate user accounts can share the same email account?
Technically, yes, you should be able to do this... the issue is why do you want to? If you set up her user account Mail (or whatever e-mail application you're using) preferences with the same information you used for yours (mail account name, password, SMTP information) and make sure that the "leave message on server" box is checked in the Mail preferences for both user accounts, the messages for that e-mail account can be downloaded to both user accounts. The problem is that each user would have to delete messages meant for the other. Depending on what type of mail account (IMAP, POP) it may also mean that the "new mail" status of a message may not be correct. A message read in one user's account may show up as "read" in the other. It's much tidier for each user to have their own e-mail address.
Katrina -
How to send three attachments using three queries in a single email using sp_senddbmail
Hi All,
I have three scripts for extracting permissions at server,database & object level.Now how do i can execute all three queries and send multiple attachments in a single email using sp_senddbmail.I have done this before for single queries but not multiple
queries. Kindly suggest.
Regards
RahulHi All,
The requirement was that i had three different queries for listing permissions at server,database and object level.I wanted to build an solution to email results in attachment to user.
However i have managed to do this with SSIS Package.I was curious to know if it can be done without SSIS.
Thanks you all for your time and effort for this.
Rahul
It can be done without SSIS
Just have a procedure to return three query results as a single resultset. Then use sp_send_dbmail to execute query and send results as a email
See
http://blogs.msdn.com/b/sqlagent/archive/2010/11/03/sql-database-mail-send-t-sql-results-by-email.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How to handle multiple attachments in XI mail sender adapter?
Hi,
is it possible to handle multiple attachments in a mail receiving in XI?
Our customer wants to send us mails with multiple attachments and we have to convert each attachment to an idoc.
But as I know XI (receiving mails) can handle only a single attachment in a mail. Is it true?
Any ideas?
Thanks a lot!
Regards
WolfgangHi Wolfgang,
Well, although I have never tried a scenario of picking more than two attachments from one mail, I wonder if its possible in the first place!
Here are the reasons why I think it is possible:-
It is not mentioned anywhere in the SAP Notes for mail adapter that it is not possible.
*It is not mentioned anywhere in the SAP help documentation that it is not possible
*Also, I think if the receiver mail adapter can create more than one attachment, the sender should be able to pick more than one!:)
Have you tried defining a PayloadSwapBean module to pick up more than one attachment?
Just try experimenting with this particular part of the module code:-
Content-Disposition: attachment;filename="MailAttachment-1.xml"
Content-Description: MailAttachment-1
I think even the following weblog might be able to help you to a certain extent:-
"Receiving E-Mail and processing it with ABAP - Version 610 and Higher" - /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
Regards,
Sushumna
Regards,
Sushumna -
Submitting Multiple Attachments in One Email
I am using the iPad 2 to generate PDF contracts. The contracts are then e-mailed to my support group which processes the files to enroll a new client. I need to be able to include mutliple PDF's in a single e-mail, however there is no option in e-mail to add attachments so I am forced to send them one at a time through the PDF application. This is counterintuitive to the convenience and time savings of using the iPad to coduct business in the first place. Can anyone offer a suggestion or recommend an application that will allow the submission of multiple attachments in a single e-mail?
dont believe it's possible
-
I am new to IPAD use and need to forward one attachment from an original email that contains multiple attachments - how can I isolate and forward only one of the attachments?
Aha! I have been doing just that. However, what has been tripping me up is that I am also used to clicking the Go Online/Go Offline toggle button on the top menu bar when I manually check for messages on Cox. Apparently when you take one inbox offline, that button switches to Off even though the other inbox is still online. If I just ignore that button and go on or off via the cox mailbox listing, it keeps comcast from being reactivated.
Thanks so much for helping me think this through.
Edited to add: I removed that dang button from my menu so I can stop clicking it. -
Sending mail with multiple attachments
hi.I wrote a code to send mail.but i need to send mail with multiple attachments.here is the code i wrote.what should i do to send the mail with multiple attachments.if i run this code iam able to send mails but not attachments.please help me
<%@ page import="javax.mail.*,javax.mail.internet.*,java.util.Date,java.io.*,java.net.InetAddress,java.sql.*,java.util.Properties,java.net.*,javax.sql.*,javax.activation.*,java.util.*,java.text.*" %>
<%@ page import="java.io.*,java.sql.*,java.net.*,java.util.*,java.text.*" %>
<%
String Attachfiles1="";
String Attachfiles2="";
String Attachfiles3="";
if("Send".equalsIgnoreCase("send"))
try
String subject="",from="",url = null,to="";
String mailhost = "our local host";
Properties props = System.getProperties();
String msg_txt="";
String strStatus="";
// byte[] bin=.....;
//Adds Attechment:
Multipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText("Here are my attachments");
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
//first attachment
DataSource source = new FileDataSource("C:\\img1.jpg");
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName("C:\\Telnor1.jpg");
multipart.addBodyPart(messageBodyPart);
//Second attachment
DataSource source2 = new FileDataSource("C:\\img2.jpg");
messageBodyPart.setDataHandler(new DataHandler(source2));
messageBodyPart.setFileName("C:\\Telnor2.jpg");
multipart.addBodyPart(messageBodyPart);
//etc...
message.setContent(multipart);
Transport.send( message );
String mailer = "MyMailerProgram";
to=request.getParameter("to");
from=request.getParameter("from");
subject=request.getParameter("subject");
msg_txt=request.getParameter("message");
props.put("mail.smtp.host", mailhost);
Session mailsession = Session.getDefaultInstance(props, null);
Message message = new MimeMessage(mailsession);
message.setFrom(new InternetAddress(from));
message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
message.setSubject(subject);
message.setHeader("X-Mailer", mailer);
message.setSentDate(new Date());
message.setText(msg_txt);
BodyPart messageBodyPart = new MimeBodyPart();
BodyPart messageBodyPart2 = new MimeBodyPart();
Multipart multipart = new MimeMultipart(); // to add many part to your messge
messageBodyPart = new MimeBodyPart();
javax.activation.DataSource source = new javax.activation.FileDataSource("path of the file");
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName("file_name");
messageBodyPart2.setText("message"); // set the txt message
multipart.addBodyPart(messageBodyPart);
multipart.addBodyPart(messageBodyPart2);
Transport.send(message);
out.println("Message Sent");
catch (Exception e)
e.printStackTrace();
if("Attachfiles".equalsIgnoreCase("attachfiles"))
Attachfiles1=request.getParameter("fieldname1");
Attachfiles2=request.getParameter("fieldname2");
Attachfiles3=request.getParameter("fieldname3");
%>
<html>
<body>
<div class="frame">
<form action="Composemail.jsp" method="post">
<b>SelectPosition:</b> <select name="cars" >
<option value="ABAP">ABAP
<option value="saab">Saab
<option value="fiat">Fiat
<option value="audi">Audi
</select><br><br>
<table border="1" cellpadding="2" cellspacing="2">
<tr><th>Name</th>
<th>EmailId</th>
<th>ContactNumber</th>
<th>Position</th>
</tr>
<tr>
<td>
</td>
</tr>
</table><br>
<b>SelectUser :</b><select name="cars">
<option value="Administrator">Administrator
<option value="saab">Saab
<option value="fiat">Fiat
<option value="audi">Audi
</select>
<br>
<b>To :</b>           <input type="text" name="to" size="72"><br>
<b>From :</b>       <input type="text" name="from" size="72"><br>
<b>Subject :</b>   <input type="text" name="subject" size="72"><br>
<%=Attachfiles1%><br><%=Attachfiles2%><br><%=Attachfiles3%><br><br>
<b>Message:</b><br>
            <textarea rows="10" cols="50" name="message">
</textarea> <br><br>
<b>AttachedFile:</b> <input type="file" name="fieldname1" value="filename" size="50"><br><br>
<b>AttachedFile:</b> <input type="file" name="fieldname2" value="filename" size="50"><br><br>
<b>AttachedFile:</b> <input type="file" name="fieldname3" value="filename" size="50"><br><br>
            <input type="submit" name="attachfiles" value="Attachfiles">
<center>
<input type="submit" name="send" value="Send" >
</center>
</form>
</div>
</body>
</html>Create a separate MimeBodyPart object for each attachment, rather than reusing
the same one over and over.
Maybe you are looking for
-
SAX problem(plz see the code given)
hi all, i am using SAX parser for validating my xml file against the dtd,i am getting some errors that i am not able to make out.cud u plz help me.i am sending u my files. ------------------------java file------------------------------------ import j
-
Unusual permissions repair msg on Leopard
After a couple bumpy weeks on Leopard it's finally stabilizing... but I do need to repair permissions about once per week due to sluggishness after installing new software... and the last two times I've received the same error msg: Repairing permissi
-
Question regarding the date in MARC for a daily movement report
Hi, I have a requirement, where i need to create a report, based on the selection screen parameters for <u>purchasing group</u> and <u>date</u> (the default is 1 minus the current date.) The report is used to view the daily movement, relating to the
-
Exporting PHotoshop layered file to Illustrator. Is this possible?
I built a project within Photoshop CS2, complete with layers. But I need to export this artwork to be used in Illustrator. Can I do this? I've already tried saving the work as EPS but when it's opened in AI CS2, it displays nothing. What should I do?
-
Cant oppen some word docs in Pages - it works with others
why cant I open some word documents in Pages - others work fine?