KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > mail > MailSender


1 /*
2  * Copyright 2002-2005 the original author or authors.
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 org.springframework.mail;
18
19 /**
20  * This interface defines a strategy for sending simple mails. Can be
21  * implemented for a variety of mailing systems due to the simple requirements.
22  * For richer functionality like MIME messages, consider JavaMailSender.
23  *
24  * <p>Allows for easy testing of clients, as it does not depend on JavaMail's
25  * infrastructure classes: no mocking of JavaMail Session or Transport necessary.
26  *
27  * @author Dmitriy Kopylenko
28  * @author Juergen Hoeller
29  * @since 10.09.2003
30  * @see org.springframework.mail.javamail.JavaMailSender
31  */

32 public interface MailSender {
33     
34     /**
35      * Send the given simple mail message.
36      * @param simpleMessage the message to send
37      * @throws org.springframework.mail.MailParseException
38      * in case of failure when parsing the message
39      * @throws org.springframework.mail.MailAuthenticationException
40      * in case of authentication failure
41      * @throws org.springframework.mail.MailSendException
42      * in case of failure when sending the message
43      */

44     void send(SimpleMailMessage simpleMessage) throws MailException;
45
46     /**
47      * Send the given array of simple mail messages in batch.
48      * @param simpleMessages the messages to send
49      * @throws org.springframework.mail.MailParseException
50      * in case of failure when parsing a message
51      * @throws org.springframework.mail.MailAuthenticationException
52      * in case of authentication failure
53      * @throws org.springframework.mail.MailSendException
54      * in case of failure when sending a message
55      */

56     void send(SimpleMailMessage[] simpleMessages) throws MailException;
57
58 }
59
Popular Tags