JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java SE 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Re:關於Mail發信認證問題 [Re:kentyeh]
kentyeh





發文: 643
積分: 6
於 2008-07-13 22:32 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
剛剛用了Aspirin這個套件試著寄給我的gmail信箱,確實可以收到,給您參考一下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
public static void main(String[] args) throws Exception{
    Properties prop = new Properties();
    prop.put("mail.smtp.host","127.0.0.1");
        Session mailConn = Session.getDefaultInstance(prop,null);
        MimeMessage msg = new MimeMessage(mailConn);
    msg.setFrom(new InternetAddress("?????@yahoo.com.tw"));
    msg.setHeader("Return-Path","<????@yahoo.com.tw>");
    msg.setRecipient(Message.RecipientType.TO,
                 new InternetAddress("?????@gmail.com"));
    msg.setSubject("JAVA 寄 Mail"); 
    Multipart mp = new MimeMultipart();
        MimeBodyPart mbpBody = new MimeBodyPart();
        mbpBody.setContent("TEST","text/html; charset=big5" );
        mp.addBodyPart(mbpBody);
        msg.setContent(mp);
        MailQue.addWatcher(new MailWatcher(){
          public void deliveryFailure(MimeMessage message,
              MailAddress recipient) {
            System.out.println(recipient+" deliver failed");
          }
      public void deliveryFailure(MimeMessage message,
          Collection recipients) {
      }
      public void deliverySuccess(MimeMessage message,
          Collection recipients) {
      }
      public void deliverySuccess(MimeMessage message,
          MailAddress recipient) {
        System.out.println(recipient+" deliver successed");
      }
        });
        MailQue.queMail(msg); 
  }


kentyeh edited on 2008-07-13 22:36
reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
1517 關於Mail發信認證問題 Suzuna 380 2008-07-12 11:54
1152 Re:關於Mail發信認證問題 kentyeh 354 2008-07-13 21:42
1203 Re:關於Mail發信認證問題 kentyeh 1481 2008-07-13 22:32
» JWorld@TW »  Java SE 討論區

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8