Mailing throw webdynpro for java

Hi Experts,
      I want to send the email throw my webdynpro application.i am using this code.
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class Mailer
    public String to,from,subj,mess,cc;
    public boolean retrcpt;
    private Logger log;
    public Mailer()
                to="";
                from="";
                subj="";
                mess="";
                cc="";
                retrcpt=false;
                log=new Logger();
    public boolean doMail()
        try
            Properties props = System.getProperties();
            props.put("mail.smtp.host", "160.84.32.6");
            Session s = Session.getDefaultInstance(props, null);
            s.setDebug(true);
            Message msg = new MimeMessage(s);
            msg.setFrom(new InternetAddress(from));
            msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
            if(cc!=null)
                msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc, false));
            msg.setSubject(subj);
            msg.setText(mess);
            if(retrcpt) msg.setHeader("Disposition-Notification-To",""+to);
            Transport.send(msg);
            return true;
        catch(Exception e)
            log.errLog("Exception while sending mail to "to" by "from" * "+e.toString());
            return false;
My problem is that
Where to download the "import javax.mail.*;"file and where and how to install it.
(ii)And also tell me how to configer the SMTP server for the above need.
Advance Thanx

Hi Bhavani,
Are you using java mail API to send a mail from your  webdynpro application ? if yes you have have to add external jar files i.e mail.jar , activation.jar files to your webdynpro application. please  find that below code snippet which i used in my application where the mail is working properly ...
these are the required import packages....
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public void sendEmail( )
    //@@begin sendEmail()
     IWDMessageManager msgMgr=wdComponentAPI.getMessageManager(); 
     try
            Properties props = System.getProperties();
            props.put("mail.smtp.host","172.16.22.14");
            Session session = Session.getDefaultInstance(props, null);
            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress(wdContext.currentContextElement().getCreatedBy()+"@accenture.com"));
            msg.setRecipients(Message.RecipientType.TO,
            InternetAddress.parse(wdContext.currentTasksBeanElement().getAssignedBy()+"@accenture.com", false));
            msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(wdContext.currentContextElement().getCreatedBy()+"@accenture.com",false));
            msg.setSubject("Task 00"wdContext.currentTasksBeanElement().getTaskNo()"-"+wdContext.currentTasksBeanElement().getType());
            msg.setText("Hi"'\n'"The following task is assigned to you"'\n'wdContext.currentTasksBeanElement().getDescription());
            msg.setHeader("X-Mailer", "Email");
           Transport.send(msg);
          catch (Exception ex)
            ex.printStackTrace();
    //@@end
but make sure the SMTP port number. If you are implementing this inside your company ask your portal adminstrator or network administrator to get SMTP port number:Still if you are facing any problem  ....keep in  touch at any time..
Thanks and regards
Ratnakar reddy

