com.sun.mail.smtp
クラス SMTPMessage

java.lang.Object
  上位を拡張 javax.mail.Message
      上位を拡張 javax.mail.internet.MimeMessage
          上位を拡張 com.sun.mail.smtp.SMTPMessage
すべての実装されたインタフェース:
MimePart, Part

public final class SMTPMessage
extends MimeMessage

このクラスは様々な SMTP オプションを指定させる MimeMessage クラスと、 このメッセージを SMTP 上に送信する時に使用するパラメータです。 単に MimeMessage の代わりにこのクラスを使用します。 そして、このクラスのメソッドを使用して SMTP オプションを設定します。

SMTP プロトコルプロバイダの詳細に関しては、 jp.sourceforge.livez.mail.smtp パッケージのドキュメンテーションを参照して下さい。

関連項目:
MimeMessage

入れ子のクラスの概要
 
クラス javax.mail.internet.MimeMessage から継承された入れ子のクラス/インタフェース
MimeMessage.RecipientType
 
フィールドの概要
static int NOTIFY_DELAY
          配信遅延を通知します。
static int NOTIFY_FAILURE
          配信失敗を通知します。
static int NOTIFY_NEVER
          配信状況を通知しない事を表します。
static int NOTIFY_SUCCESS
          配信成功を通知します。
static int RETURN_FULL
          配信状況通知と共に完全なメッセージを返す事を表します。
static int RETURN_HDRS
          配信状況通知と共にメッセージヘッダだけを返す事を表します。
 
クラス javax.mail.internet.MimeMessage から継承されたフィールド
content, contentStream, dh, flags, headers, modified, saved
 
クラス javax.mail.Message から継承されたフィールド
expunged, folder, msgnum, session
 
インタフェース javax.mail.Part から継承されたフィールド
ATTACHMENT, INLINE
 
コンストラクタの概要
SMTPMessage(MimeMessage source)
          source MimeMessage から初期化された内容を持つ新しい SMTPMessage を構築します。
SMTPMessage(Session session)
          デフォルトコンストラクタです。
SMTPMessage(Session session, InputStream is)
          指定された MIME InputStream のデータを読み取り、構文解析することで、SMTPMessage を構築します。
 
メソッドの概要
 boolean getAllow8bitMIME()
          Is use of the 8BITMIME extension is allowed?
 String getEnvelopeFrom()
          エンベロープ From アドレスを返します。
 String getMailExtension()
          Gets the extension string to use with the MAIL command.
 int getNotifyOptions()
          通知オプションを取得します。
 int getReturnOption()
          リターンオプションを返します。
 boolean getSendPartial()
          Send message if some addresses are invalid?
 String getSubmitter()
          Gets the submitter to be used for the RFC 2554 AUTH= value in the MAIL FROM command.
 void setAllow8bitMIME(boolean allow)
          If set to true, and the server supports the 8BITMIME extension, text parts of this message that use the "quoted-printable" or "base64" encodings are converted to use "8bit" encoding if they follow the RFC 2045 rules for 8bit text.
 void setEnvelopeFrom(String from)
          From アドレスに SMTP エンベロープが現れるように設定します。
 void setMailExtension(String extension)
          Set the extension string to use with the MAIL command.
 void setNotifyOptions(int options)
          サーバが配信状況通知をサポートする場合、通知オプションに使用される様に設定します。
 void setReturnOption(int option)
          サーバが配信状況通知をサポートする場合、リターンオプションに使用される様に設定します。
 void setSendPartial(boolean partial)
          If set to true, and this message has some valid and some invalid addresses, send the message anyway, reporting the partial failure with a SendFailedException.
 void setSubmitter(String submitter)
          Sets the submitter to be used for the RFC 2554 AUTH= value in the MAIL FROM command.
 
クラス javax.mail.internet.MimeMessage から継承されたメソッド
addFrom, addHeader, addHeaderLine, addRecipients, addRecipients, createInternetHeaders, createMimeMessage, getAllHeaderLines, getAllHeaders, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getMessageID, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSize, getSubject, isMimeType, isSet, parse, removeHeader, reply, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFlags, setFrom, setFrom, setHeader, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo, writeTo
 
クラス javax.mail.Message から継承されたメソッド
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

NOTIFY_NEVER

public static final int NOTIFY_NEVER
配信状況を通知しない事を表します。

関連項目:
定数フィールド値

NOTIFY_SUCCESS

public static final int NOTIFY_SUCCESS
配信成功を通知します。

関連項目:
定数フィールド値

NOTIFY_FAILURE

public static final int NOTIFY_FAILURE
配信失敗を通知します。

関連項目:
定数フィールド値

NOTIFY_DELAY

public static final int NOTIFY_DELAY
配信遅延を通知します。

関連項目:
定数フィールド値

RETURN_FULL

public static final int RETURN_FULL
配信状況通知と共に完全なメッセージを返す事を表します。

関連項目:
定数フィールド値

RETURN_HDRS

