到sun下载Java Activation FrameWork吧!
是缺东西!

解决方案 »

  1.   

    我在编mail时也碰到过
      javax.activation.* 不在jdk中,它在javamail or j2ee中,你到sun去当吧,  或是 你留下mail 我把.jar 发给你
      

  2.   

    谢谢,我找到activation.jar了,但是
    The type named ByteArrayDataSource is not defined
    中的ByteArrayDataSource是在哪里的呢
      

  3.   

    javax.mail.SendFailedException: Sending failed;
      nested exception is: 
    javax.mail.MessagingException: 553 Authentication is required to send mail as <[email protected]> java.lang.Throwable(java.lang.String)
    java.lang.Exception(java.lang.String)
    javax.mail.MessagingException(java.lang.String, java.lang.Exception)
    javax.mail.SendFailedException(java.lang.String, java.lang.Exception, javax.mail.Address [], javax.mail.Address [], javax.mail.Address [])
    void javax.mail.Transport.send0(javax.mail.Message, javax.mail.Address [])
    void javax.mail.Transport.send(javax.mail.Message)
    com.eastpro.salary.sendhtml()
    void com.eastpro.salary.sendhtml.main(java.lang.String [])我该怎么办呢?
      

  4.   

    代码如下:import java.io.*;
    import java.util.Properties;
    import java.util.Date;import javax.mail.*;
    import javax.activation.*;
    import javax.mail.internet.*;public class sendhtml {    public static void main(String[] argv) {
        new sendhtml();
        }    public sendhtml() {    String  to = "[email protected]";
            String subject = "title";
            String from = "[email protected]";
            String cc = null;
            String bcc = null;
            String url = null;
        String mailhost = "smtp.163.net";
        String mailer = "sendhtml";
        String protocol = null, host = null, user = "supershot", password = "abcdefg";
        String record = null;    // name of folder in which to record mail
        boolean debug = false;
        BufferedReader in =
                new BufferedReader(new InputStreamReader(System.in));    try {        Properties props = System.getProperties();
            // XXX - could use Session.getTransport() and Transport.connect()
            // XXX - assume we're using SMTP
            if (mailhost != null)
            props.put("mail.smtp.host", mailhost);        // Get a Session object
            Session session = Session.getDefaultInstance(props, null);
            if (debug)
            session.setDebug(true);        // construct the message
            Message msg = new MimeMessage(session);
            if (from != null)
            msg.setFrom(new InternetAddress(from));
            else
            msg.setFrom();        msg.setRecipients(Message.RecipientType.TO,
                        InternetAddress.parse(to, false));
            if (cc != null)
            msg.setRecipients(Message.RecipientType.CC,
                        InternetAddress.parse(cc, false));
            if (bcc != null)
            msg.setRecipients(Message.RecipientType.BCC,
                        InternetAddress.parse(bcc, false));        msg.setSubject(subject);        collect(msg);        msg.setHeader("X-Mailer", mailer);
            msg.setSentDate(new Date());        // send the thing off
            Transport.send(msg);        System.out.println("\nMail was sent successfully.");        // Keep a copy, if requested.        if (record != null) {
            // Get a Store object
            Store store = null;
            if (url != null) {
                URLName urln = new URLName(url);
                store = session.getStore(urln);
                store.connect();
            } else {
                if (protocol != null)        
                store = session.getStore(protocol);
                else
                store = session.getStore();            // Connect
                if (host != null || user != null || password != null)
                store.connect(host, user, password);
                else
                store.connect();
            }        // Get record Folder.  Create if it does not exist.
            Folder folder = store.getFolder(record);
            if (folder == null) {
                System.err.println("Can't get record folder.");
                System.exit(1);
            }
            if (!folder.exists())
                folder.create(Folder.HOLDS_MESSAGES);        Message[] msgs = new Message[1];
            msgs[0] = msg;
            folder.appendMessages(msgs);        System.out.println("Mail was recorded successfully.");
            }    } catch (Exception e) {
            e.printStackTrace();
        }
        }
    }
      

  5.   

    你看一下JAF的JAVADOC,要么就是你的JAF版本低了
      

  6.   

    String  to = "[email protected]";
      String subject = "title";
       String from = "[email protected]";
      

  7.   

    去Sun下载JAF啊,
    编JavaMail要这个包的