01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.acting;
18:
19: import org.apache.avalon.framework.parameters.Parameters;
20:
21: import org.apache.cocoon.environment.ObjectModelHelper;
22: import org.apache.cocoon.environment.Redirector;
23: import org.apache.cocoon.environment.Request;
24: import org.apache.cocoon.environment.SourceResolver;
25:
26: import java.util.Map;
27:
28: /**
29: * The SendmailAction class sends email. Please use the {@link Sendmail Sendmail}
30: * action instead. The action needs four parameters:
31: *
32: * <dl>
33: * <dt>from</dt>
34: * <dd>the email address the mail appears to be from</dd>
35: * <dt>to</dt>
36: * <dd>the email address(es) the mail it sent to</dd>
37: * <dt>replyTo</dt>
38: * <dd>the email address(es) replies should be sent to</dd>
39: * <dt>subject</dt>
40: * <dd>the subject of the email</dd>
41: * <dt>body</dt>
42: * <dd>the body of the email</dd>
43: * </dl>
44: *
45: * Action attempts to get all of these parameters from the sitemap, but
46: * if they do not exist there it will read them from the request parameters.
47: *
48: * <p>It also supports all of the {@link Sendmail} action sitemap parameters</p>
49: *
50: * @deprecated Please use the {@link Sendmail Sendmail} action instead.
51: * @author <a href="mailto:balld@apache.org">Donald Ball</a>
52: * @author <a href="mailto:haul@apache.org">Christian Haul</a>
53: * @version CVS $Id: SendmailAction.java 433543 2006-08-22 06:22:54Z crossley $
54: */
55: public class SendmailAction extends Sendmail {
56:
57: public Map act(Redirector redirector, SourceResolver resolver,
58: Map objectModel, String source, Parameters parameters)
59: throws Exception {
60:
61: Request request = ObjectModelHelper.getRequest(objectModel);
62: if (!parameters.isParameter("from")) {
63: parameters.setParameter("from", request
64: .getParameter("from"));
65: }
66: if (!parameters.isParameter("to")) {
67: parameters.setParameter("to", request.getParameter("to"));
68: }
69: if (!parameters.isParameter("replyTo")) {
70: parameters.setParameter("replyTo", request
71: .getParameter("replyTo"));
72: }
73: if (!parameters.isParameter("subject")) {
74: parameters.setParameter("subject", request
75: .getParameter("subject"));
76: }
77: if (!parameters.isParameter("body")) {
78: parameters.setParameter("body", request
79: .getParameter("body"));
80: }
81:
82: return super.act(redirector, resolver, objectModel, source,
83: parameters);
84: }
85: }
|