DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Tataroz T. Guest

    JavaMail applet problem


    Hello
    I try to send email by applet and I have a ploblem.
    First of all, I pack JavaMail and JAF into my Cabinet file (.cab). Compile
    java code, build and sign cab file are fine.
    When applet run, It stuck at Transport.send() function without any exceptions
    occure on java console.
    This is print out from java console.
    ======== Java Console ========
    Start...
    DEBUG: not loading system providers in <java.home>/lib
    DEBUG: not loading optional custom providers file: /META-INF/javamail.providers
    DEBUG: successfully loaded default providers

    DEBUG: Tables of loaded providers
    DEBUG: Providers Listed By Class Name: {com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
    Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
    Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
    Microsystems, Inc]}
    DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
    Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
    Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
    Microsystems, Inc]}
    DEBUG: not loading optional address map file: /META-INF/javamail.address.map
    Sending...
    ============================
    I don't know what I do wrong so please see my source code for more detail.
    Thank you.

    Tataroz T.

    PS. I am apologize for my english.
    My environment:
    - Win98se
    - IE 5.0
    - Microsoft SDK for Java 4.0
    - JavaMail(tm) API 1.2 release
    - Javabeans(tm) Activation Framework 1.0.1

    My 3 source files:
    1. msgsendsample.java (applet version -- modify from javamail1.2\demo\msgsendsample.java)
    2. smtpie.html (just applet tag)
    3. smtpie.bat (for compile, build cab and sign applet)
    (***Please see my source files below)

    ======= msgsendsample.java ========
    package gits.smtp;

    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;

    import java.applet.*;
    import com.ms.security.*;

    public class msgsendsample extends Applet{
    String msgText = "This is a message body.\nHere's the second line.";

    public void start() {
    System.out.println("Start...");
    try{
    if(Class.forName("com.ms.security.PolicyEngine") != null) {
    PolicyEngine.assertPermission(PermissionID.NETIO);
    PolicyEngine.assertPermission(PermissionID.FILEIO);
    }
    }catch(Throwable cnfe) {
    System.out.println("PermissionID...error");
    }
    String to = "user1@myhost.net";
    String from = "user2@myhost.net";
    String host = "mail.myhost.net";
    boolean debug = true;

    // create some properties and get the default Session
    Properties props = new Properties();
    props.put("mail.smtp.host", host);
    if (debug) props.put("mail.debug", "true");

    Session session = Session.getDefaultInstance(props, null);
    session.setDebug(debug);

    try {
    // create a message
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress[] address = {new InternetAddress(to)};
    msg.setRecipients(Message.RecipientType.TO, address);
    msg.setSubject("JavaMail APIs Test");
    msg.setSentDate(new Date());
    msg.setText(msgText);

    System.out.println("Sending...");
    Transport.send(msg);
    System.out.println("Send OK.");
    }catch(MessagingException mex) {
    System.out.println("--MessagingException handling in msgsendsample.java--");
    mex.printStackTrace();
    }catch(Exception ex) {
    System.out.println("--Exception handling in msgsendsample.java--");
    ex.printStackTrace();
    }
    }
    }

    ==================================

    ======= smtpie.html ========
    <html>
    <head>SMTP Applet</head>
    <body>
    <h1>SMTP Applet</h1>
    <APPLET name="ga" code="gits.smtp.msgsendsample" WIDTH=10 HEIGHT=10>
    <PARAM NAME=useslibrary VALUE="SMTP Applet">
    <PARAM NAME=useslibrarycodebase VALUE="smtpie.cab">
    <PARAM NAME=useslibraryversion VALUE="1,0,0,0">
    </APPLET>
    </body>
    </html>
    ==========================

    ======= smtpie.bat ==========
    jvc /cp c:\smtp_app\;c:\smtp_app\mail.jar;c:\smtp_app\classes.zip /d c:\smtp_app\smtp\
    msgsendsample.java
    dubuild smtpie.cab smtp/ /D "SMTP Applet" /I * /V 1,0,0,0
    setreg 1 true
    rem makecert -sk MyKeyName -n "CN=SMTP Applet" MyTestCert.cer
    rem cert2spc MyTestCert.cer MyTestCert.spc
    signcode -j javasign.dll -jp LOW -spc MyTestCert.spc -k MyKeyName smtpie.cab

    ==========================

  2. #2
    Join Date
    Aug 2005
    Posts
    5
    You might go looking for recovery pst and repair outlook express. I have been using it without problem since it came out.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links