How to receive mutilple attachment files using pop3
i have problem to receive multiple attachment file.
how we can find out attachment in a forwarded messages.
private void processMessage(Message message) throws MessagingException, IOException
Object obj = message.getContent() ;
String disposition = message.getDisposition() ;
if (disposition == null)
if (obj instanceof String)
System.out.println(obj.toString());
else if (obj instanceof Multipart)
processMultipart((Multipart) obj) ;
else if (obj instanceof InputStream)
processInputStream(message);
else if (obj instanceof InputStream || disposition.equals("inline") ||
disposition.endsWith("attachment"))
processInputStream( message) ;
else
System.out.println("Dont know the type " + obj) ;
private void processMultipart(Multipart multipart) throws
IOException, MessagingException
int count = multipart.getCount() ;
for (int j = 0 ; j < count ; j++)
BodyPart bodypart = multipart.getBodyPart(j) ;
String disposition = bodypart.getDisposition() ;
if (disposition == null)
Object ob = bodypart.getContent() ;
if (ob instanceof String)
System.out.println(obj.toString());
else if (ob instanceof Multipart)
processMultipart( (Multipart) ob) ;
else if (ob instanceof InputStream)
processInputStream(bodypart) ;
else if (ob instanceof Message)
processMessage((Message) ob) ;
else
System.out.println("Object type not found >> " + ob) ;
else if (disposition.equals("inline") || disposition.endsWith("attachment"))
processInputStream(bodypart) ;
else
System.out.println("No handling of Disposition type " + disposition) ;
private void processInputStream(BodyPart bodyPart) throws MessagingException, IOException
MimeBodyPart mbp = (MimeBodyPart) bodyPart ;
String name = mbp.getFileName() ;
if (name == null)
if (mbp.isMimeType("text/plain"))
name = "text.txt" ;
else if (mbp.isMimeType("text/html"))
name = "text.html" ;
else if (mbp.isMimeType("image/gif"))
name = "image.gif" ;
else if (mbp.isMimeType("image/jpeg"))
name = "image.jpeg" ;
else
name = "temp.tmp" ;
writeInFile(mbp.getInputStream(),name);
private void processInputStream(Message message) throws
MessagingException, IOException
MimeMessage mimeMessage = (MimeMessage) message ;
String name = mimeMessage.getFileName() ;
if (name == null)
if (mimeMessage.isMimeType("text/plain"))
name = "text.txt" ;
else if (mimeMessage.isMimeType("text/html"))
name = "text.html" ;
else if (mimeMessage.isMimeType("image/gif"))
name = "image.gif" ;
else if (mimeMessage.isMimeType("image/jpeg"))
name = "image.jpeg" ;
else
name = "temp.tmp" ;
writeInFile(mimeMessage.getInputStream(),name);
private void writeInFile(InputStream in,String name)
File file=new File(name);
FileOutputStream out=new FileOutputStream(file);
byte[] bytes = new byte[1024] ;
int i = -1 ;
while ( (i = in.read(bytes)) != -1)
out.write(bytes, 0, i) ;
in.close() ;
out.close() ;
}
Similar Messages
-
How to receive a gif file using a custom ABAP FM
Hi Experts,
Here is my requirement.
I have to provide an interface which should receive a GIF file.
I have created a FM but what data type should I define in the import parameter or the table parameter to receive the GIF file (which has been converted to binary format by the other application).
Thanks in advance.Hi,
Do not type it to any associated type.
Create a tables parameter with some name.
Actually the FM GUI_UPLOAD does the same thing(Just that it is not RFC enabled).
YOu can check its code.
Regards,
Ravi -
How To Open PDF Attached file use CLIENT_HOST 11 g forms
How to open pdf file on client side at 11 g forms ?
when i open any attached (PDF )file on client side is not open those file open on server side plz guide me how to open those file on client machine using client host?
thanksWhere is the pdf you are trying to open? Is it on the server or the client? If the file is stored on the server then you can access it using WEB.SHOW_DOCUMENT assuming it is stored in a place that has a virtual mapping. For example:
WEB.SHOW_DOCUMENT ('http://server/someLocation/file.pdf','_blank');If the file is on the client then you need to configure your application to use WebUtil. Then you can do what Francois suggested. -
Receiving mails in Oracle using POP3
Hi,
Kindly let me know how to receive mails in Portal using POP3.
Thanks in advance.
Regards,
A.K.S.Srinivassan.Hi,
The issue has been traced out!
In my case, the issue was because of some error in the SMTP server settings. It was not able to send mails to SAP. And I was hunting in SAP to trace the error
OSS note 455140 is really useful
Regards,
Saumya -
Does anyone know how i can view PDF files using Galaxy Note 2?
Does anyone know how i can view PDF files using Galaxy Note 2?
This is what i have been doing;
I click on the file i wish to view (via a portal)
this file goes to notification widget (i drag down screen)
notification/message says download complete
i click on notification/message
nows it says complete action using (here i only have 2 icon options 1= DB Text Editor 2 = HTML Viewer)
I have installed Adobe Reader.Can you confirm if the downloaded file is a pdf file, that is it ends with .pdf?
-
How to create new XML file using retreived XML content by using SAX API?
hi all,
* How to create new XML file using retreived XML content by using SAX ?
* I have tried my level best, but output is coming invalid format, my code is follows,
XMLFileParser.java class :-
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
public class PdfParser extends XMLFilterImpl {
private TransformerHandler handler;
Document meta_data;
private StringWriter meta_data_text = new StringWriter();
public void startDocument() throws SAXException {
void startValidation() throws SAXException {
StreamResult streamResult = new StreamResult(meta_data_text);
SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
try
handler = factory.newTransformerHandler();
Transformer transformer = handler.getTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
handler.setResult(streamResult);
handler.startDocument();
catch (TransformerConfigurationException tce)
System.out.println("Error during the parse :"+ tce.getMessageAndLocation());
super.startDocument();
public void startElement(String namespaceURI, String localName,
String qualifiedName, Attributes atts) throws SAXException {
handler.startElement(namespaceURI, localName, qualifiedName, atts);
super.startElement(namespaceURI, localName, qualifiedName, atts);
public void characters(char[] text, int start, int length)
throws SAXException {
handler.characters(text, start, length);
super.characters(text, start, length);
public void endElement(String namespaceURI, String localName,
String qualifiedName) throws SAXException {
super.endElement("", localName, qualifiedName);
handler.endElement("", localName, qualifiedName);
public void endDocument() throws SAXException {
void endValidation() throws SAXException {
handler.endDocument();
try {
TransformerFactory transfactory = TransformerFactory.newInstance();
Transformer trans = transfactory.newTransformer();
SAXSource sax_source = new SAXSource(new InputSource(new StringReader(meta_data_text.toString())));
DOMResult dom_result = new DOMResult();
trans.transform(sax_source, dom_result);
meta_data = (Document) dom_result.getNode();
System.out.println(meta_data_text);
catch (TransformerConfigurationException tce) {
System.out.println("Error occurs during the parse :"+ tce.getMessageAndLocation());
catch (TransformerException te) {
System.out.println("Error in result transformation :"+ te.getMessageAndLocation());
} CreateXMLFile.java class :-
Sax.startDocument();
Sax.startValidation();
Sax.startElement("", "pdf", "pdf", new AttributesImpl());
Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());
String xmp_str = new String(meta_data.getByteArray(),"UTF8");
char[] xmp_arr = xmp_str.toCharArray();
Sax.characters(xmp_arr, 0, xmp_arr.length);
Sax.endElement("", "pdf", "pdf");
Sax.endValidation();
Sax.endDocument();
Sax.endElement("", "basic-metadata", "basic-metadata");* In CreateXMLFile.java
class, I have retreived the xml content in the meta_data object, after that i have converted into character array and this will be sends to SAX
* In this case , the XML file created successfully but the retreived XML content added as an text in between basic-metadata Element, that is, retreived XML content
is not an XML type text, it just an Normal text Why that ?
* Please help me what is the problem in my code?
Cheers,
JavaImranSax.startDocument();
Sax.startValidation();
Sax.startElement("", "pdf", "pdf", new AttributesImpl());
Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());
String xmp_str = new String(meta_data.getByteArray(),"UTF8");
char[] xmp_arr = xmp_str.toCharArray();
Sax.characters(xmp_arr, 0, xmp_arr.length);
</code><code>Sax.endElement("", "basic-metadata", "basic-metadata");</code>
<code class="jive-code jive-java">Sax.endElement("", "pdf", "pdf");
Sax.endValidation();
Sax.endDocument();
* I HAVE CHANGED MY AS PER YOUR SUGGESTION, NOW SAME RESULT HAS COMING.
* I AM NOT ABLE TO GET THE EXACT OUTPUT.,WHY THAT ?
Thanks,
JavaImran{code} -
How to upload an excel file using ABAP.
Hi,
Can anyone please help me in understanding how to upload an excel file using ABAP.
Thanks!!http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table/
check the link
TYPES: Begin of t_record,
name1 like itab-value,
name2 like itab-value,
age like itab-value,
End of t_record.
DATA: it_record type standard table of t_record initial size 0,
wa_record type t_record.
DATA: gd_currentrow type i.
*Selection Screen Declaration
PARAMETER p_infile like rlgrap-filename.
*START OF SELECTION
call function ALSM_EXCEL_TO_INTERNAL_TABLE
exporting
filename = p_infile
i_begin_col = 1′
i_begin_row = 2′ Do not require headings
i_end_col = 14′
i_end_row = 31′
tables
intern = itab
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e010(zz) with text-001. Problem uploading Excel Spreadsheet
endif.
Sort table by rows and colums
sort itab by row col.
Get first row retrieved
read table itab index 1.
Set first row retrieved to current row
gd_currentrow = itab-row.
loop at itab.
Reset values for next row
if itab-row ne gd_currentrow.
append wa_record to it_record.
clear wa_record.
gd_currentrow = itab-row.
endif.
case itab-col.
when 0001′. First name
wa_record-name1 = itab-value.
when 0002′. Surname
wa_record-name2 = itab-value.
when 0003′. Age
wa_record-age = itab-value.
endcase.
endloop.
append wa_record to it_record.
*!! Excel data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop. -
How to read a text file using Java
Guys,
Good day!
Please help me how to read a text file using Java and create/convert that text file into XML.
Thanks and God Bless.
Regards,
I-Talkpublic void fileRead(){
File aFile =new File("myFile.txt");
BufferedReader input = null;
try {
input = new BufferedReader( new FileReader(aFile) );
String line = null;
while (( line = input.readLine()) != null){
catch (FileNotFoundException ex) {
ex.printStackTrace();
catch (IOException ex){
ex.printStackTrace();
}This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
cheers
Mohammed Jubaer Arif. -
How to specify a mapping file using annotations?
Hi,
i am trying to deploy a WebService (with annotations) on oc4j 10.1.3.1.0. but all i get is the following exception:
07/03/13 12:41:52 oracle.j2ee.ws.common.tools.api.ValidationException: test.datamodel.SimpleObjectId - Duplicate type name "test.datamodel.SimpleObjectId" for Java type "{http://tdeer.de/services/internal/test/1_0}SimpleObjectId" found. To remove this error do not specify a single typeNamespace for all value types or specify a mapping file. This error could also be caused when an erroneous type has been used more than once.
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.modeler.rmi.RmiModeler.buildModel(RmiModeler.java:247)
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:173)
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.Processor.runModeler(Processor.java:72)
07/03/13 12:41:52 at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator$DeploymentCompileTool.run(DeploymentGenerator.java:200)
07/03/13 12:41:52 at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator.generateDeploymentArtifacts(DeploymentGenerator.java:131)
07/03/13 12:41:52 at oracle.j2ee.ws.common.metadata.annotation.EJBWebServiceAnnotationParser.parseAnnotatedBean(EJBWebServiceAnnotationParser.java:165)
07/03/13 12:41:52 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
07/03/13 12:41:52 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
07/03/13 12:41:52 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
07/03/13 12:41:52 at java.lang.reflect.Method.invoke(Method.java:585)
07/03/13 12:41:52 at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationListener.parseAnnotatedClass(WebServiceAnnotationListener.java:85)
07/03/13 12:41:52 at com.evermind.server.ejb.AnnotationParser.notifyAnnotationListeners(AnnotationParser.java:201)
07/03/13 12:41:52 at com.evermind.server.ejb.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
07/03/13 12:41:52 at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(EJBPackageDeployment.java:939)
07/03/13 12:41:52 at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:832)
07/03/13 12:41:52 at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:217)
07/03/13 12:41:52 at com.evermind.server.Application.setConfig(Application.java:413)
07/03/13 12:41:52 at com.evermind.server.Application.setConfig(Application.java:314)
07/03/13 12:41:52 at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1853)
07/03/13 12:41:52 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
07/03/13 12:41:52 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
07/03/13 12:41:52 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
07/03/13 12:41:52 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
07/03/13 12:41:52 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
07/03/13 12:41:52 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
07/03/13 12:41:52 at java.lang.Thread.run(Thread.java:595)
07/03/13 12:41:52 Caused by: oracle.j2ee.ws.common.processor.modeler.rmi.InvalidParameterException: test.datamodel.SimpleObjectId - Duplicate type name "test.datamodel.SimpleObjectId" for Java type "{http://tdeer.de/services/internal/test/1_0}SimpleObjectId" found. To remove this error do not specify a single typeNamespace for all value types or specify a mapping file. This error could also be caused when an erroneous type has been used more than once.
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.addTypeName(LiteralTypeModeler.java:1249)
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.processClass(LiteralTypeModeler.java:290)
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.modelTypeLiteral(LiteralTypeModeler.java:235)
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.modelTypeLiteral(LiteralTypeModeler.java:181)
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.modelSubclasses(LiteralTypeModeler.java:1048)
07/03/13 12:41:52 at oracle.j2ee.ws.common.processor.modeler.rmi.RmiModeler.buildModel(RmiModeler.java:210)
07/03/13 12:41:52 ... 25 more
The Stateless-SessionBean has one WebMethod with the following Signature:
public Element getElement(TestObjectId1 pObjectId1, TestObjectId2 pObjectId2) throws RemoteException
TestObjectId1 and TestObjectId2 have the same Superclass, SimpleObjectId.
How to specify a mapping file using annotations?
Thanks
tdeerWe you codegen a Policy annotated WSDL, the policies are get included in the stub. Hence you don't have to specify a separate Policy file.
But if you need to use a separate policy then you need to set them in the AxisDescription object that you use in the ServiceClient and OperationClient.
e.g.
ServiceClient serviceClient = new ServiceClient();
OperationClient operationClient = serviceClient
.createClient(ServiceClient.ANON_OUT_IN_OP);
FileInputStream fis = new FileInputStream("path-to-policy.xml");
Policy servicePolicy = PolicyEngine.getPolicy(fis);
AxisService axisService = serviceClient.getAxisService();
axisService.getPolicyInclude().setPolicy(servicePolicy);
If you need more information please repost this to [email protected] with a [AXIS2] subject prefix. -
How to open a pdf file using OPEN DATASET
Im trying to convert a pdf into binary format. So im trying to read the contents of the pdf into a XSTRING. Using the FM 'SCMS_XSTRING_TO_BINARY' i can convert the XSTRING to binary format.
How to open a pdf file using OPEN DATASET and transfer its contents in a XSTRING variable.
What i've tried is....
DATA: f_name type string value 'C:\rep_output_pdf.pdf',
x1 type xstring,
LT_DATA TYPE STANDARD TABLE OF X255.
OPEN DATASET f_name FOR input IN BINARY MODE.
READ DATASET f_name INTO x1.
CLOSE DATASET f_name.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = x1
TABLES
BINARY_TAB = LT_DATA.
Im getting a short dump .
Short text: The file is not open.
Plz help me out.Hello Rajesh,
You are trying to do use OPEN DATASET with a local file. NOT POSSIBLE
You have to have the file in the app server to use OPEN DATASET.
BR,
Suhas -
How do I download PDF files using Safari. All I get is a black screen.
How do I download PDF files using Safari. All I get is a black screen.
Back up all data.
Quit Safari. In the Finder, select Go ▹ Go to Folder... from the menu bar, or press the key combination shift-command-G. Copy the line of text below into the box that opens, and press return:
/Library/Internet Plug-ins
From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then launch Safari and test.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
How to check & unzip zip file using java
Dear friends
How to check & unzip zip file using java, I have some files which are pkzip or some other zip I want to find out the type of ZIp & then I want to unzip these files, pls guide me
thanksHow to check & unzip zip file using java, I have
ve some files which are pkzip or some other zip I
want to find out the type of ZIp & then I want to
unzip these files, pls guide meWhat do you mean "other zip"? Either they're zip archives or not, there are no different types. -
To send attachment file using SMTP
Hi,
Can anybody help me to send an attachment file using SMTP?
Regards,
Rakeshdo a search at asktom.oracle.com for javamail
javamail is an api provided by sun (for free!), which allows you to send attachements and much more.
greetings
Freek D
Hi,
Can anybody help me to send an attachment file using SMTP?
Regards,
Rakesh -
How to upload a excel file using BDC
how should i upload a file using BDC
i have downloaded a excel file containing the values of table A006 a X server.
now i hav to upload it into new server Y server using BDC , how do i do it?
wat all things one shud consider ?Hi,
This is very simple, follow the below mention steps to do so:
1.Declare an internal table having same structure as db table, but take all the fields type as 'C' and length same as defined in the table.
TYPES:BEGIN OF it,
key(20) TYPE c,
indicator(20) TYPE c,
bldat(20) TYPE c,"bkpf-bldat
budat(20) TYPE c,"bkpf-budat
END OF it.
DATA: itab TYPE STANDARD TABLE OF it,
wa TYPE it.
2.Include TRUX as type pool and declare a variable of type trux_t_text_data to be passed in the FM that actually reads data from excel sheet into above declared intrenal table.
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
3. Call the FM 'TEXT_CONVERT_XLS_TO_SAP' and pass the file name and the internal table name into the parameter
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file "name of the excel file
TABLES
i_tab_converted_data = itab[] "internal table where data will be stored
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
4. loop at internal table and modify the ztable/dbtable where data to be upload .
Hope this solve your problem.
Pooja -
How can I add attachment files – or photos – to my created Adobe reader XI files?
How can I add attachment files – or photos – to my created Adobe reader XI files?
Hi adel ghonim,
You can add images following the instructions in this Help article: Adobe Acrobat X Standard * Paste images as comments.
You can also add attachments by clicking the paperclip icon in the left column of the Acrobat window...
Please let me know if you need further assistance.
Best,
Sara
Maybe you are looking for
-
Error while importing a transport request
Hi, I installed two SAP ECC6 EHP6 IDES sytems and created a transport route between them. When I try to import a Transport request I get the following error: HALT: inconsistent preview tables E071K_STR (size=344) and E071KS_PREVIEW (size=128) Please
-
Can anyone help me?? I recently downloaded iTunes 7 and didn't seem to be having problems with it. That is until I tried to purchase an album from iTunes. I paid for the album and went to download it and it gave me error -50. I reported the error a w
-
How to set security group as primary site collection admin and secondary site collection admin using powershell in sharepoint online site - office 365?
-
Hi, I found a script on this page http://d.hatena.ne.jp/kamiseto/ The author uses this line : bt.body = toInDesign.toSource()+"("+contents.toSource()+","+gb.toSource()+","+kumi.toSource()+");"; I tried to use this syntax and my script didn't produce
-
IMessage merging on two iphones
I have four iPhones on one Apple ID using AT&T. Since updating one iPhone 4S to ios7 iMessages has merged my iphone with another iphone. We are seeing each other's messages. Any ideas?