1. 程式人生 > >javaMail傳送郵件獲取SMTP狀態碼

javaMail傳送郵件獲取SMTP狀態碼

    專案需要整合郵件傳送,之前在.net下寫過smtp的郵件傳送,好像可以直接獲取狀態碼。在網上找到的javamail傳送例子中並未給出如何獲取狀態碼。而且sendMessage方法直接是void沒任何返回引數。

      之後在查閱api時終於有所發現

       When sending a message, detailed information on each address that fails is available in anchained off the top levelthat is thrown. In addition, if themail.smtp.reportsuccess

property is set, anwill be included in the list for each address that is successful. Note that this will cause a top levelto be thrown even though the send was successful.

以作備註,希望下次再遇到問題的時候自己能搜到。