package-summary.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 563 行 · 第 1/2 页

HTML
563
字号
 Provider that doesn't exist.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../javax/mail/ReadOnlyFolderException.html" title="class in javax.mail">ReadOnlyFolderException</A></B></TD><TD>This exception is thrown when an attempt is made to open a folder read-write access when the folder is marked read-only.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../javax/mail/SendFailedException.html" title="class in javax.mail">SendFailedException</A></B></TD><TD>This exception is thrown when the message cannot be sent.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../javax/mail/StoreClosedException.html" title="class in javax.mail">StoreClosedException</A></B></TD><TD>This exception is thrown when a method is invoked on a Messaging object and the Store that owns that object has died due to some reason.</TD></TR></TABLE>&nbsp;<P><A NAME="package_description"><!-- --></A><H2>Package javax.mail Description</H2><P>The JavaMail<sup><font size="-2">TM</font></sup> APIprovides classes that model a mail system.The <code>javax.mail</code> package defines classes that are common toall mail systems.The <code>javax.mail.internet</code> package defines classes that are specificto mail systems based on internet standards such as MIME, SMTP, POP3, and IMAP.The JavaMail API includes the <code>javax.mail</code> package and subpackages.<P>For an overview of the JavaMail API, read the JavaMail specification<A HREF="../../../JavaMail-1.4.pdf" TARGET="_top">included in the download bundle</A> or<A HREF="http://java.sun.com/products/javamail/JavaMail-1.4.pdf" TARGET="_top">available on the JavaMail web site</A>.<P>The code to send a plain text message can be as simple as the following:<PRE>    Properties props = new Properties();    props.put("mail.smtp.host", "my-mail-server");    props.put("mail.from", "me@example.com");    Session session = Session.getInstance(props, null);    try {        MimeMessage msg = new MimeMessage(session);        msg.setFrom();        msg.setRecipients(Message.RecipientType.TO,                          "you@example.com");        msg.setSubject("JavaMail hello world example");        msg.setSentDate(new Date());        msg.setText("Hello, world!\n");        Transport.send(msg);    } catch (MessagingException mex) {        System.out.println("send failed, exception: " + mex);    }</PRE>The JavaMail download bundle contains many more complete examplesin the "demo" directory.<P>Don't forget to see the<A HREF="http://java.sun.com/products/javamail/FAQ.html" TARGET="_top">JavaMail API FAQ</A>for answers to the most common questions.The <A HREF="http://java.sun.com/products/javamail/" TARGET="_top">JavaMail web site</A>contains many additional resources.<P>The JavaMail API supports the following standard properties,which may be set in the <code>Session</code> object, or in the<code>Properties</code> object used to create the <code>Session</code> object.The properties are always set as strings; the Type column describeshow the string is interpreted.  For example, use<PRE>        props.put("mail.debug", "true");</PRE>to set the <code>mail.debug</code> property, which is of type boolean.<P><TABLE BORDER><TR><TH>Name</TH><TH>Type</TH><TH>Description</TH></TR><TR><TD>mail.debug</TD><TD>boolean</TD><TD>The initial debug mode.Default is false.</TD></TR><TR><TD>mail.from</TD><TD>String</TD><TD>The return email address of the current user, used by the<code>InternetAddress</code> method <code>getLocalAddress</code>.</TD></TR><TR><TD>mail.mime.address.strict</TD><TD>boolean</TD><TD>The MimeMessage class uses the <code>InternetAddress</code> method<code>parseHeader</code> to parse headers in messages.  This propertycontrols the strict flag passed to the <code>parseHeader</code>method.  The default is true.</TD></TR><TR><TD>mail.host</TD><TD>String</TD><TD>The default host name of the mail server for both Stores and Transports.Used if the <code>mail.<i>protocol</i>.host</code> property isn't set.</TD></TR><TR><TD>mail.store.protocol</TD><TD>String</TD><TD>Specifies the default message access protocol.  The<code>Session</code> method <code>getStore()</code> returns a Storeobject that implements this protocol.  By default the first Storeprovider in the configuration files is returned.</TD></TR><TR><TD>mail.transport.protocol</TD><TD>String</TD><TD>Specifies the default message access protocol.  The<code>Session</code> method <code>getTransport()</code> returns a Transportobject that implements this protocol.  By default the first Transportprovider in the configuration files is returned.</TD></TR><TR><TD>mail.user</TD><TD>String</TD><TD>The default user name to use when connecting to the mail server.Used if the <code>mail.<i>protocol</i>.user</code> property isn't set.</TD></TR><TR><TD>mail.<i>protocol</i>.class</TD><TD>String</TD><TD>Specifies the fully qualified class name of the provider for thespecified protocol.  Used in cases where more than one providerfor a given protocol exists; this property can be used to specifywhich provider to use by default.  The provider must still be listedin a configuration file.</TD></TR><TR><TD>mail.<i>protocol</i>.host</TD><TD>String</TD><TD>The host name of the mail server for the specified protocol.Overrides the <code>mail.host</code> property.</TD></TR><TR><TD>mail.<i>protocol</i>.port</TD><TD>int</TD><TD>The port number of the mail server for the specified protocol.If not specified the protocol's default port number is used.</TD></TR><TR><TD>mail.<i>protocol</i>.user</TD><TD>String</TD><TD>The user name to use when connecting to mail serversusing the specified protocol.Overrides the <code>mail.user</code> property.</TD></TR></TABLE><P>The JavaMail API also supports several System properties;see the <A HREF="../../javax/mail/internet/package-summary.html"><CODE>javax.mail.internet</CODE></A> package documentationfor details.<P>The JavaMail referenceimplementation from Sun includes protocol providers in subpackages of<code>com.sun.mail</code>.  Note that the APIs to these protocolproviders are not part of the standard JavaMail API.  Portableprograms will not use these APIs.<P>Nonportable programs may use the APIs of the Sun protocol providersby (for example) casting a returned <code>Folder</code> object to a<code>com.sun.mail.imap.IMAPFolder</code> object.  Similarly for<code>Store</code> and <code>Message</code> objects returned from thestandard JavaMail APIs.<P>The Sun protocol providers also support properties that are specific tothose providers.  The package documentation for the<CODE>IMAP</CODE>, <CODE>POP3</CODE>,and <CODE>SMTP</CODE> packages provide details.<P><P><DL></DL><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../javax/jws/soap/package-summary.html"><B>PREV PACKAGE</B></A>&nbsp;&nbsp;<A HREF="../../javax/mail/event/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html?javax/mail/package-summary.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../legal/license.html" target="_top">license terms.</a></font></BODY></HTML>

⌨️ 快捷键说明

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