⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webmacroemail.html

📁 turbine教程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Fri Dec 06 19:57:10 CET 2002 --><TITLE>jakarta-turbine-2 2.2 API: Class  WebMacroEmail</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <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="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/WebMacroEmail.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&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="../../../../../org/apache/turbine/util/webmacro/WebMacroActionEvent.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroFormatter.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="WebMacroEmail.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.apache.turbine.util.webmacro</FONT><BR>Class  WebMacroEmail</H2><PRE>java.lang.Object  |  +--<B>org.apache.turbine.util.webmacro.WebMacroEmail</B></PRE><HR><B>Deprecated.</B>&nbsp;<I>you should use velocity</I><P><DL><DT>public class <B>WebMacroEmail</B><DT>extends java.lang.Object</DL><P>This is a simple class for sending email from within WebMacro. Essentially, the body of the email is a WebMacro Context object. The beauty of this is that you can send email from within your WebMacro template or from your business logic in your Java code. The body of the email is just a WebMacro template so you can use all the template functionality of WebMacro within your emails! <p>Example Usage (This all needs to be on one line in your template): <p>Setup your context: <p>context.put ("WebMacroEmail", new WebMacroEmail() ); <p>Then, in your template: <pre> $WebMacroEmail.setTo("Jon Stevens", "jon@clearink.com")     .setFrom("Mom", "mom@mom.com").setSubject("Eat dinner")     .setTemplate("email/momEmail.wm")     .setContext($context) </pre> The email/momEmail.wm template will then be parsed with the current Context that is stored in the RunData.getUser().getTemp(WebMacroService.WEBMACRO_CONTEXT) location.  If the context does not already exist there, it will be created and then that will be used. <p>If you want to use this class from within your Java code all you have to do is something like this: <pre> WebMacroEmail wme = new WebMacroEmail(); wme.setTo("Jon Stevens", "jon@clearink.com"); wme.setFrom("Mom", "mom@mom.com").setSubject("Eat dinner"); wme.setContext(context); wme.setTemplate("email/momEmail.wm") wme.send(); </pre> (Note that when used within a WebMacro template, the send method will be called for you when WebMacro tries to convert the WebMacroEmail to a string by calling toString). <p>This class is just a wrapper around the SimpleEmail class. Thus, it uses the JavaMail API and also depends on having the mail.server property set in the TurbineResources.properties file. If you want to use this class outside of Turbine for general processing that is also possible by making sure to set the path to the TurbineResources.properties.  See the TurbineResourceService.setPropertiesFileName() method for more information.<P><DL><DT><B>Version: </B><DD>$Id: WebMacroEmail.java,v 1.2 2002/07/11 16:53:19 mpoeschl Exp $</DD><DT><B>Author: </B><DD><a href="mailto:jon@latchkey.com">Jon S. Stevens</a></DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html#WebMacroEmail()">WebMacroEmail</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Constructor</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html#WebMacroEmail(org.webmacro.servlet.WebContext)">WebMacroEmail</A></B>(org.webmacro.servlet.WebContext&nbsp;context)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Constructor</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;org.webmacro.servlet.WebContext</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html#getContext()">getContext</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Get the context object that will be merged with the template.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html#send()">send</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;This method sends the email.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html">WebMacroEmail</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html#setContext(org.webmacro.servlet.WebContext)">setContext</A></B>(org.webmacro.servlet.WebContext&nbsp;context)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Set the context object that will be merged with the template.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html">WebMacroEmail</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html#setFrom(java.lang.String, java.lang.String)">setFrom</A></B>(java.lang.String&nbsp;from,        java.lang.String&nbsp;email)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;From: name, email.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html">WebMacroEmail</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html#setSubject(java.lang.String)">setSubject</A></B>(java.lang.String&nbsp;subject)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Subject.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../../../org/apache/turbine/util/webmacro/WebMacroEmail.html">WebMacroEmail</A></CODE></FONT></TD>

⌨️ 快捷键说明

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