public static final int RETURN_HDRS
配信状況通知と共にメッセージヘッダだけを返す事を表します。

関連項目:
定数フィールド値
コンストラクタの詳細

SMTPMessage

public SMTPMessage(Session session)
デフォルトコンストラクタです。 空のメッセージオブジェクトを作成します。 headers フィールドは空の InternetHeaders オブジェクトに設定されます。 flags フィールドは空の Flags オブジェクトに設定されます。 modified フラグは true に設定されます。


SMTPMessage

public SMTPMessage(Session session,
                   InputStream is)
            throws MessagingException
指定された MIME InputStream のデータを読み取り、構文解析することで、SMTPMessage を構築します。 InputStream はメッセージデータの最後に位置付けられます。 入力ストリームの構文解析は、このコンストラクタ自体の内部で行われる事に注意して下さい。

パラメータ:
session - このメッセージの Session オブジェクト
is - メッセージ入力ストリーム
例外:
MessagingException

SMTPMessage

public SMTPMessage(MimeMessage source)
            throws MessagingException
source MimeMessage から初期化された内容を持つ新しい SMTPMessage を構築します。 新しいメッセージは元のメッセージと独立しています。

注: 現在の実装はどちらかというと非効率です。必要以上にデータのコピーを行います。

パラメータ:
source - 内容のコピー元となるメッセージ
例外:
MessagingException
メソッドの詳細

setEnvelopeFrom

public void setEnvelopeFrom(String from)
From アドレスに SMTP エンベロープが現れるように設定します。 これがメッセージ自体に現れる From アドレスと異なる事に注意して下さい。 通常、エンベロープ From アドレスは、エラーを報告する時に使用されます。 詳細は RFC 821 を参照して下さい。

mail.smtp.from プロパティを無視して設定します。

パラメータ:
from - エンベロープ From アドレス

getEnvelopeFrom

public String getEnvelopeFrom()
エンベロープ From アドレスを返します。

戻り値:
エンベロープ From アドレス。値が設定されていない場合は null

setNotifyOptions

public void setNotifyOptions(int options)
サーバが配信状況通知をサポートする場合、通知オプションに使用される様に設定します。 (RFC 1891) NOTIFY_NEVER 又は NOTIFY_SUCCESSNOTIFY_FAILURE、 及び NOTIFY_DELAY の組み合わせのどちらか

mail.smtp.dsn.notify プロパティを無視して設定します。

パラメータ:
options - 通知オプション

getNotifyOptions

public int getNotifyOptions()
通知オプションを取得します。 オプションが設定されていない場合は 0 を返します。

戻り値:
通知オプション

setReturnOption

public void setReturnOption(int option)
サーバが配信状況通知をサポートする場合、リターンオプションに使用される様に設定します。 (RFC 1891) RETURN_FULL 又は RETURN_HDRS の何れか。

mail.smtp.dsn.ret プロパティを無視して設定します。

パラメータ:
option - リターンオプション

getReturnOption

public int getReturnOption()
リターンオプションを返します。 オプションが設定されていない場合は 0 を返します。

戻り値:
リターンオプション

setAllow8bitMIME

public void setAllow8bitMIME(boolean allow)
If set to true, and the server supports the 8BITMIME extension, text parts of this message that use the "quoted-printable" or "base64" encodings are converted to use "8bit" encoding if they follow the RFC 2045 rules for 8bit text.

If true, overrides the mail.smtp.allow8bitmime property.

パラメータ:
allow - 8ビット許可フラグ

getAllow8bitMIME

public boolean getAllow8bitMIME()
Is use of the 8BITMIME extension is allowed?

戻り値:
8ビット許可フラグ

setSendPartial

public void setSendPartial(boolean partial)
If set to true, and this 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.

If true, overrides the mail.smtp.sendpartial property.

パラメータ:
partial - send partial flag

getSendPartial

public boolean getSendPartial()
Send message if some addresses are invalid?

戻り値:
send partial flag

getSubmitter

public String getSubmitter()
Gets the submitter to be used for the RFC 2554 AUTH= value in the MAIL FROM command.

戻り値:
the name of the submitter.
導入されたバージョン:
JavaMail 1.3.2

setSubmitter

public void setSubmitter(String submitter)
Sets the submitter to be used for the RFC 2554 AUTH= value in the MAIL FROM command. Normally only used by a server that's relaying a message. Clients will typically not set a submitter. See RFC 2554 for details.

パラメータ:
submitter - the name of the submitter
導入されたバージョン:
JavaMail 1.3.2

getMailExtension

public String getMailExtension()
Gets the extension string to use with the MAIL command.

戻り値:
the extension string
導入されたバージョン:
JavaMail 1.3.2

setMailExtension

public void setMailExtension(String extension)
Set the extension string to use with the MAIL command. 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. See RFC 1869 and other RFCs that define specific extensions.

For example:

 
 if (smtpTransport.supportsExtension("DELIVERBY"))
        smtpMsg.setMailExtension("BY=60;R");
 

導入されたバージョン:
JavaMail 1.3.2