Help !! How to use SmtpClient in an Applet?

Hi,
I have 2 TextFields and a button in an Applet. On click of the button, I wanted to get connected to an email server (e.g pop.mail.yahoo.com) and post my message using (smtp.mail.yahoo.com) to "[email protected]" . I tried this programme using both URL and Sockets. But in both cases I am getting "NullPointerException". Can any one help me with this problem by giving some source code?
Here is my code:
if (ae.getSource().equals(button1))
System.out.println("Clicked Send");
try
sendmail = new SmtpClient("smtp.mail.yahoo.com");
//sendmail = new SmtpClient("java.sun.com");
System.out.println("connecting......");
System.out.println("SendMail:" +sendmail);
sendmail.from(getString);
sendmail.to("mailto:[email protected]");
//sendmail.to("[email protected]");
ps = sendmail.startMessage();
System.out.println("PS :" +ps);
//succeed = true;
catch(Exception e)
//e.printStackTrace();
System.out.println("Couldn't reach you through javasoft, trying your local machine instead. You probably are behind a firewall.");
The source code has been provided, can any one help me?
Thanks
[email protected]

well the answer is simple
"sendmail" object is NULL and ur trying to access the methods from it.
When u instantiate SmtpClient. It just creates a Object. it does not actually connect to the MailServer. u would probably need to luk into API and find out the appropriate method for connect......well i haven't myself luked into the API so i am not too sure about this
Manja

