001 /*
002 * Copyright 2010 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 * http://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 package com.hs.mail.mailet;
017
018 import java.io.IOException;
019
020 import com.hs.mail.imap.mailbox.MailboxManager;
021 import com.hs.mail.imap.user.UserManager;
022 import com.hs.mail.smtp.message.SmtpMessage;
023
024 public interface MailetContext {
025
026 /**
027 *
028 * @return
029 */
030 public MailboxManager getMailboxManager();
031
032 /**
033 *
034 * @return
035 */
036 public UserManager getUserManager();
037
038 /**
039 * Send an outgoing message to the top of this mailet container's root queue.
040 * This is the equivalent of opening an SMTP session to localhost.
041 *
042 * @param sender
043 * the sender of the message
044 * @param recipients
045 * an Array of mail addresses of recipients
046 * @param msg
047 * the SmtpMessage of the headers and body content of the
048 * outgoing message
049 * @throws IOException
050 */
051 void sendMail(String sender, String[] recipients, SmtpMessage msg) throws IOException;
052
053 /**
054 * Stores the message in the target folder.
055 *
056 * @param destination
057 * the destination folder where this message will be stored
058 * @param msg
059 * the SmtpMessage to store in a local mailbox
060 * @throws IOException
061 */
062 void storeMail(long soleRecipientID, String destination, SmtpMessage msg)
063 throws IOException;
064
065 }