CAF Core & Java Mail

Hi experts,
i am wondering if it is possible to use Javax.Mail api in an Application Service. Does anyone have experience with this? Or does anyone know how to add the library into an application Service?
Thanks in advance,
best regards,
Rene
Message was edited by:
        Rene Zander

Hi,
i solved it, it is possible with external library DC.
Rene

Similar Messages

  • External WebService call from CAF Core returns Invalid soap message

    I am trying to perform the very simple action of calling a WebService from a CAF Core app service.
      1. I imported the WS (Axis Web service running on NW 2004s SP9 server) with WSDL (option 2 on import external service page).
      2. I then assembled the call in an app service method and invoke it.
      3. I made sure to configure the end point for the service and the method using the External Service configuration.
    When I execute the CAF core method using a simple Callable Object test client, I get the following error:
    com.sap.caf.mp.base.exception.EngineException: Invalid soap message received
         at com.sap.caf.mp.core.data.service.manager.wsdl11.SOAPToMessageValueConverter.processComplexTypeMode(SOAPToMessageValueConverter.java:290)
         at com.sap.caf.mp.core.data.service.manager.wsdl11.SOAPToMessageValueConverter.generateComplexTypeValue(SOAPToMessageValueConverter.java:179)
         at
    truncated.
    I have also captured the XML request/reponse trace using tcpmon :
    REQUEST:
    POST /NWTestExpressWAR/services/TestExpressService HTTP/1.1
    Host: 192.168.99.120:8078
    Content-Type: text/xml; charset=UTF-8
    Content-Length: 348
    SOAPAction: http://www.testsys.com/TestExpressService/getAvailableModels
    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><ns1:GetAvailableModels xmlns:ns1="http://www.testsys.com/TestExpressService"/></SOAP-ENV:Body></SOAP-ENV:Envelope>
    RESPONSE:
    HTTP/1.1 200 OK
    Server: SAP J2EE Engine/7.00
    Set-Cookie: saplb_*=(J2EE11743000)11743050; Version=1; Path=/
    Content-Type: text/xml; charset=utf-8
    Date: Mon, 04 Dec 2006 02:19:39 GMT
    Transfer-Encoding: chunked
    Set-Cookie: JSESSIONID=(J2EE11743000)ID1261187150DB11296929644926762709End; Version=1; Domain=192.168.99.120; Path=/
    1f3
    <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><GetAvailableModelsResponse xmlns="http://www.testsys.com/TestExpressService"><modelNames><name>Great Oak Manufacturing-January03 Test</name><name>PriceCheck-default</name></modelNames><errorMessagesReturn/></GetAvailableModelsResponse></soapenv:Body></soapenv:Envelope>
    0
    The only problem I can think off is that the transfer-encoding is marked as chunked which is causing the characters '1f3' and '0' to appear after and before the response and that this is causing the app to crash.
    192.168.99.120 is the server the hosts the WS. It is also a 2004s SP9 server. The client server that hosts the CAF core service is of the same configuration. 8078 is the port I redirect for tcpmon purposes.
    Could anyone shed some light on my problem?
    Thanks,
    Pratap.

    It looks like NW WS client cannot handle Transfer-encoding of chunked even though this is part of HTTP 1.1. What seems to be happening is that the NW WS client is creating a HTTP 1.1 request. The service (axis ws running on NW) seeing this is creating a HTTP 1.1 response w/ chunked encoding. However, the client cannot handle this encoding and barfs. The solution is to change the service to return a HTTP/1.0 response since NW cant handle HTTP 1.1.
    Pratap.

  • Java mail Demo Web App

    I have tried to run and deploy demo web app that comes with java mail 1.3, but while logging i have got the following error:
    javax.mail.MessagingException: Connection timed out: connect; nested exception is: java.net.ConnectException: Connection timed out: connect
    And while sending message it generates the following error:
    A Servlet Exception Has Occurred
    org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/products/javamail/demo/webapp) cannot be resolved in either web.xml or the jar files deployed with this application
         at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:194)
         at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:174)
         at org.apache.jasper.compiler.JspParseEventListener.processTaglibDirective(JspParseEventListener.java:1148)
         at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:755)
         at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:121)
         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:243)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:1132)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:1091)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:1087)
         at org.apache.jasper.compiler.ParserController.parse(ParserController.java:213)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210)
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:543)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:430)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:354)
         at FilterServlet.doPost(FilterServlet.java:61)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:1145)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1005)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098)
         at java.lang.Thread.run(Thread.java:534)
    Please send me a fully working war file if any one have with the web server used ! Please I have to subit this as my assignment!

    You might want to try the latest version of that app included
    with JavaMail 1.4. It has a few fixes that might help you.
    Hopefully you're not going to take credit for this with your
    assignment. :-)

  • Using Java mail API from JSPDynPage

    Hi Experts,
    I am working on a Portal Assignment that requiresto sent work flow mails on the basis of error conditions.
    Can u please suggest if at all I can use Java Mail APIs from JSP page within the JSP DYN Page Framework.
    If at all Java Mail can be used could u please suugest some help docs on the same.
    Thanks for the help.
    Manab C Ghosh
    EP Consultant
    Kolkata INDIA
    +919830603327

    Hi Experts,
    Thanks for all the responses to my Mail question(mailing from JSPDynPage).
    I have found the solution.
    Here is how I have got the things: (pls note there are other solns)
    Using Java Mail APIs;
    Create a Java file in the scr.core / src.api
    MailSender.java
    * Created on Jul 21, 2005
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    package com.mailsend.test;
    import java.util.Date;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMultipart;
    * Edited on Jul 24, 2005
    * @author Manab C Ghosh
    public class MailSender {
         public String sendMessage(){
            String msg ="Hello mail Test";
            String smtpServer ="mySMTPServer";
            String smtpSender = "senderemailaddress";
            String smtpRecipient="receipientemailaddress";
            String stBody =  msg ;
            //String stDate = new Date().toString() ;
            String stSubject = "Mail Test ";
            Send(     smtpServer,          //SMTPServer
                      smtpSender,          //Sender
                      smtpRecipient,     //Recipient
                      stSubject,          //Subject
                      stBody               //Body
                        );               //Attachments                    
         return "Mail Success";
    public static void Send(String SMTPServer,
                                  String From,
                                  String To,
                                  String Subject,
                                  String msgText1
            // Error status;
            int ErrorStatus = 0;
            // create some properties and get the default Session
            Properties props = System.getProperties();
            props.put("mail.smtp.host", SMTPServer);
            Session session = Session.getDefaultInstance(props, null);     
            try {
                 // create a message
                 MimeMessage msg = new MimeMessage(session);
                 msg.setFrom(new InternetAddress(From));
                 InternetAddress[] address = {new InternetAddress(To)};
                 msg.setRecipients(Message.RecipientType.TO, address);
                 msg.setSubject(Subject);
                 // create and fill the first message part
                 MimeBodyPart mbp1 = new MimeBodyPart();
                 mbp1.setText(msgText1);
                 // create the Multipart and its parts to it
                 Multipart mp = new MimeMultipart();
                 mp.addBodyPart(mbp1);
                 //mp.addBodyPart(mbp2);
                 // add the Multipart to the message
                 msg.setContent(mp);
                 // set the Date: header
                 msg.setSentDate(new Date());
                 // send the message
                 Transport.send(msg);
            } catch (MessagingException mex) {
    Call this file from the JSP page (which is set at JSPDynPage controller)
    one important thing-----
    Create a dir under PORTAL-INF and import the following jars-- activation.jar, mail.jar,imap.jar,smtp.jar, mailapi.jar.
    This works..
    Thanks once again to the Experts.
    happy mailing
    Manab Ghosh.
    INDIA (+919830603327)

  • Problem with CAF Core Exercise

    Hello All,
    I am performing the CAF exercise I doing it as per the guide How-to-Guide CAF Core however when I am trying to create a Web Service from the CAF Applications I am getting the following error:
    Result
    => deployment aborted : file:/C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/1/temp3623sap.com~demo~core~register.ear
    Aborted: development component 'demo/core/register'/'sap.com'/'local'/'20070626205559':
    Caught exception during application deployment from SAP J2EE Engine's deploy service:
    java.rmi.RemoteException: Cannot deploy application sap.com/demo~core~register.. Reason: Webservices common deployment exception! The reason is: Error occurred, trying to update web services for application sap.com/demo~core~register. . Additional info: none; nested exception is:      java.lang.Exception: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices common deployment exception! The reason is: Error occurred, trying to update web services for application sap.com/demo~core~register. . Additional info: none
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:164)
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:118)
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:86)
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateManager.makeUpdate(WSUpdateManager.java:52)
         at com.sap.engine.services.webservices.server.deploy.WSDeployer.makeUpdate(WSDeployer.java:274)
         at com.sap.engine.services.deploy.server.application.UpdateTransaction.makeComponents(UpdateTransaction.java:400)
         at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:319)
         at com.sap.engine.services.deploy.server.application.UpdateTransaction.begin(UpdateTransaction.java:164)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:292)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:326)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3155)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.update(DeployServiceImpl.java:667)
         at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1278)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:309)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:194)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices deployment exception! The reason is: Error occurred, trying to generate web services deployment files for application sap.com/demo~core~register. . The error refers to application: none, jar: {2}, web service: {3}.
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.generateDeployFiles(WSUpdateProcessor.java:296)
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.deployWebServices(WSUpdateProcessor.java:262)
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:155)
         ... 21 more
    Caused by: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices common deployment exception! The reason is: Error occurred, parsing com.sap.engine.services.webservices.server.deploy.descriptors.sapwebservices.WSDescriptor descriptor, application sap.com/demo~core~register, web service RegEDWS, location message: type: jar file, location: D:\usr\sap\ERP\DVEBMGS10\j2ee\cluster\server0\.\temp\deploy\work\deploying\reader1182862628593\sap.com~demo~core~register~ejbmodule.jar . . Additional info: {1}
         at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseWSDescriptor(WSDefinitionFactory.java:907)
         at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.loadWebService(WSDefinitionFactory.java:176)
         at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.loadWebServices(WSDefinitionFactory.java:158)
         at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.generateDeployFiles(WSUpdateProcessor.java:284)
         ... 23 more
    Caused by: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices common deployment exception! The reason is: Error occurred, trying to parse source type: zip entry, zip file location: D:\usr\sap\ERP\DVEBMGS10\j2ee\cluster\server0\.\temp\deploy\work\deploying\reader1182862628593\sap.com~demo~core~register~ejbmodule.jar, entry: com/sap/demo/core/register/appsrv/reged/RegEDWSVi.videf . Additional info: {1}
         at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseVI(WSDefinitionFactory.java:925)
         at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseWSDescriptor(WSDefinitionFactory.java:817)
         ... 26 more
    Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML Node [VirtualInterface.Functions][http://xml.sap.com/2002/10/metamodel/vi] have minOccurs>0 in schema definition but is missing in node [VirtualInterface][http://xml.sap.com/2002/10/metamodel/vi].
         at com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType._loadInto(GeneratedComplexType.java:1197)
         at com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType.deserialize(GeneratedComplexType.java:945)
         at com.sap.engine.services.webservices.server.deploy.descriptors.vi.VInterfaceParser.getVInterface(VInterfaceParser.java:46)
         at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseVI(WSDefinitionFactory.java:920)
         ... 27 more
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : The deployment of at least one item aborted
    Can someone please suggest to me how to resolve this as I have no idea how to proceed.
    Thanks.

    Hello Raimund,
    Thanks for your reply.
    Yes I am executing these components on the discovery server. It's actually part of the exercises that came with the server which is Composite Tool Box.
    When I am deploying the application without converting the Application Service to a Web Service everything works fine when I am trying to convert it to a Web Service as required by the Visual Composer part of the exercise, I am able to buld it however when I am deploying it I get the Exception.
    Thanks.

  • Help me IN JAVA MAIL

    HI TO ALL......
    I AM NEW TO THIS FIELD....I AM TRYING TO SEND EMAIL THROUGH JAVA MAIL FUNCTION......,FIRST I AM FETCHING THE MAIL ADDRESS FROM DATA BASE.....I WANT TO SEND MAIL TO THOSE ADDRESS......HERE I M LITTLE BIT CONFUSED....PLZ HELP ME....BELOW IS THE CODE.........
    THIS FOR SEARCHING THE MAIL IDS......(SearchEmail .java)
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    public class SearchEmail extends HttpServlet {
    public String s1;
    public String username="root";
    public String passWord="";
    public String url="jdbc:mysql://192.168.0.7:3306/ias";
    private String SUB_NO="";
    private String ST_DT="";
    private String EMAIL="";
    public void init() {
    try {
    Class.forName("sun.mysql.Jdbc.Driver");
    System.out.println("JDBC driver loaded");
    catch (ClassNotFoundException e) {
    System.out.println(e.toString());
    /**Process the HTTP Get request*/
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    sendPageHeader(response);
    sendSearchForm(response);
    sendPageFooter(response);
    /**Process the HTTP Post request*/
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ST_DT = request.getParameter("ST_DT");
    sendPageHeader(response);
    sendSearchForm(response);
    sendSearchResult(response);
    sendPageFooter(response);
    public void sendSearchResult(HttpServletResponse response)
    throws IOException {
    PrintWriter out = response.getWriter();
    try {
    Connection con = DriverManager.getConnection(url,username,passWord);
    System.out.println("got connection");
    Statement s = con.createStatement();
    String sql= "SELECT EMAIL " + "FROM temp "+
    "WHERE ST_DT='" + ST_DT + "' AND EMAIL!='" + null + "'";
    ResultSet rs = s.executeQuery(sql);
    StringBuffer sb = new StringBuffer(100);
    while (rs.next()) {
    String SUB_NO = rs.getString(1);
    s1 =sb.append( rs.getString(1)).append(",").toString();
    out.println("<TABLE border='1'>");
    out.println("<TR>");
    out.println("<TD>TO</TD><TD><INPUT TYPE=TEXT SIZE='50' VALUE='"+ s1 +"' ></TD>");
    out.println("</TR>");
    out.println("<TR>");
    out.println("<TD>FROM</TD><TD><INPUT TYPE=TEXT SIZE='50' [email protected] ></TD>");
    out.println("</TR>");
    out.println("</TR>");
    out.println("<TD>SUBJECT</TD><TD><INPUT TYPE=TEXT SIZE='50' NAME=SUBJECT></TD>");
    out.println("</TR>");
    out.println("<TR>");
    out.println("<TD>MESSAGE </TD><td><textarea cols='70' rows='20' name='MESSAGE'>");
    out.println("C.Vedamurthy senior");
    out.println("Administrative Assistant");
    out.println("Indian Academy of Sciences");
    out.println("C.V.Raman Avenue,Near Mekhri Circle");
    out.println("Post Box No 8005,sadashivanagar'");
    out.println("bangalore 560080");
    out.println("office no 23612546,23611034,23612943 extn 207 ");
    out.println("res 23431357;Fax 23616094;");
    out.println("</textarea></td>");
    out.println("</TR>");
    out.println("<table align='center'>");
    out.println("<TR>");
    out.println("<form action='mailservlet' method='post' name='myform'>");
    out.println("<CENTER> <TD><INPUT TYPE='SUBMIT' VALUE='send'></INPUT></TD></CENTER>");
    out.println("</form>");
    out.println("</TR>");
    out.println("</TABLE>");
    rs.close();
    s.close();
    con.close();
    catch (SQLException e) {
    catch (Exception e) {
    out.println("</TABLE>");
    * Send the HTML page header, including the title
    * and the <BODY> tag
    private void sendPageHeader(HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<HTML>");
    out.println("<HEAD>");
    out.println("<TITLE>Displaying Selected Record(s)</TITLE>");
    out.println("</HEAD>");
    out.println("<BODY BGCOLOR=#FFE4C4>");
    out.println("<CENTER>");
    * Send the HTML page footer, i.e. the </BODY>
    * and the </HTML>
    private void sendPageFooter(HttpServletResponse response)
    throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    out.println("</CENTER>");
    out.println("</BODY>");
    out.println("</HTML>");
    /**Send the form where the user can type in
    * the details for a new user
    private void sendSearchForm(HttpServletResponse response)
    throws IOException {
    PrintWriter out = response.getWriter();
    out.println("<BR><H2>Search</H2>");
    out.println("<BR>");
    out.println("<BR><FORM METHOD=POST>");
    out.print("START DATE: <INPUT TYPE=TEXT Name=ST_DT");
    out.print(" VALUE=\"" + ST_DT + "\"");
    out.println(">");
    out.println("<BOTTOM>");
    out.println("<TABLE ALIGN='CENTER'>");
    out.println("<INPUT TYPE=SUBMIT VALUE=submit>");
    out.println("</TABLE>");
    out.println("</FORM>");
    THIS IS JAVA MAIL FUNCTION.........(mailservlet .java)
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*; // important
    import javax.mail.event.*; // important
    import java.net.*;
    import java.util.*;
    import javax.mail.MessagingException;
    public class mailservlet extends HttpServlet
    public void doPost(HttpServletRequest request,HttpServletResponse response)
    throws ServletException, IOException
    PrintWriter out=response.getWriter();
    response.setContentType("text/html");
    try
    Properties props=new Properties();
    props.put("mail.smtp.host","localhost"); // 'localhost' for testing
    Session session1 = Session.getDefaultInstance(props,null);
    String s1 = request.getParameter("FROM"); //sender (from)
    String s2 = request.getParameter("EMAIL");
    String s3 = request.getParameter("SUBJECT");
    String s4 = request.getParameter("MESSAGE");
    Message message =new MimeMessage(session1);
    message.setFrom(new InternetAddress(s1));
    message.setRecipients
    (Message.RecipientType.TO,InternetAddress.parse(s2,false));
    message.setSubject(s3);
    message.setText(s4);
    Transport.send(message);
    out.println("mail has been sent");
    catch(Exception ex)
    out.println("COULD NOT SEND EMAIL.....");
    plz help me its very urgent ........

    out.println("<TD>TO</TD><TD><INPUT TYPE=TEXT SIZE='50' VALUE='"+ s1 +"' ></TD>");
    out.println("</TR>");
    out.println("<TR>");
    out.println("<TD>FROM</TD><TD><INPUT TYPE=TEXT SIZE='50' VALUE=[email protected] ></TD>");
    You didn't put names to those fields above:
    out.println("<TD>TO</TD><TD><INPUT TYPE=TEXT SIZE='50' VALUE='"+ s1 +"' name ='EMAIL'></TD>");
    out.println("</TR>");
    out.println("<TR>");
    out.println("<TD>FROM</TD><TD><INPUT TYPE=TEXT SIZE='50' VALUE='[email protected]'  name='FROM'></TD>");also try:
    catch(Exception ex)
    out.println("COULD NOT SEND EMAIL.....");
    ex.printStackTrace();
    }to know what is exactly the error.

  • What is the diffrence between  map and map.entry in core java

    what is the diffrence between map and map.entry in core java . where it will be use ful. any one give one example plz.

    A Map contains Map.Entry's
    e.g.
            Map map = new LinkedHashMap(8);
            map.put(new Integer(1), "one");
            map.put(new Integer(2), "two");
            final Iterator iterator = map.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry entry = (Map.Entry) iterator.next();
                System.out.println("key=" + entry.getKey() + ", value=" + entry.getValue());
            }

  • Java mail api - sending mails to gmail account

    Hello
    I am using java mail api to send mails.when i send mails to gmail from ids which are not in gmail friends list, most of the mails are going to spam.Ofcourse, some of them go to inbox.I tried in lot of ways to analyse the problem.But nothing could help. Can anyone plzz tell me how to avoid mails going to spam in gmail, using java mail api?
    Thank you in advance,
    Regards,
    Aradhana
    Message was edited by:
    Aradhana

    am using the below code.
    Properties props = System.getProperties();
    //          Setup mail server
              props.put("mail.smtp.host", smtpHost);
              props.put("mail.smtp.port","25");
              props.put("mail.smtp.auth", isAuth);
         Authenticator auth = new UserAuthenticator();
    //          Get session
              Session s = Session.getDefaultInstance(props,auth);
    //          Define message
              Message m = new MimeMessage(s);
    //          setting message attributes
              try {
                   m.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
                   InternetAddress f_addr=new InternetAddress(from);
                   f_addr.setPersonal(personalName);
                   m.setFrom(f_addr);               
                   m.setSubject(subject);
                   m.setSentDate(new Date());
                   m.setContent(msg,"text/plain");
                   m.saveChanges();
    //               send message
                   Transport.send(m);
    Message was edited by:
    Aradhana

  • Can java mail be used for distributed exchange server?

    H,
    I am trying to connect to MS Exchange Server to read my mails using Java Mail API.
    I have a questions about using it with Exchange server.
    We have 6-7 exchange servers in our company and different users have mailboxes on different servers. My internet mail application will be used by everybody in the company.
    But while connecting to exchange server using java mail I can only cnnnect to one server and port. What happens when user mailbox is not on that server. How can I use javamail in this scenario where user mailboxes are on separate servers??
    Thanks
    [email protected]

    You said that you can connect to Exchange server my you help me with this because i cant connect to Exchange server, mayby you can post me a code example? Thanks

  • How can i access gmail's smtp server using java mail api

    i m using java mail api to access gmails pop and smtp service to receive and send mail from ur gmail account. I m able to access gmails pop server using the ssl and port 995 , but i can not use its smtp server to which i m connecting using ssl on 465 port. It requires authentication code.
    if anybody can help me in this regard i m thnkful to him/her.
    thnks in advance.
    jogin desai

    Here's an example of using SSL + Authentication
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=ssl+authentication&subCat=siteforumid%3Ajava43&site=dev&dftab=siteforumid%3Ajava43&chooseCat=javaall&col=developer-forums

  • How to delete message from the fodler of  AOL account using Java mail

    Hello All,
    I am using Java MAil API in my application, i want to delete message from AOL account's folder,
    when i set the folder as "Recently Deleted" or "Trash" , i get an exception as "folder does not exist".
    when i tested , some times mail is moving into Recently Deleted folder, but not every time.
    this is happening in both the interface as AOl Interface or my application.
    when i use folder.close(true) after setting the flag of message as DELETED. it completely remove the message from the acount.
    but i want to let the message be remained in the Recently Deleted folder. what should i do.
    i dont want to remove the message completely from the account.I am using IMAP also.

    You'll need to figure out what the real name of the "Recently Deleted" folder is on the AOL IMAP server
    (assuming it's a real folder and not some sort of "virtual" folder), then copy the message into that folder.
    See the folderlist.java demo program as a way to explore the names of all the folders on the server.

  • Error while creating new employee in CAF Core application

    Hi
    I am novice to the CAF, this is my first CAF Core application which I have created and deployed in J2EE engine successfully. It’s ready for Testing, here  I am trying to create a  new employee but while saving it, giving error like:-
    ERROR. Exception thrown in method createEmployee. The transaction is marked for rollback.: Exception thrown in method create. The transaction is marked for rollback.: com/sap/caf/rt/exception/CAFIllegalAccessException
    Anyone can help out me.
    Regards
    Srikanth

    Hi Cindy Herrman,
      FYI , that check box already unchecked, while setup the employee entity only that Permission check box unchecked, still I am getting same problem.
    -Srikanth

  • Error while sending mail when using Java Mail API

    Hi Experts,
    I am trying to execute a webdynpro application which uses the Java Mail API to send emails. The exception that I get on executing the application is :
    Sending failed;  nested exception is: javax.mail.SendFailedException: Invalid Addresses;  nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    Can anybody please help me sort out the issue.
    Regards
    Abdullah

    Hi,
    Usually one get this error if the SMTP server is configured not to relay mails (a security measure) or the SMTP server need the mail to be sent from a trusted IP or with proper authentication. Some SMTP servers are configured to block junk mails.
    Pls check with your  mail server administrator.
    Regards

  • Save Attachment from exchange server 2010 from oracle using java mail API

    Hello,
    I want to read email from microsoft exchangeserver 2010 and save attachement into a folder.I created an Java program to import attachments from a exchange server mailbox using "POP3S".It works fine when run as a java application.But when i put this inside Oracle11g R2 using load java and while executing from a procedure it gives an error at parsing message into Multipart
    Error at line : Multipart mp = (Multipart)m.getContent();
    Error:
    Content-Type: multipart/mixed;
    boundary="_002_A0C2E09A..................................."
    java.lang.ClassCastException
    at mailPop3.checkmail(mailPop3:71)
    My Java Class is as follows,
    import java.io.*;
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.Date;
    The function i used to check for attachments is given below.
    public static boolean hasAttachments(Message m) throws java.io.IOException, MessagingException
    Boolean hasAttachments = false;
    try
    // if it is a plain/html text - no attachements
    if (m.isMimeType("text/*"))
    return hasAttachments;
    else if (m.isMimeType("multipart/alternative"))
    return hasAttachments;
    else if (m.isMimeType("multipart/*"))
    Multipart mp = (Multipart)m.getContent();
    if (mp.getCount() > 1)
    hasAttachments = true;
    return hasAttachments;
    catch (Exception e) {
    e.printStackTrace();
    } finally {
    return hasAttachments;
    My Java Details as follows
    java Version :1.5.0_10
    java.vm.specification.version:1.0
    java.vm.version :1.5.0_01
    java.specification.version:1.5
    java.class.version:48.0
    Java mail API:javamail-1.4.4
    Used Jars:mail.jar
    Could someone explain why I am getting this error? What can I do to resolve this error?
    Is any other Jar need other than mail.jar?
    Any help would be much appreciated.
    Regards,
    Nisanth

    Hai EJP,
    Thanks for your reply,
    My full java class as follows,
    import java.util.Properties;
    import javax.mail.Authenticator;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.Part;
    import javax.mail.Multipart;
    import javax.mail.internet.MimeMultipart;
    import javax.mail.internet.MimeMessage;
    public class Newmail
    public Newmail()
    super();
    public static int mailPOP3(String phost,
    String pusername,
    String ppassword)
    Folder inbox =null;
    Store store =null;
    int result = 1;
    try
    String host=phost;
    final String username=pusername;
    final String password=ppassword;
    System.out.println("Authenticator");
    Authenticator auth=new Authenticator()
    protected PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication(username, password);
    System.out.println("Certificate");
    String filename="D:\\Certi\\jssecacerts";
    String password2 = "changeit";
    System.setProperty("javax.net.ssl.trustStore",filename);
    System.setProperty("javax.net.ssl.trustStorePassword",password2);
    Properties props = System.getProperties();
    System.out.println("host-----"+props);
    props.setProperty("mail.pop3s.port", "993");
    props.setProperty("mail.pop3s.starttls.enable","true");
    props.setProperty("mail.pop3s.ssl.trust", "*");
    Session session = Session.getInstance(props,auth);
    session.setDebug(true);
    store = session.getStore("pop3s");
    System.out.println("store------"+store);
    store.connect(host,username,password);
    System.out.println("Connected...");
    inbox = store.getDefaultFolder().getFolder("INBOX");
    inbox.open(Folder.READ_ONLY);
    Message[] msgs = inbox.getMessages();
    System.out.println("msgs.length-----"+msgs.length);
    result = 0;
    int no_of_messages = msgs.length;
    for ( int i=0; i < no_of_messages; i++)
    System.out.println("msgs.count-----"+i);
    System.out.println("Attachment....>"+msgs.getContentType());
    Multipart mp = (Multipart)msgs[i].getContent();
    System.out.println("Casting Success" + mp.getContentType());
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    if(inbox!=null)
    inbox.close(false);
    if(store!=null)
    store.close();
    return result;
    catch(Exception e)
    e.printStackTrace();
    return result;
    Please check it
    Regards,
    Nisanth

  • This is regarding CBMA in SAP PI 7.3.1. I have set up the alert mail using default java mail client.I do receive the alerts via mail. But my requirement is to direct all the mails to Business workplace inbox in ECC.

    This is regarding CBMA in single stack SAP PI 7.3.1. I have set up the alert mail using default java mail client.I do receive the alerts via mail. But my requirement is to direct all the alert mails to Business workplace inbox in ECC.
    So I need to set up PI to redirect mails to ECC Business workplace user inbox (sbwp). From here rules are set up & routed per distribution list.
    Please guide me how I can achieve this requirement.

    Hi,
    yes, it is a little bit different. This is the issue.....  
    But I am not sure if your links will help:
    1) /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
    is about a different solution. I do not need to count the number of lines of the source message.
    And the second variable is about concat line by line from unbound node to unbound node.
    My issue is:
    Souce:
    Message line (0...unbound) ! ! ! ! ! ! ! !
    .    ResultLine   (1..1)
    Mapping:
    =>   ResultLine1
           ResultLine2
           ResultLine........          => into UDF to an element  (1..1) in one mapping operation.
    So that all "ResultLine"s are included.
    The result is explained in the given link for Mail attachment with UDF.
    So I am not sure how to use this thread for my issue.
    In the comments of that blog Christoph Gerber writes that the new variable feature can only handle single values.
    So it is not suitable for my purposes as I have a list of values here that needs to be moved into the target message field.
    2) http://wiki.sdn.sap.com/wiki/display/Java/UsingEditJavaSectioninMessageMapping
    shows where to find the button "Java section" which is not available here in 7.1
    3) /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    too is about the nice little button for Java Section that is no longer existing on PI 7.1 screen for mappings.  
    So my issue is: How to replace the Java section function with global variables in PI 7.1?
    Best regards
    Dirk

Maybe you are looking for

  • How do I restore iTunes media to a new folder?

    My iTunes folder was located under C:\Users\UserAccount\Music\iTunes when I backed it up.  Now that I'm restoring it on a fresh Windows 8 installation I have a different user account folder: C:\Users\UserAccount_000\Music\iTunes.  Not sure why the fo

  • Creative Webcam Vista, Windows 98, Msn 7.0 and windows protection error

    Hi I wondered if you could help me. Im running Windows 98 and have a creative webcam installed. i connect it and it works fine in creative webcam monitor. but when in msn messenger 7.0 i click tools-----> webcam settings the computer then freezes up

  • Want a FaceTime Handle

    I want a FaceTime name, or handle, I can publish on business cards and such. Skype gives you a handle but who wants to use Skype on apple devices? Not me. I've read about controlling your FaceTime caller ID. You can control which phone number or emai

  • Currency issues while booking travel expenses

    Hi Experts, I have configured Travel Management for India, while processing Travel expenses facing the following issues from user. 1.Meals & Meals-Paid is showing over limit separately instead of consolidate for per day. The same error is pop up agai

  • The hold won't come off

    my ipod is frozen I can't reset it because the hold won't turn off even when I switch it to off