Similar Messages

  • Need help how to use itunes card to download music

    Need help how to use itunes card to download music

    If you want to add the iTunes card to your account, then in the iTunes app on the iPad you should be able to scroll to the bottom of the Music tab and there should be a Redeem button - there is more info here : http://support.apple.com/kb/HT1574

  • How to use DOMParser from an Applet / Or, how to parse XML from an Applet?

    Hey,
    As stating in the subject line, I wonder how to do it without getting an �Access Denied� error.
    I would like to parse a XML file that has external DTD pointing to a SYSTEM location. Yes, I can change it to a public location. However, in either way, I have problems to use DOMBuilder to parse the xml file. The application always throws the security exception.
    I tried to use the DOMParser from org.apache.xerces.parsers to parse the xml file. I set the DOMParser to ignore parsing the external DTD, and use the DOMParser.parse(InputSource) to parse the xml file from a giving URL. However, I get null of the result document.
    Does anyone know how to parse the XML from an Applet? Or, does anyone know how to use the DOMParser from an Applet?
    Thank you very much,

    If the document resides on the local filesystem, you will need to sign a CAB or JAR for the applet to circumvent the sandbox's security restrictions. There are dozens of posts on how to do this. Basically, that will turn the applet into an application, from a Java security perspective.
    - Saish
    "My karma ran over your dogma." - Anon

  • How to use jsp:plugin type="applet" in jsp

    Hi ,
    I have a JSP File.
    How to use jsp:plugin tag in that.
    When I specify the file name in code="applet.class" Then it is giving an error saying that It could not find the class.
    What is the solution for this.

    its not working.. it shows exception class not found exception.
    i have placed the jsp and applet class in the same folder. but its not working.
    jsp file path : OracleSpatial\mypackage\webmap.jsp
    applet class : OracleSpatial\mypackage\demoApplet.class
    demoApplet class inside package "mypackage".
    code inside JSP is :
    <jsp:plugin type="applet"
    code="mypackage.demoApplet.class" width = "100%" height = "100%" >
    </jsp:plugin>

  • How to use JNI in an Applet?

    Can a native method can be invoken in an Applet?If it can,which knowledge of Java should be used and how to use it?

    You could I suppose if yo sign the applet (which, if the user accepts it, will allow it to use features otherwise not available to an applet because of the secure sandbox). However, I am not sure how you would deploy the necessary native library since it must be available to the native OS loader (ie, a file on the client machine). If you are deploying the applets (see WebStart perhaps) you could do it.
    But generally it is a poor idea to try to use JNI in an Applet, and this is probably something that you would not want to use outside of an intranet environment.
    Chuck

  • Help:how to use java.util.jar to zip or unzip a binary file.

    how to use java.util.jar to zip or unzip a binary file or a file contain native code.

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

  • (Urgent)help: how to use sdk add a gif image into a pdf document

    I had use sdk plus-in add a new button of mine,if I click the button,a gif image will be inserted into the current page of pdf document
    My questions:
    one : When I clicked the button,there was a warnning box said:the image has not enough data.I don't known why?
    two : How can I be sure the position of the image which I inserted? and how to change it's position?
    three:  how to use sdk get the content of the document?

    hi Leonard:
    I do it like you said, but
    Why my image can not display in the pdf.
    code is:
    //====================================================================
    const ASInt32 theImageByteSize = IMG_WIDTH * IMG_HEIGHT;
    char* buff = new char[theImageByteSize];
    PDEImage volatile pdeImage = NULL;
    PDEImageAttrs pdeImageAttrs;
    PDEColorSpace pdeColorSpace;
    ASFixedMatrix imageMatrix;
    memset(&pdeImageAttrs, 0, sizeof(PDEImageAttrs));
    int hdl = _open(ImagePath, _O_RDONLY | _O_BINARY, _S_IWRITE | _S_IREAD);
    if (hdl == -1)
         AVAlertNote("[%s] create fail !!!!") ;
    if (_read(hdl, buff, theImageByteSize) == -1)
         AVAlertNote("read image fail!") ;
    pdeImageAttrs.width = IMG_WIDTH;
    pdeImageAttrs.height = IMG_HEIGHT;
    pdeImageAttrs.intent = ASAtomNull;
    pdeImageAttrs.bitsPerComponent = 8;
    pdeImageAttrs.flags = kPDEImageExternal | kPDEImageIsIndexed;
    pdeImageAttrs.decode[0] = fixedZero;
    pdeImageAttrs.decode[1] = fixedOne;
    pdeImageAttrs.decode[2] = fixedZero;
    pdeImageAttrs.decode[3] = fixedOne;
    pdeImageAttrs.decode[4] = fixedZero;
    pdeImageAttrs.decode[5] = fixedOne;
    ASFixedRect theMediaBox;
    PDPageGetMediaBox( AVPageViewGetPage(pageView), &theMediaBox );
    ASFixed theFixedWidth = (theMediaBox.right - theMediaBox.left);
    ASFixed theFixedHeight = (theMediaBox.top - theMediaBox.bottom);
    imageMatrix.a = ASInt16ToFixed(theFixedWidth);
    imageMatrix.d = ASInt16ToFixed(theFixedHeight);
    imageMatrix.b = imageMatrix.c = fixedZero;
    imageMatrix.h = 0;
    imageMatrix.v = 0;
    const Int32 cPaletteColors = 256;
    PDEIndexedColorData theIndexedData;
    theIndexedData.size = sizeof(theIndexedData);
    theIndexedData.baseCs = PDEColorSpaceCreateFromName(ASAtomFromString( "DeviceRGB"));
    theIndexedData.hival = cPaletteColors - 1;
    unsigned char data[3] = {255, 0, 0};
    theIndexedData.lookup = (char *)data;
    theIndexedData.lookupLen = cPaletteColors * 3;
    PDEColorSpaceStruct theColorData;
    theColorData.indexed = &theIndexedData;
    pdeColorSpace = PDEColorSpaceCreate(ASAtomFromString( "Indexed" ), &theColorData );
    pdeImage = PDEImageCreate(&pdeImageAttrs, sizeof(pdeImageAttrs), &imageMatrix,
                                                0, pdeColorSpace, NULL, NULL, NULL, (unsigned char*)buff, theImageByteSize);
    I want die, I had done this for so many days, My GIF doesn't insert into pdf,
    unsigned char data[3] = {255, 0, 0};
    theIndexedData.lookup = (char *)data;  "
    whether the data set wrong?
    I confused what I do next   

  • Help, how can i run JavaFX as Applet in browse

    can someone please tell me, how can i run JavaFX as Applet in browse
    thanks

    http://jfx.wikia.com/wiki/FAQ#What_is_needed_on_a_machine_to_run_JavaFX_applications.3F

  • Need help: how to use "FileLock"

    Hi,
    I would like to be able to read the file at any time, but when
    write is acquired (assuming the lock is released), no read is allowed
    until the lock for the write is released.
    How to use FileLock to accomplish this scenario?
    Any input is appreciated.
    Thanks,
    Pin

    I would suppose that the first step would be to determine that the OS you are working on actually supports that...from the java docs...
    Platform dependencies
    Whether or not a lock actually prevents another program from accessing the content of the locked region is system-dependent and therefore unspecified.

  • How to use drawLine not in Applet

    I need your help.
    I am new in Java programming.
    I use bean to display 3 photos on a web page.
    One is very big and the two last are like labels.
    I would like to draw a line from these labels to that big photo.
    And I did not succeed to use the drawLine method.
    Someone can help me please??
    Thanks
    Gwan

    Hi rapy_xjb!
    It's troublesome, would need to deploy applet and all dependent classes! A lot of files to download (in jar file or not)! Think in benefits to user after installing Java plug-in. My lemma: Java and diamonds are forever!
    Best regards.

  • Need help -how to use a GUI to compile a file

    hello peeps,
    I have this problem, let's get directly into it, i have a program that has GUI with a Text Area that im going to copy a text file into it (using JFileChooser FileReader and readLine() ...) so i have radio buttons like (view, compile and execute) and an OK button to get the selected option, what i want to know is how to compile the file that is in the text area, like how to get to the MS-dos console and javac to start. i hope this description is clear, and i'll be very appreciative for any help!

    thanks for your response, but its not working it keeps on throwing IOException, i tried to put a direct string into it like (Runtime.getRuntime().exec("javac MyClass.java"); and same thing happend. Am i missing something? like is there something to add before calling that line of code? i did import Runtime
    ok here is how my code looks like:
       if(compile.isSelected())
                       try
                       //name of the file im pasting into the text area  
                       String filename = file.getName();
                       Runtime.getRuntime().exec("javac" + filename);
                       catch (IOException e)
                         System.out.println("error compiling program");
                   }

  • Pls. help - How to use user defined URL?

    The page users access currently for login is (only over the Intranet)- http://servername/pls/portal30/url/page/pagename
    I need users to be able to point to - http://project.companyname.com/project
    and be taken to the above Login page.
    What needs to be setup (Apache/Portal)??
    I created a Virtual Hosts entry in the httpd.conf file -
    NameVirtualHost 13.xx.xx.xxx
    <VirtualHost 13.xx.xx.xxx>
    ServerName project.companyname.com
    </VirtualHost>
    That did not help. What am I missing?
    Thanks.

    ATP,
    Pls. refer Portal FAQ. Here is how it works
    Use the Apache Redirect directive in the <ORACLE_HOME>/Apache/Apache/conf/httpd.conf file. For example, if your site's full URL is http://mysite.us.oracle.com:80/pls/portal30, you can place the following directive in httpd.conf:
    Redirect /portalhome http://mysite.us.oracle.com:80/pls/portal30
    Then, if you try:
    http://mysite.us.oracle.com/portalhome
    you will be redirected to the original URL. This technique will also work with any valid path that is appended to the URL. For example:
    http://mysite.us.oracle.com/portalhome/url/folder/ONLINE_HELP
    will redirect the user to the Online Help content area.
    null

  • Help: How to use JWindow as Popup

    Hi there,
    I am developing a program & I wanted to design it with a screen like the Mac OS (tiger?) desktop. That is menu (button bar) at the bottom of the screen (the program's screen - Not the OS).
    I thought I should use a JWindow to do it.
    HOW I WOULD LIKE THE POPUP TO BEHAVE:
    - Only appears when a user moves the mouse towards the bottom of the screen.
    - To disappear (hide) when the user clicks somewhere else on the screen [when focus is lost(?)]
    - To change its position relative to the program. That is, if the program is resized etc...
    I NEED YOUR HELP ON
    The design issues I should take into consideration. I mean interfaces I should implement etc...
    Thanks in advance.
    Yours,
    Me

    Okay, sorry for the late reply, I dont go on the net much.
    With the focus issues, it could be very tricky to know when exactly the Window has lost focus cause a component within the window could still have the focus, hence the window would be in focus.
    One way, could be to add a common FocusListener to all the components within the window by using a recursion method, and allow this FocusListener to determine when all the elements within the window have lost focus, so as to call the window hiding function
    public void addFocusListener(Component c, FocusListener fl) {
      c.addFocusListener(fl);
      if(c instanceof Container) {
         Container cn = (Container)c;
         for(int i = 0; i < cn.getComponents().length; i++) {
             addFocusListener(cn.getComponent(i), fl);
    // also the focus listener could be like this
    class FocusChecker implements FocusListener {
       public void focusLost(FocusEvent e) {
          Component source = (Component)e.getSource();
          if(popupWindow.isAncestorOf(source)) {
              if(!popupWindow.isFocussed()) { // check if the window has a focussed component
                 moveWindowIntoHiding();  // call the method to hide to window
    }This is just a general guideline. Think around this to hide the window when it looses focus
    ICE

  • Help: How to use 'CRM_ORDER_MAINTAIN'

    Hi All,
    I want to create a sales order with following requirements.
    1) schedule lines having requesting dates for which vendor cannot deliver.
    2) change the status from open to some other status.
    i this i have to use
    'CRM_ORDER_MAINTAIN". but i want to know will this API takes care of updating ERP system?
    when i change the status will it also update the purchase order in ERP?
    And also give me some code as how to change status and change schedule lines using 'CRM_ORDER_MAINTAIN".
    Thanks in advance,
    Regards,
    Ujwalkumar

    Hi Robin,
    I am facing problem with CRM_ORDER_MAINTAIN.
    I am trying to change the status of service order from New to Shipped.
    Below is my code.Please look into it and let me the issue.
    Thanks.Rushikesh
    REPORT  ZRD1.
    data:IT_STATUS  TYPE  CRMT_STATUS_COMT,
         wa like line of it_status.
    DATA : ls_input_field         TYPE crmt_input_field,
           ls_input_field_names   TYPE crmt_input_field_names,
           lt_input_fields        TYPE crmt_input_field_tab,
           CT_PARTNER_ATTRIBUTES  TYPE CRMT_PARTNER_ATTRIBUTE_COM_TAB,
           l_i_orderadm_h         TYPE CRMT_ORDERADM_H_COMT,
           l_i_orderadm_i         TYPE CRMT_ORDERADM_I_COMT,
           l_i_obj_guids          TYPE CRMT_OBJECT_GUID_TAB,
           ls_i_obj_guids         like line of l_i_obj_guids.
    wa-REF_GUID = '47FDBF975F6100E1E10080000A0630A7'.
    wa-ref_kind = 'B'.
    wa-status = 'E0023'.
    wa-USER_STAT_PROC = 'ZRV_ST01'.
    wa-activate  = 'X'.
    APPEND wa TO it_status.
          ls_input_field-ref_guid = '47FDBF975F6100E1E10080000A0630A7'.
          ls_input_field-ref_kind = 'B'.
          ls_input_field_names-fieldname = 'REF_GUID'.
          INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
          ls_input_field_names-fieldname = 'REF_KIND'.
          INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
          ls_input_field_names-fieldname = 'STATUS'.
          INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
          ls_input_field_names-fieldname = 'USER_STAT_PROC'.
          INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
          ls_input_field_names-fieldname = 'ACTIVATE'.
          INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
          INSERT ls_input_field INTO TABLE lt_input_fields.
    *Start of solution1.
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
    EXPORTING
          IT_STATUS                     = IT_STATUS
    CHANGING
       CT_INPUT_FIELDS                  = lt_INPUT_FIELDS
       ct_orderadm_h                    = l_i_orderadm_h
       ct_orderadm_i                    = l_i_orderadm_i
    EXCEPTIONS
          ERROR_OCCURRED                = 1
          DOCUMENT_LOCKED               = 2
          NO_CHANGE_ALLOWED             = 3
          NO_AUTHORITY                  = 4
          OTHERS                        = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ls_i_obj_guids = '47FDBF975F6100E1E10080000A0630A7'.
    append ls_i_obj_guids to l_i_obj_guids.
    CALL FUNCTION 'CRM_ORDER_SAVE'
    EXPORTING
    it_objects_to_save = l_i_obj_guids
    EXCEPTIONS
    document_not_saved = 1.

  • Help : How to use list of values in Variable in ODI

    Dear All,
    I have a multiple values in table, and I would to use these values a a parameter in ODI to retrieve rows based on these values. As I know that we can use single value in variable in ODI.
    Any one can Help me please?

    Can't you use a join between the tables ?
    ODI mostly take advantage of native technologies.
    i.e If my source technology is oracle then i will create a join between the table i.e. MAINTABLE.column = LOVTABLE.COLUMN and also put a filter on LOVTABLE to take required values.
    OR you can write a subquery in the Filter i.e. MAINTABLE.COLUMN in ( Select LOVVALUES from LOVTABLE where LOVTABLE.ATTRIBUTE = 'BUSINESS_UNIT')

Maybe you are looking for

  • How to refer to an object from within a handler

    So I have a mouse listener that is attached to multiple objects as so:   for (int i = 0; i < Grids.size(); i++) { Grids.get(i).addMouseListener(new GameMouseListener()); }Now the problem I have is I need to know which of the Objects activated the han

  • Javascript only works for "easy" numbers (and multiplying error)

    HIi Everyone, I have a scripting problem.  I used javascript to do some division and subtraction, but it only works some of the time in the second half of my form.  What I mean is, if I'm using a nice even number like 100-the calculations are correct

  • Find/Change window freezes - Appleworks 6.2.9

    When I use the Appleworks Find/Change window for the first time after booting up my new iMac, the Find/Change window freezes up and then disappears and then the opened document on my desktop disappears from my desktop, too. I have Appleworks 6.2.9 an

  • How to publish without recompressing unedited JPEGs?

    Hi. Please let me provide a bit of context before I ask my question. I use lightroom to manage a large catalog of images that consists of: (1) Raw files that have been "developed" within Lightroom. (2) JPEGs that will not be developed/edited in Light

  • Reference to calling vi from subvi

    Is there a way fora subvi to get a reference to the vi that called it? Bill F