Similar Messages

  • Reading/Writing .xlsx files using Webdynpro for Java

    Dear All
    I have a requirement to read/write excel files in .xlsx format. I am good in doing it with .xls format using jxl.jar. The jxl.jar doesn't support .xlsx format. Kindly help me in understanding how do I need to proceed on reading/writing .xlsx files using Webdynpro for Java.
    Thanks and Regards
    Ramamoorthy D

    i am using jdk 1.6.22 and IBM WebSphere
    when i use poi-3.6-20091214.jar and poi-ooxml-3.6-20091214.jar  to read .xlsx file. but i am getting following errors
    The project was not built since its classpath is incomplete. Cannot find the class
    file for java.lang.Iterable. Fix the classpath then try rebuilding this project.
    This compilation unit indirectly references the missing type java.lang.Iterable
    (typically some required class file is referencing a type outside the classpath)
    how can i resolve it
    here is the code that i have used
    public class HomeAction extends DispatchAction {
         public ActionForward addpage(
                             ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                             throws Exception {     
                             String name = "C:/Documents and Settings/bharath/Desktop/Book1.xlsx";
               FileInputStream fis = null;
               try {
                   Object workbook = null;
                    fis = new FileInputStream(name);
                    XSSFWorkbook wb = new XSSFWorkbook(fis);
                    XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0);
                    Iterator rows = sheet.rowIterator();
                    int number=sheet.getLastRowNum();
                    System.out.println(" number of rows"+ number);
                    while (rows.hasNext())
                        XSSFRow row = ((XSSFRow) rows.next());
                        Iterator cells = row.cellIterator();
                        while(cells.hasNext())
                    XSSFCell cell = (XSSFCell) cells.next();
                    String Value=cell.getStringCellValue();
                    System.out.println(Value);
               } catch (IOException e) {
                    e.printStackTrace();
               } finally {
                    if (fis != null) {
                         fis.close();
                return mapping.findForward("returnjsp");

  • WebDynpro for Java.....Book

    Hi All,
    I would be really thankful to you, if any one can provide me a copy of Inside WebDynpro for Java, author is Chris Whealy.
    Plz forward to my mail id: <b>[email protected]</b>
    Thanks in advance

    JG,
    Do you aware about term "thieving"?
    I'd very recommend you to consider other options:
    1. Buy this book at SAP PRESS on-line
    2. Ask someone from your company who is on business trip to buy this book
    3. Ask your manager to buy this book for your team if you can't afford it yourself.
    VS

  • Comparison between WebDynpro for ABAP vs. WebDynpro for Java ??

    Hi,
       Can someone tell me when should we go for WebDynpro for ABAP and when WebDynpro for Java. Is there any link where SAP recommends the one for the other.
    Thanks in advance
    Regards
    Mukesh

    Hi Mukesh,
    Both are having its own strengths!! )
    I think it all depends on your project requirement and the availabel resources.
    If the developer is good in OOPs ABAP then he must go for Web Dynpro ABAP. But if anyone is good in JAVA then that person should go for Web Dynpro JAVA.
    *In Short almost all Features supported in webdynpro ABAP are also Possible in webdynpro Java.
    1] Webdynpro Java
    Supports,
    webservice
    RFC Models
    Accessing Portal information in Java
    Easy sending E-mail
    Strictly follows MVC architecture which seperate Business logic and Process flow.
    Webdynpro Java is webbased programming model to develop SAP Applications.
    Easy to learn
    Easy to integrate in Enter prise portals.
    Dynanamic Programming
    *Easy access to R/3 Via RFC technology (Models)
    2] Web Dynpro ABAP
    As the name suggests Web Dynpro for ABAP uses exactly the same meta model as its cousin Web Dynpro for Java. A Web Dynpro component, a Web Dynpro view, a Web Dynpro model, a Web Dynpro controller have the same semantics both for ABAP and Java. The main difference is the designtime environment, the development infrastructure and the runtime environment.
    The designtime environment is properly embedded in the ABAP Workbench where Web Dynpro artifacts are simply a new category like BSP applications or classical dynpro based applications before. Also no surprises regarding the development infrastructure. The correction and transport system keeps track on all changes that are done, versions them and helps to propagate the Web Dynpro application from development to production like you would do with ordinary BSP or dynpro-based applications.
    Last not least the execution platform is the ABAP server that produces application content ready to be integrated in the NetWeaver Portal seamlessly. Features like portal eventing can be used between applications written in ABAP or applications developed with Java.
    Hope this helps and solve your Problem
    Cheers,
    Darshna.

  • How to use spellchecker in webdynpro for java

    Hi
    I need to add the functionality for spellcheck in webdynpro for java...
    Plz help
    Regards
    Dibya

    Hi
    What exectly you want to check(is there any letter drafting / mail functionality in wd dynpro ?)
    Webdynpro itself doesn't have this feature but you can try a workaround .
    1. Use API in External Library project ([Spell check API|http://sourceforge.net/projects/jazzy]).
    2. use this DC in WD component , now when ever user writes , iinvolve this API's method to check.
    (Its  a workaround you have to to the R & D).
    Best Regards
    Satish Kumar

  • Suggestion for a good book for webdynpro for java

    Hi, I am new to this technology,and i know a little bit basics,but i want to learn in depth regarding Webdynpro For Java and my backend is SAP R/3
             can anyone suggest me  a good book for webdynpro for java

    Hi padma,
    Check this link.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#9">Web Dynpro Sample Applications and Tutorials</a>
    Re: Guides for new entrant to Webdynpro
    Regards,
    Mithu

  • Charts creation with Webdynpro for Java

    Hello everyone,
    I am really new to SAP technologies and I have to create charts showing statistics for an application based on CE 7.1 and Webdynpro for Java.
    I would like to have some inputs about the best way to achieve this, I saw it exists a business graphics UI and flash islands to use flex with webdynpro.
    Thank you for your opinions
    Regards,
    Joh

    Hi Johann,
    Please refer to this link might help for your requirement:
    [Click Here|http://wiki.sdn.sap.com/wiki/display/WDJava/WebDynproforJavaDemo+Kit]
    Hope it helps
    Regards
    Arun

  • Flex with webdynpro for java using Flex Island

    Hi Friends,
    I am on Netweaver/SAP Enterprise Portal 7.0 SPstack12, I am developing UI for BI reports using VC, I am interested in developing UI using flex and want to integrate those apps with EP, I came to know flux Island supports flux with webdynpro java,  basically I am a webdynpro for java developer, I want to develop flux applications with webdynpro for java in NWDS. And i want to know how to use Flex Island with webdynpro for java. So could u please post some useful links.
    Thank in advance
    Regards
    samba

    Hi
    If you want to try out using ADOBE Flash Islands with WDJ, you would need to download SAP CE 7.1 EhP1 trial version, if not done so already.
    The following link may help you in building the WDJ component with Flash Islands..
    The specified item was not found.
    If you donot want to develop the Flex project you can download the .swf file provided by the SAP mentors:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10989ef6-968c-2b10-50a9-eb34a5267163
    Thanks.
    Chitrali

  • How to access(connect) BI Data in webdynpro for java applications

    Hi ,
    is there any way to access and display the BI data in portal using webdynpro for java applications like we did in Visual composer.
    if not how to integrate the BI data in webdynpro applications ?
    Regards,
    Govindu

    Hi,
    Yes there are ways to do it. But may your scenario and the scenario for which I have done may differ.
    You can use openhub to get the data in a flat file and then read it into weddynpro through a java service OR
    You can use DBlink(which i have done).
    Please refer the link below:
    [Link|Data from BW to Oracle.;
    This I have done in NW04s. Not sure whether a better solution is available in the newer release.
    Hope it helps.
    Regards,
    Manoj

  • Adobe Interactive forms & WebDynpro for java problem with IE7 and IE8

    I have Interactive form ui-element in WebDynpro for java (ver. 7 SP 10) application. It works fine with IE6, but in IE7 (or IE8) it doesn't show that ui-element at all. We have tried to change IE7 security & advanced settings, but we have not made any progress. We have also tried to install/uninstall different Adobe reader versions etc.

    I know a little more about the problem now. After viewing the XML source I change the property of the inputfield.
    It was like this:
                <field name="verdipers_felt" y="130.7001mm" x="180.1801mm" w="101.6004mm" h="44.4501mm" locale="no_NO" access="ReadOnly">
    but i changed the access to be nonInteractive
                <field name="verdipers_felt" y="130.7001mm" x="180.1801mm" w="101.6004mm" h="44.4501mm" locale="no_NO" access="nonInteractive">
    now view2 shows the linebreak as in view1... Buut! when im going back to view1 from view2, the linebreaks gets converted into spaces
    thats pretty wierd, aint it?

  • Any difference between webdynpro for java and webdynpro for abap ?

    Hi all:
       I would like to build one small system in EP.
       I can choose to use webdynpro for java and webdynpro for abap.
       I would like to ask any major difference between webdynpro for abap and webdynpro for java ?
       Is fpm supported in webdynpro for abap ?

    Hi,
    see this thread,
    ABAP Vs JAVA WebDynpro
    Regads,
    J.Joe

  • Problem in connecting to database from webdynpro for java

    Hi
    I have a problem in connecting to database from webdynpro application
    I am using oracle 10 express edition as database and was able to connect to database from a java application.But  was unable to connect from a webdynpro for java.
    <b>I guess webdynpro for java uses open sql instead of vendor sql(I looked in the visual admin ,DB is using open sql) so unable to connect to database.Am i right.?</b>
    Do i need to make any settings in the visual admin to make it work?
    How to solve this problem.Please give me pointers
    Thanks
    Bala

    Hi,
    For connecting to Oracle, either you can use the normal JDBC connectivty code directly which is given below :
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("your query");
    In case you want to fetch data through ejbs, these are the steps to be followed :
    1) Open the J2EE perspective
    2) Create an EJB Module project
    3) Right click on ejbModule, create a new EJB (select your EJB type)
    4) While creating the ejb itself, you can add business methods by clicking ‘Next’ in the UI. Another option is after creating the ejb, write the method in the bean, then select the method from ejb-jar.xml -> <bean name> ->method. Right click and select ‘propogate to local & remote’.
    5) Double click on ejb-j2ee-engine.xml. select your bean and specify a Jndi name for eg: “MyJndi”.
    6) Right click on the EJB project and add ‘classes12.zip’ file (provided by Oracle) to it’s build path. (under libraries tab). Also check the same file under ‘Order & Export’.
    7) Create an Enterprise Application project.
    8) Right click on the EJB module project and select add to EAR project, then select the created EAR project.
    9) Right click on the EJB project, select ‘Build EJB Archive’
    10) Right click on the EAR project, select ‘Build Application Archive’
    11) Open the WebDynpro perspective, open a new project, right click on the project ->properties. Do the following configurations :-
    • Java Build path - select the EJB project from ‘projects’ , check the selected project under ‘Order & Export’
    • Project references – select the EAR project
    • WebDynpro references – select ‘sharing references’ tab, click add & make an entry as : <vendor>/<EAR project name without .ear extension>
    You can find the vendor name under ‘application-j2ee-engine.xml’ file of the EAR project. By default it is ‘sap.com’. So if my EAR project’s name is ABC, my entry would look like ‘sap.com/ABC’
    12) Now the configurations are over and the EJB can be invoked by writing the client code inside the webdynpro component. Like:
    InitialContext context = new InitialContext();
    Object obj = context.lookup("MyJndi");
    MyEJBHome home = MyEJBHome)PortableRemoteObject.narrow(obj,MyEJBHome.class);
    MyEJB mybean = home.create();
    int a = 0;
    a= mybean.add(10,15);
    wdContext.currentContextElement().setSum(a);
    where ‘MyEJB’ is my EJB name and ‘MyJndi’ is my JNDI name
    To connect to Oracle , you can write the usual Java code (given below) as a business methos of the ejb (similar to add() method in the example). And access it like mybean.<businessMethodName>().
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("your query");
    Extracted from Re: Webdynpro and Oracle
    http://help.sap.com/saphelp_webas630/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
    May be of use to understand the VA Conf /people/varadharajan.krishnasamy/blog/2007/02/27/configuring-jdbc-connector-service-to-perform-database-lookups
    Regards
    Ayyapparaj

  • Problem in Uploading excel file using WebDynpro for Java

    Hi  All
    I have followed for Uploading excel file using WebDynpro for Java added by  Tulasi Palnati
    I done all, but I'm getting 500 Exception please contact u r system admin meag  at run time also  Jxl/Workbook class not found msag  but i downloaded Jxl.jar file and  there is no error signals  in coding part. How can I solve the Problem.
    Thanks
    Polaka

    Please ask the people in the Web Dynpro Java forum for a solution.

  • How to start to work on MDM JAVA API by using webdynpro for java

    Hi all
    I have basic idea on MDM business package thru portal by using standard iViews.
    now i am planning to work on MDM JAVA APIs by using Webdynpro for Java as UI.
    1) can you please share the required documents on the same. how to start working on this by using MDM JAVA APIs in webdynpro for java
    2) what are the JARs files are required and how to integrate those jar files into webdynpro for java application.
    3)  is there any SDN help on MDM JAVA API with webdynpro for java? . can you please send the link on the same.
    4) can you please help by providing sample code on how to use JAVA APIs for retrieving,deleting,inserting and Updating the data in the database.
    if anybody helps on the same then it is the great help to me.
    points are always rewardable...
    Regards
    Suresh babu

    Hi Suresh,
    You can have the MDM JAVA API javadocs from the link
    http://help.sap.com/javadocs/MDM/SP06P2/index.html
    There you can see a package named com.sap.mdm.examples.The classes in it contains some examples using which you can start understanding the code.
    You need to have MDM JAR files for it. And these JAR files to be used at build time can be added to the project thru :-
    Right click on project-> properties->Java Build Path - > Add external JARs
    At run time you can add them the reference in
    Right click on project-> properties->web dynpro references->library reference.
    Thanks
    Namrata

  • Creating a multi level views in webdynpro for java

    Hi,
    My requirement is i need to create a webdynpro application with 3 screens .
    first screen will be a search screen for example with first and last names fields .so when i give search criteria it will display the search results in the second screen below the first screen(search screen) and some of the fields in the result screen wil have a hyperlink so when i click on that it will display the details of that row in the details view below that results view
    in simple terms
    search screen
    results screen
    detail screen
    please let me know the way to develop this kind of application in webdynpro for java
    points will be rewarded for the helpful answer.

    Hi Bala,
                Here you have two options.
    <b>I. Display all views at one time:</b>
    Open  Navigation Modeler,
    Create  a <b>ViewSet</b> with properties column 1, rows 3.
    1. In the tool selection list, select Embed View.
    2. In the layout area of the Navigation Modeler, click on the cell of the view set in which the view is to be embedded.
    3.In the wizard, choose Embed New View and, in the next window, enter a name for the view.
    4.Use the package that you entered for the component definition or select another package by choosing Browse.
    5.Choose Finish.
    Create 3 views with names search screen,results screen and detail screen.
    Use plugs to navigate.
    <b>II. Display one view at a time:</b>
    Create a main View. Insert <b>ViewContainerUIElement</b>
    Open  Navigation Modeler.
    1. In the layout area of the Navigation Modeler, click on the cell of the <u>ViewContainerUIElement</u>.
    2.In the wizard, choose Embed New View and, in the next window, enter a name for the view.
    3.Use the package that you entered for the component definition or select another package by choosing Browse.
    4.Choose Finish.
    Create 3 views with names search screen,results screen and detail screen.
    Use plugs to navigate.
    You can use <b>visibility</b> property also as another option to show/hide the views in both of these.
    regards,
    Siva

Maybe you are looking for

  • Path not working in win xp pro, can call java but not javac !

    Hello, I just upgraded to win xp and set up the J2SDK. I have set the path variable in the environment settings. when I tried to test this by typing java from my documents directory it works all right but not the javac command, to which it gives the

  • How to modify a datafile using file read and file write

    I have a datalog file containing port and DMM setup information.  I want to read this file into an aray, update or modify it, and write it to a file.  I can read the file in, but I am at a loss on how to modify it since it is stored in an indicator. 

  • Anyone else seeing a sudden uptick in SPAM making it through their Ironports?

    Quick question: We updated our C170 to 8.5.6-092 last week, and since then we've seen a massive increase in SPAM making it through our Ironport undetected. I've read some updates here re: SBRS and repengine issues after an 8.5.6-092 update, and have

  • Infotype 2

    Hello, In Infotype 2 if the firstname and lastname are same is there any function module to get the name without duplicate. Regards, Aravind

  • Using Kuler file in Flex

    Ive started using Flex and found Kuler and really like the color schemes you can create, its just what I been looking for. How do you use the Kuler Theme in Flex2 once you download it. Sorry if this seems like a really dumb quesiton!!! Roger