本帖最后由 student_2008 于 2010-12-06 21:52:39 编辑

解决方案 »

  1.   

    这个很简单的吧,用apache的mail包直接就可以发送吧,这种例子网上很多的吧
      

  2.   

    上code吧 /**
     * Send HTML format text message with attachments, to one address or more
     * addresses.
     * 
     * @param toAddresses
     *            - the to addresses
     * @param subject
     *            - the email title
     * @param content
     *            - the email content
     * 
     * @param attachments
     *            - attachment list
     * 
     * @return true if successful, otherwise false.
     */
    public boolean sendMailWithAttachments(List<String> toAddresses,
    String subject, String content, List<EmailAttachment> attachments) { HtmlEmail email = new HtmlEmail();
    email.setTLS(true);
    email.setHostName(hostName);
    email.setAuthentication(account, password);  try {
    //多个收件人地址
    for (String address : toAddresses) {
    email.addTo(address); 
    }
    //多个附件
    for (EmailAttachment attachment : attachments) {
    email.attach(attachment);
    }
    email.setFrom(account); 
    email.setSubject(subject); 
    email.setMsg(content);
    email.setCharset("utf-8"); email.send(); } catch (EmailException e) {
    return false; }
    return true;
    }
      

  3.   

    这个要用到
    commons-email-1.2.jar、activation.jar以及mail.jar