All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ninja.postoffice.Mail Maven / Gradle / Ivy

/**
 * Copyright (C) 2012-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ninja.postoffice;

import java.util.Collection;
import java.util.Map;

import ninja.postoffice.common.MailImpl;

import com.google.inject.ImplementedBy;

/**
 * A simple interface.
 * 
 * It is modeled after org.apache.commons.mail.Email.
 * 
 * But it allows us not to use org.apache.commons.mail.Email at all, use
 * Javamail or anything else.
 * 
 * @author rbauer
 * 
 */
@ImplementedBy(MailImpl.class)
public interface Mail {

    void setSubject(String subject);

    String getSubject();

    /**
     * In general email addresses could look like:
     * Joe Jocker 
     * or
     * [email protected].
     * 
     * Make sure your implementation and / or your mailer can handle these.
     * 
     * @param tos
     */
    void addTo(String... tos);

    Collection getTos();

    /**
     * In general email addresses could look like:
     * Joe Jocker 
     * or
     * [email protected].
     * 
     * Make sure your implementation and / or your mailer can handle these.
     * 
     * @param tos
     */
    void setFrom(String from);

    String getFrom();

    /**
     * In general email addresses could look like:
     * Joe Jocker 
     * or
     * [email protected].
     * 
     * Make sure your implementation and / or your mailer can handle these.
     * 
     * @param replyTos
     */
    void addReplyTo(String... replyTos);

    Collection getReplyTo();

    /**
     * In general email addresses could look like:
     * Joe Jocker 
     * or
     * [email protected].
     * 
     * Make sure your implementation and / or your mailer can handle these.
     * 
     * @param ccs
     */
    void addCc(String... ccs);

    Collection getCcs();

    /**
     * In general email addresses could look like:
     * Joe Jocker 
     * or
     * [email protected].
     * 
     * Make sure your implementation and / or your mailer can handle these.
     * 
     * @param bccs
     */
    void addBcc(String... bccs);

    Collection getBccs();

    void setCharset(String charset);

    String getCharset();

    void addHeader(String key, String value);

    Map getHeaders();

    void setBodyHtml(String html);

    String getBodyHtml();

    void setBodyText(String text);

    String getBodyText();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy