1 /*
2 * Copyright 2001-2005 The Apache Software Foundation
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 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 /**
34 * Set the content of the mail
35 *
36 * @param msg A String.
37 * @return An Email.
38 * @throws EmailException see javax.mail.internet.MimeBodyPart
39 * for definitions
40 * @since 1.0
41 */
42 public Email setMsg(String msg) throws EmailException
43 {
44 if (EmailUtils.isEmpty(msg))
45 {
46 throw new EmailException("Invalid message supplied");
47 }
48
49 setContent(msg, TEXT_PLAIN);
50 return this;
51 }
52 }