01: /*
02: * Copyright 2001-2005 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.apache.commons.mail;
17:
18: /**
19: * This class is used to send simple internet email messages without
20: * attachments.
21: *
22: * @since 1.0
23: * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
24: * @author <a href="mailto:colin.chalmers@maxware.nl">Colin Chalmers</a>
25: * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
26: * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
27: * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
28: * @author <a href="mailto:unknown">Regis Koenig</a>
29: * @version $Id: SimpleEmail.java 279285 2005-09-07 09:52:44Z henning $
30: */
31: public class SimpleEmail extends Email {
32: /**
33: * Set the content of the mail
34: *
35: * @param msg A String.
36: * @return An Email.
37: * @throws EmailException see javax.mail.internet.MimeBodyPart
38: * for definitions
39: * @since 1.0
40: */
41: public Email setMsg(String msg) throws EmailException {
42: if (EmailUtils.isEmpty(msg)) {
43: throw new EmailException("Invalid message supplied");
44: }
45:
46: setContent(msg, TEXT_PLAIN);
47: return this;
48: }
49: }
|