📄 emailservice.html
字号:
<DD><DL></DL></DD></DL><HR><A NAME="createMimeMessage()"><!-- --></A><H3>createMimeMessage</H3><PRE>public javax.mail.internet.MimeMessage <B>createMimeMessage</B>()</PRE><DL><DD>Factory method to return a blank JavaMail message. You should use the object returned and set desired message properties. When done, pass the object to the addMessage(Message) method.<P><DD><DL><DT><B>Returns:</B><DD>a new JavaMail message.</DL></DD></DL><HR><A NAME="sendMessage(javax.mail.internet.MimeMessage)"><!-- --></A><H3>sendMessage</H3><PRE>public void <B>sendMessage</B>(javax.mail.internet.MimeMessage message)</PRE><DL><DD>Sends a JavaMail message. To create a message, use the <A HREF="../../../org/jivesoftware/util/EmailService.html#createMimeMessage()"><CODE>createMimeMessage()</CODE></A> method.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>message</CODE> - the message to send.</DL></DD></DL><HR><A NAME="sendMessages(java.util.Collection)"><!-- --></A><H3>sendMessages</H3><PRE>public void <B>sendMessages</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A><javax.mail.internet.MimeMessage> messages)</PRE><DL><DD>Send a collection of messages. To create a message, use the <A HREF="../../../org/jivesoftware/util/EmailService.html#createMimeMessage()"><CODE>createMimeMessage()</CODE></A> method.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>messages</CODE> - a collection of the messages to send.</DL></DD></DL><HR><A NAME="sendMessage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>sendMessage</H3><PRE>public void <B>sendMessage</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> toName, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> toEmail, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fromName, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fromEmail, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> subject, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> textBody, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> htmlBody)</PRE><DL><DD>Sends a message, specifying all of its fields.<p> To have more advanced control over the message sent, use the <A HREF="../../../org/jivesoftware/util/EmailService.html#sendMessage(javax.mail.internet.MimeMessage)"><CODE>sendMessage(MimeMessage)</CODE></A> method.<p> Both a plain text and html body can be specified. If one of the values is null, only the other body type is sent. If both body values are set, a multi-part message will be sent. If parts of the message are invalid (ie, the toEmail is null) the message won't be sent.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>toName</CODE> - the name of the recipient of this email.<DD><CODE>toEmail</CODE> - the email address of the recipient of this email.<DD><CODE>fromName</CODE> - the name of the sender of this email.<DD><CODE>fromEmail</CODE> - the email address of the sender of this email.<DD><CODE>subject</CODE> - the subject of the email.<DD><CODE>textBody</CODE> - plain text body of the email, which can be <tt>null</tt> if the html body is not null.<DD><CODE>htmlBody</CODE> - html body of the email, which can be <tt>null</tt> if the text body is not null.</DL></DD></DL><HR><A NAME="sendMessagesImmediately(java.util.Collection)"><!-- --></A><H3>sendMessagesImmediately</H3><PRE>public void <B>sendMessagesImmediately</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A><javax.mail.internet.MimeMessage> messages) throws javax.mail.MessagingException</PRE><DL><DD>Sends a collection of email messages. This method differs from <A HREF="../../../org/jivesoftware/util/EmailService.html#sendMessages(java.util.Collection)"><CODE>sendMessages(Collection)</CODE></A> in that messages are sent before this method returns rather than queueing the messages to be sent later.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>messages</CODE> - the messages to send.<DT><B>Throws:</B><DD><CODE>javax.mail.MessagingException</CODE> - if an error occurs.</DL></DD></DL><HR><A NAME="getHost()"><!-- --></A><H3>getHost</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getHost</B>()</PRE><DL><DD>Returns the SMTP host (e.g. mail.example.com). The default value is "localhost".<P><DD><DL><DT><B>Returns:</B><DD>the SMTP host.</DL></DD></DL><HR><A NAME="setHost(java.lang.String)"><!-- --></A><H3>setHost</H3><PRE>public void <B>setHost</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> host)</PRE><DL><DD>Sets the SMTP host (e.g. mail.example.com). The default value is "localhost".<P><DD><DL><DT><B>Parameters:</B><DD><CODE>host</CODE> - the SMTP host.</DL></DD></DL><HR><A NAME="getPort()"><!-- --></A><H3>getPort</H3><PRE>public int <B>getPort</B>()</PRE><DL><DD>Returns the port number used when connecting to the SMTP server. The default port is 25.<P><DD><DL><DT><B>Returns:</B><DD>the SMTP port.</DL></DD></DL><HR><A NAME="setPort(int)"><!-- --></A><H3>setPort</H3><PRE>public void <B>setPort</B>(int port)</PRE><DL><DD>Sets the port number that will be used when connecting to the SMTP server. The default is 25, the standard SMTP port number.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>port</CODE> - the SMTP port number.</DL></DD></DL><HR><A NAME="getUsername()"><!-- --></A><H3>getUsername</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getUsername</B>()</PRE><DL><DD>Returns the username used to connect to the SMTP server. If the username is <tt>null</tt>, no username will be used when connecting to the server.<P><DD><DL><DT><B>Returns:</B><DD>the username used to connect to the SMTP server, or <tt>null</tt> if there is no username.</DL></DD></DL><HR><A NAME="setUsername(java.lang.String)"><!-- --></A><H3>setUsername</H3><PRE>public void <B>setUsername</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> username)</PRE><DL><DD>Sets the username that will be used when connecting to the SMTP server. The default is <tt>null</tt>, or no username.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>username</CODE> - the SMTP username.</DL></DD></DL><HR><A NAME="getPassword()"><!-- --></A><H3>getPassword</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getPassword</B>()</PRE><DL><DD>Returns the password used to connect to the SMTP server. If the password is <tt>null</tt>, no password will be used when connecting to the server.<P><DD><DL><DT><B>Returns:</B><DD>the password used to connect to the SMTP server, or <tt>null</tt> if there is no password.</DL></DD></DL><HR><A NAME="setPassword(java.lang.String)"><!-- --></A><H3>setPassword</H3><PRE>public void <B>setPassword</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> password)</PRE><DL><DD>Sets the password that will be used when connecting to the SMTP server. The default is <tt>null</tt>, or no password.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>password</CODE> - the SMTP password.</DL></DD></DL><HR><A NAME="isDebugEnabled()"><!-- --></A><H3>isDebugEnabled</H3><PRE>public boolean <B>isDebugEnabled</B>()</PRE><DL><DD>Returns true if SMTP debugging is enabled. Debug information is written to <tt>System.out</tt> by the underlying JavaMail provider.<P><DD><DL><DT><B>Returns:</B><DD>true if SMTP debugging is enabled.</DL></DD></DL><HR><A NAME="setDebugEnabled(boolean)"><!-- --></A><H3>setDebugEnabled</H3><PRE>public void <B>setDebugEnabled</B>(boolean debugEnabled)</PRE><DL><DD>Enables or disables SMTP transport layer debugging. Debug information is written to <tt>System.out</tt> by the underlying JavaMail provider.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>debugEnabled</CODE> - true if SMTP debugging should be enabled.</DL></DD></DL><HR><A NAME="isSSLEnabled()"><!-- --></A><H3>isSSLEnabled</H3><PRE>public boolean <B>isSSLEnabled</B>()</PRE><DL><DD>Returns true if SSL is enabled for SMTP connections.<P><DD><DL><DT><B>Returns:</B><DD>true if SSL is enabled.</DL></DD></DL><HR><A NAME="setSSLEnabled(boolean)"><!-- --></A><H3>setSSLEnabled</H3><PRE>public void <B>setSSLEnabled</B>(boolean sslEnabled)</PRE><DL><DD>Sets whether the SMTP connection is configured to use SSL or not. Typically, the port should be 465 when using SSL with SMTP.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>sslEnabled</CODE> - true if ssl should be enabled, false otherwise.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Openfire 3.6.0a Javadoc</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../org/jivesoftware/util/ElementUtil.html" title="class in org.jivesoftware.util"><B>PREV CLASS</B></A> <A HREF="../../../org/jivesoftware/util/Enum.html" title="class in org.jivesoftware.util"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/jivesoftware/util/EmailService.html" target="_top"><B>FRAMES</B></A> <A HREF="EmailService.html" target="_top"><B>NO FRAMES</B></A> <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><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><i>Copyright © 2003-2008 Jive Software.</i></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -