1 /*
2 * Copyright 2008 FatWire Corporation. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package tools.gsf.facade.runtag.mail;
18
19 import tools.gsf.facade.runtag.AbstractTagRunner;
20
21 /**
22 * Wrapper around the SENDMAIL xml tag
23 *
24 * @author Mike Field
25 * @since August 15, 2008
26 */
27 public final class SendMail extends AbstractTagRunner {
28 // Default Constructor
29 public SendMail() {
30 super("SENDMAIL");
31 }
32
33 /**
34 * Sets "to" (the recipient) to the value of <code>s</code>
35 *
36 * @param s The recipient's email address
37 */
38 public void setTo(String s) {
39 // validate first
40 if (s == null || s.length() == 0) {
41 throw new IllegalArgumentException("Invalid TO string: " + s);
42 }
43 this.set("TO", s);
44 }
45
46 /**
47 * Sets subject to the value of <code>s</code>
48 *
49 * @param s The email's subject line
50 */
51 public void setSubject(String s) {
52 // validate first
53 if (s == null || s.length() == 0) {
54 throw new IllegalArgumentException("Invalid subject string: " + s);
55 }
56 this.set("SUBJECT", s);
57 }
58
59 /**
60 * Sets body to the value of <code>s</code>
61 *
62 * @param s The body of the email message
63 */
64 public void setBody(String s) {
65 // validate first
66 if (s == null || s.length() == 0) {
67 throw new IllegalArgumentException("Invalid body string: " + s);
68 }
69 this.set("BODY", s);
70 }
71
72 }