mimemessage.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 1,271 行 · 第 1/5 页

HTML
1,271
字号

<A NAME="MimeMessage(javax.mail.Session)"><!-- --></A><H3>
MimeMessage</H3>
<PRE>
public <B>MimeMessage</B>(<A HREF="../../../javax/mail/Session.html">Session</A>&nbsp;session)</PRE>
<DL>
<DD>Default constructor. An empty message object is created.
 The <code>headers</code> field is set to an empty InternetHeaders
 object. The <code>flags</code> field is set to an empty Flags
 object. The <code>modified</code> flag is set to true.</DL>
<HR>

<A NAME="MimeMessage(javax.mail.Session, java.io.InputStream)"><!-- --></A><H3>
MimeMessage</H3>
<PRE>
public <B>MimeMessage</B>(<A HREF="../../../javax/mail/Session.html">Session</A>&nbsp;session,
                   java.io.InputStream&nbsp;is)
            throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Constructs a MimeMessage by reading and parsing the data from the
 specified MIME InputStream. The InputStream will be left positioned
 at the end of the data for the message. Note that the input stream
 parse is done within this constructor itself.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>session</CODE> - Session object for this message<DD><CODE>is</CODE> - the message input stream<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="MimeMessage(javax.mail.internet.MimeMessage)"><!-- --></A><H3>
MimeMessage</H3>
<PRE>
public <B>MimeMessage</B>(<A HREF="../../../javax/mail/internet/MimeMessage.html">MimeMessage</A>&nbsp;source)
            throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Constructs a new MimeMessage with content initialized from the
 <code>source</code> MimeMessage.  The new message is independent
 of the original. <p>

 Note: The current implementation is rather inefficient, copying
 the data more times than strictly necessary.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>source</CODE> - the message to copy content from<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DT><B>Since: </B><DD>JavaMail 1.2</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="MimeMessage(javax.mail.Folder, int)"><!-- --></A><H3>
MimeMessage</H3>
<PRE>
protected <B>MimeMessage</B>(<A HREF="../../../javax/mail/Folder.html">Folder</A>&nbsp;folder,
                      int&nbsp;msgnum)</PRE>
<DL>
<DD>Constructs an empty MimeMessage object with the given Folder
 and message number. <p>

 This method is for providers subclassing <code>MimeMessage</code>.</DL>
<HR>

<A NAME="MimeMessage(javax.mail.Folder, java.io.InputStream, int)"><!-- --></A><H3>
MimeMessage</H3>
<PRE>
protected <B>MimeMessage</B>(<A HREF="../../../javax/mail/Folder.html">Folder</A>&nbsp;folder,
                      java.io.InputStream&nbsp;is,
                      int&nbsp;msgnum)
               throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Constructs a MimeMessage by reading and parsing the data from the
 specified MIME InputStream. The InputStream will be left positioned
 at the end of the data for the message. Note that the input stream
 parse is done within this constructor itself. <p>

 This method is for providers subclassing <code>MimeMessage</code>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>folder</CODE> - The containing folder.<DD><CODE>is</CODE> - the message input stream<DD><CODE>msgnum</CODE> - Message number of this message within its folder<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="MimeMessage(javax.mail.Folder, javax.mail.internet.InternetHeaders, byte[], int)"><!-- --></A><H3>
MimeMessage</H3>
<PRE>
protected <B>MimeMessage</B>(<A HREF="../../../javax/mail/Folder.html">Folder</A>&nbsp;folder,
                      <A HREF="../../../javax/mail/internet/InternetHeaders.html">InternetHeaders</A>&nbsp;headers,
                      byte[]&nbsp;content,
                      int&nbsp;msgnum)
               throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Constructs a MimeMessage from the given InternetHeaders object
 and content.

 This method is for providers subclassing <code>MimeMessage</code>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>folder</CODE> - The containing folder.<DD><CODE>is</CODE> - the message input stream<DD><CODE>msgnum</CODE> - Message number of this message within its folder<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="parse(java.io.InputStream)"><!-- --></A><H3>
parse</H3>
<PRE>
protected void <B>parse</B>(java.io.InputStream&nbsp;is)
              throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Parse the InputStream setting the <code>headers</code> and
 <code>content</code> fields appropriately.  Also resets the
 <code>modified</code> flag. <p>

 This method is intended for use by subclasses that need to
 control when the InputStream is parsed.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>is</CODE> - The message input stream<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="getFrom()"><!-- --></A><H3>
getFrom</H3>
<PRE>
public <A HREF="../../../javax/mail/Address.html">Address</A>[] <B>getFrom</B>()
                  throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Returns the value of the RFC 822 "From" header fields. If this 
 header field is absent, the "Sender" header field is used. 
 If the "Sender" header field is also absent, <code>null</code>
 is returned.<p>

 This implementation uses the <code>getHeader</code> method
 to obtain the requisite header field.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Message.html#getFrom()">getFrom</A></CODE> in class <CODE><A HREF="../../../javax/mail/Message.html">Message</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>Address object<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeMessage.html#headers"><CODE>headers</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setFrom(javax.mail.Address)"><!-- --></A><H3>
