SMTP サーバへのアクセスを提供する JavaMail API の SMTP プロトコル プロバイダです。 詳しい情報については、RFC 821 を参照して下さい。

メッセージを送信時、SendFailedException でスローされる失敗したそれぞれのアドレスの詳細情報はトップレベルからチェーンされた SMTPAddressFailedException で利用できます。 更に、mail.smtp.reportsuccess プロパティが設定された場合、 SMTPAddressSucceededException はそれぞれの成功したアドレスのリストに含まれます。 トップレベルから SendFailedException をスローする事に注意して下さい。

又、SMTP プロバイダは ESMTP をサポートします(RFC 1651)。 それは、LOGIN、PLAIN、及び DIGEST-MD5 メカニズム (RFC 2592 及び RFC 2831) を使用して SMTP 認証 (RFC 2554) を任意に使用することができます。

SMTP 認証を使用する場合、SMTP サーバに接続するユーザ名とパスワードを SMTP Transport に指定する必要があります。 以下のアプローチの何れかを使用します:

又、DIGEST-MD5 認証を使用する場合、適切なレルムを供給する必要があります。 メールサーバ管理者はこの情報を提供することができます。 mail.smtp.saslrealm プロパティ 、又は SMTPTransportsetSASLRealm メソッドを使用して設定する事ができます。

又、SMTP は 任意に Delivery Status Notifications を要求する事ができます (RFC 1891)。 配送状態は、"multipart/report" (RFC 1892) パートと共に "message/delivery-status" (RFC 1894) メッセージタイプを使用することで通知されます。 JavaMail は現在これらの新しい MIME タイプのダイレクトサポートを提供していませんが、 MimeMultipartMimeMessage オブジェクトを使用して、 "multipart" 又は "message" コンテンツとしてそれらを処理する事が可能です。

これらの機能を有効にするには以下を参照してプロパティを設定して下さい。

注意 これらの機能を説明する文章はここにはありません!!! これらの機能が何をするのか、そして、どの様にそれらを使用するかを理解する為に前述の様に適切な RFC を読む必要があります。 ただプロパティを設定し始めないで下さい。そして、それが働くと予想するように働いていない場合に、私たちに不平を言ってください。 まず始めに RFC 群を読んで下さい!!!

SMTP プロトコルプロバイダは以下のプロパティをサポートします。 (プロパティは JavaMail Session オブジェクトに設定される場合があります) プロパティは常に文字列として設定します。型は文字列がどの様に解釈されるかを説明します。 使用例

	props.put("mail.smtp.port", "888");
mail.smtp.port のプロパティを設定します。(int 型のプロパティ)

Specifies the port to connect to when using the specified socket factory. 設定しない場合はこのプロトコルのデフォルトポート番号が使用されます。
名前 説明
mail.smtp.user String SMTP のデフォルトユーザ名
mail.smtp.host String 接続する SMTP サーバ
mail.smtp.port int 接続する AMTP サーバのポート番号。connect() メソッドで明示的に指定しない場合のデフォルトは 25 です。
mail.smtp.connectiontimeout int ミリ秒で表現されるソケット接続のタイムアウト値。デフォルトは無限(タイムアウトしない)です。
mail.smtp.timeout int ミリ秒で表現されるソケット I/O のタイムアウト値。デフォルトは無限(タイムアウトしない)です。
mail.smtp.from String SMTP MAIL コマンドに使用する Eメールアドレスです。 This sets the envelope return address. デフォルトは msg.getFrom() 又は InternetAddress.getLocalAddress() です。 NOTE: mail.smtp.user は以前これが使用されました。
mail.smtp.localhost String ローカルホスト名 デフォルトは InetAddress.getLocalHost().getHostName() です。 JDK とネームサービスが適切に構成されている場合、通常は設定する必要はありません。
mail.smtp.localaddress String SMTP ソケット作成時にバインドさせるローカルアドレス(ホスト名)です。 Defaults to the address picked by the Socket class. Should not normally need to be set, but useful with multi-homed hosts where it's important to pick a particular local address to bind to.
mail.smtp.localport int SMTP ソケット作成時にバインドさせるローカルポート番号です。 Defaults to the port number picked by the Socket class.
mail.smtp.ehlo boolean false の場合、EHLO コマンドを試行しません。 デフォルトは true です。 Normally failure of the EHLO command will fallback to the HELO command; このプロパティは適切に EHLO に失敗しない、又は適切に EHLO を実装しないサーバの為だけに存在します。
mail.smtp.auth boolean true の場合、AUTH コマンドを使用してユーザを認証を行います。 デフォルトは false です。
mail.smtp.submitter String The submitter to use in the AUTH tag in the MAIL FROM command. Typically used by a mail relay to pass along information about the original submitter of the message. See also the setSubmitter method of SMTPMessage. Mail clients typically do not use this.
mail.smtp.dsn.notify String RCPT コマンドの NOTIFY オプションです。 Either NEVER 又は SUCCESS、FAILURE、及び DELAY の何れかの組み合わせ。
mail.smtp.dsn.ret String MAIL コマンドの RET オプションです。 FULL 又は HDRS のどちらか
mail.smtp.allow8bitmime boolean If set to true, and the server supports the 8BITMIME extension, text parts of messages that use the "quoted-printable" or "base64" encodings are converted to use "8bit" encoding if they follow the RFC2045 rules for 8bit text.
mail.smtp.sendpartial boolean If set to true, and a message has some valid and some invalid addresses, send the message anyway, reporting the partial failure with a SendFailedException. If set to false (the default), the message is not sent to any of the recipients if there is an invalid recipient address.
mail.smtp.saslrealm String DIGEST-MD5 認証と共に使用するレルムです。
mail.smtp.quitwait boolean If set to true, causes the transport to wait for the response to the QUIT command. If set to false (the default), the QUIT command is sent and the connection is immediately closed. (NOTE: The default may change in the next release.)
mail.smtp.reportsuccess boolean If set to true, causes the transport to include an SMTPAddressSucceededException for each address that is successful. Note also that this will cause a SendFailedException to be thrown from the sendMessage method of SMTPTransport even if all addresses were correct and the message was sent successfully.
mail.smtp.socketFactory.class String If set, specifies the name of a class that implements the javax.net.SocketFactory interface. This class will be used to create SMTP sockets.
mail.smtp.socketFactory.fallback boolean If set to true, failure to create a socket using the specified socket factory class will cause the socket to be created using the java.net.Socket class. デフォルトは true です。
mail.smtp.socketFactory.port int
mail.smtp.mailextension String MAIL コマンドに追加する拡張文字列 The extension string can be used to specify standard SMTP service extensions as well as vendor-specific extensions. Typically the application should use the SMTPTransport method supportsExtension to verify that the server supports the desired service extension. 特定の拡張を定義する RFC1869 と 他のRFC を参照して下さい。

一般的には、アプリケーションはこのパッケージ中のクラスを直接使用する必要はないはずです。 代わりに javax.mail パッケージ(とサブパッケージ)で定義された API を使用すべきです。 アプリケーションは SMTPTransport のインスタンスを決して直接構成するべきではありません。 代わりに適切な Transport オブジェクトを入手する SessiongetTransport メソッドを使用すべきです。

警告: このパッケージのユニークな API は実験的であると考えるべきです。 将来、現在の API を使用するアプリケーションと両立しない方法でそれらを変えるかもしれません。