001/*
002 * Copyright 2002-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.mail;
018
019import java.util.Date;
020
021/**
022 * This is a common interface for mail messages, allowing a user to set key
023 * values required in assembling a mail message, without needing to know if
024 * the underlying message is a simple text message or a more sophisticated
025 * MIME message.
026 *
027 * <p>Implemented by both SimpleMailMessage and MimeMessageHelper,
028 * to let message population code interact with a simple message or a
029 * MIME message through a common interface.
030 *
031 * @author Juergen Hoeller
032 * @since 1.1.5
033 * @see SimpleMailMessage
034 * @see org.springframework.mail.javamail.MimeMessageHelper
035 */
036public interface MailMessage {
037
038        void setFrom(String from) throws MailParseException;
039
040        void setReplyTo(String replyTo) throws MailParseException;
041
042        void setTo(String to) throws MailParseException;
043
044        void setTo(String[] to) throws MailParseException;
045
046        void setCc(String cc) throws MailParseException;
047
048        void setCc(String[] cc) throws MailParseException;
049
050        void setBcc(String bcc) throws MailParseException;
051
052        void setBcc(String[] bcc) throws MailParseException;
053
054        void setSentDate(Date sentDate) throws MailParseException;
055
056        void setSubject(String subject) throws MailParseException;
057
058        void setText(String text) throws MailParseException;
059
060}