setFrom</H3>
<PRE>
public void <B>setFrom</B>(<A HREF="../../../javax/mail/Address.html">Address</A>&nbsp;address)
             throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Set the RFC 822 "From" header field. Any existing values are 
 replaced with the given address. If address is <code>null</code>,
 this header is removed.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Message.html#setFrom(javax.mail.Address)">setFrom</A></CODE> in class <CODE><A HREF="../../../javax/mail/Message.html">Message</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>address</CODE> - the sender of this message<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/IllegalWriteException.html">IllegalWriteException</A></CODE> - if the underlying
			implementation does not support modification
			of existing values<DD><CODE>java.lang.IllegalStateException</CODE> - if this message is
			obtained from a READ_ONLY folder.<DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="setFrom()"><!-- --></A><H3>
setFrom</H3>
<PRE>
public void <B>setFrom</B>()
             throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Set the RFC 822 "From" header field using the value of the
 <code>InternetAddress.getLocalAddress</code> method.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Message.html#setFrom()">setFrom</A></CODE> in class <CODE><A HREF="../../../javax/mail/Message.html">Message</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/IllegalWriteException.html">IllegalWriteException</A></CODE> - if the underlying
			implementation does not support modification
			of existing values<DD><CODE>java.lang.IllegalStateException</CODE> - if this message is
			obtained from a READ_ONLY folder.<DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="addFrom(javax.mail.Address[])"><!-- --></A><H3>
addFrom</H3>
<PRE>
public void <B>addFrom</B>(<A HREF="../../../javax/mail/Address.html">Address</A>[]&nbsp;addresses)
             throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Add the specified addresses to the existing "From" field. If
 the "From" field does not already exist, it is created.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Message.html#addFrom(javax.mail.Address[])">addFrom</A></CODE> in class <CODE><A HREF="../../../javax/mail/Message.html">Message</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>addresses</CODE> - the senders of this message<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/IllegalWriteException.html">IllegalWriteException</A></CODE> - if the underlying
			implementation does not support modification
			of existing values<DD><CODE>java.lang.IllegalStateException</CODE> - if this message is
			obtained from a READ_ONLY folder.<DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="getRecipients(javax.mail.Message.RecipientType)"><!-- --></A><H3>
getRecipients</H3>
<PRE>
public <A HREF="../../../javax/mail/Address.html">Address</A>[] <B>getRecipients</B>(<A HREF="../../../javax/mail/Message.RecipientType.html">Message.RecipientType</A>&nbsp;type)
                        throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Returns the recepients specified by the type. The mapping
 between the type and the corresponding RFC 822 header is
 as follows:
 <pre>
		Message.RecipientType.TO		"To"
		Message.RecipientType.CC		"Cc"
		Message.RecipientType.BCC		"Bcc"
		MimeMessage.RecipientType.NEWSGROUPS	"Newsgroups"
 </pre><br>

 Returns null if the header specified by the type is not found
 or if its value is empty. <p>

 This implementation uses the <code>getHeader</code> method
 to obtain the requisite header field.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Message.html#getRecipients(javax.mail.Message.RecipientType)">getRecipients</A></CODE> in class <CODE><A HREF="../../../javax/mail/Message.html">Message</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>Type</CODE> - of recepient<DT><B>Returns:</B><DD>array of Address objects<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - if header could not
                  be retrieved<DD><CODE><A HREF="../../../javax/mail/internet/AddressException.html">AddressException</A></CODE> - if the header is misformatted<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeMessage.html#headers"><CODE>headers</CODE></A>, 
<A HREF="../../../javax/mail/Message.RecipientType.html#TO"><CODE>Message.RecipientType.TO</CODE></A>, 
<A HREF="../../../javax/mail/Message.RecipientType.html#CC"><CODE>Message.RecipientType.CC</CODE></A>, 
<A HREF="../../../javax/mail/Message.RecipientType.html#BCC"><CODE>Message.RecipientType.BCC</CODE></A>, 
<A HREF="../../../javax/mail/internet/MimeMessage.RecipientType.html#NEWSGROUPS"><CODE>MimeMessage.RecipientType.NEWSGROUPS</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getAllRecipients()"><!-- --></A><H3>
getAllRecipients</H3>
<PRE>
public <A HREF="../../../javax/mail/Address.html">Address</A>[] <B>getAllRecipients</B>()
                           throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Get all the recipient addresses for the message.
 Extracts the TO, CC, BCC, and NEWSGROUPS recipients.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Message.html#getAllRecipients()">getAllRecipients</A></CODE> in class <CODE><A HREF="../../../javax/mail/Message.html">Message</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>array of Address objects<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/Message.RecipientType.html#TO"><CODE>Message.RecipientType.TO</CODE></A>, 
<A HREF="../../../javax/mail/Message.RecipientType.html#CC"><CODE>Message.RecipientType.CC</CODE></A>, 
<A HREF="../../../javax/mail/Message.RecipientType.html#BCC"><CODE>Me

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?