1 /* 2 * Copyright 2002-2014 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 MailParseException in case of failure when parsing the message 38 * @throws MailAuthenticationException in case of authentication failure 39 * @throws MailSendException in case of failure when sending the message 40 */ 41 void send(SimpleMailMessage simpleMessage) throws MailException; 42 43 /** 44 * Send the given array of simple mail messages in batch. 45 * @param simpleMessages the messages to send 46 * @throws MailParseException in case of failure when parsing a message 47 * @throws MailAuthenticationException in case of authentication failure 48 * @throws MailSendException in case of failure when sending a message 49 */ 50 void send(SimpleMailMessage... simpleMessages) throws MailException; 51 52 }