001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.mail;
018
019/**
020 * Constants used by Email classes.
021 *
022 * A description of the mail session parameter you find at
023 * <a href="http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html">
024 * http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html</a>.
025 *
026 * @since 1.3
027 * @version $Id: EmailConstants.java 1421492 2012-12-13 20:25:53Z tn $
028 */
029public final class EmailConstants
030{
031    /** @deprecated since 1.3, not in use since 1.0 */
032    @Deprecated
033    public static final String SENDER_EMAIL = "sender.email";
034
035    /** @deprecated since 1.3, not in use since 1.0 */
036    @Deprecated
037    public static final String SENDER_NAME = "sender.name";
038
039    /** @deprecated since 1.3, not in use since 1.0 */
040    @Deprecated
041    public static final String RECEIVER_EMAIL = "receiver.email";
042
043    /** @deprecated since 1.3, not in use since 1.0 */
044    public static final String RECEIVER_NAME = "receiver.name";
045
046    /** @deprecated since 1.3, not in use since 1.0 */
047    @Deprecated
048    public static final String EMAIL_SUBJECT = "email.subject";
049
050    /** @deprecated since 1.3, not in use since 1.0 */
051    @Deprecated
052    public static final String EMAIL_BODY = "email.body";
053
054    /** @deprecated since 1.3, not in use since 1.0 */
055    @Deprecated
056    public static final String CONTENT_TYPE = "content.type";
057
058    /** @deprecated since 1.3, not in use since 1.0 */
059    @Deprecated
060    public static final String ATTACHMENTS = "attachments";
061
062    /** @deprecated since 1.3, not in use since 1.0 */
063    @Deprecated
064    public static final String FILE_SERVER = "file.server";
065
066    // Charset constants
067
068    /** charset constant for koi8-r */
069    public static final String KOI8_R = "koi8-r";
070
071    /** charset constant for iso-8859-1 */
072    public static final String ISO_8859_1 = "iso-8859-1";
073
074    /** charset constant for us-ascii */
075    public static final String US_ASCII = "us-ascii";
076
077    /** charset constant for utf-8 */
078    public static final String UTF_8 = "utf-8";
079
080    /** The debug mode to be used. */
081    public static final String MAIL_DEBUG = "mail.debug";
082
083    /** The host name of the mail server. */
084    public static final String MAIL_HOST = "mail.smtp.host";
085
086    /** The port number of the mail server. */
087    public static final String MAIL_PORT = "mail.smtp.port";
088
089    /** The email address to use for SMTP MAIL command. */
090    public static final String MAIL_SMTP_FROM = "mail.smtp.from";
091
092    /** If set to true, tries to authenticate the user using the AUTH command. */
093    public static final String MAIL_SMTP_AUTH = "mail.smtp.auth";
094
095    /** The SMTP user name. */
096    public static final String MAIL_SMTP_USER = "mail.smtp.user";
097
098    /** The SMTP password. */
099    public static final String MAIL_SMTP_PASSWORD = "mail.smtp.password";
100
101    /** Specifies the default transport protocol */
102    public static final String MAIL_TRANSPORT_PROTOCOL = "mail.transport.protocol";
103
104    /** the value to use SMTP as transport protocol */
105    public static final String SMTP = "smtp";
106
107    /** defines the text/html content type */
108    public static final String TEXT_HTML = "text/html";
109
110    /** defines the text/plain content type */
111    public static final String TEXT_PLAIN = "text/plain";
112
113    /////////////////////////////////////////////////////////////////////////
114    // since 1.1
115    /////////////////////////////////////////////////////////////////////////
116
117    /** @deprecated since 1.3 */
118    @Deprecated
119    public static final String MAIL_TRANSPORT_TLS = "mail.smtp.starttls.enable";
120
121    /**
122     * Indicates if the STARTTLS command shall be used to initiate a TLS-secured connection.
123     * @since 1.1
124     */
125    public static final String MAIL_TRANSPORT_STARTTLS_ENABLE = "mail.smtp.starttls.enable";
126
127    /**
128     * Whether to use {@link java.net.Socket} as a fallback if the initial connection fails or not.
129     * @since 1.1
130     */
131    public static final String MAIL_SMTP_SOCKET_FACTORY_FALLBACK = "mail.smtp.socketFactory.fallback";
132
133    /**
134     * Specifies the {@link javax.net.SocketFactory} class to create smtp sockets.
135     * @since 1.1
136     */
137    public static final String MAIL_SMTP_SOCKET_FACTORY_CLASS = "mail.smtp.socketFactory.class";
138
139    /**
140     * Specifies the port to connect to when using a socket factory.
141     * @since 1.1
142     */
143    public static final String MAIL_SMTP_SOCKET_FACTORY_PORT = "mail.smtp.socketFactory.port";
144
145    /////////////////////////////////////////////////////////////////////////
146    // since 1.2
147    /////////////////////////////////////////////////////////////////////////
148
149    /**
150     * Socket connection timeout value in milliseconds. Default is infinite timeout.
151     * @since 1.2
152     */
153    public static final String MAIL_SMTP_CONNECTIONTIMEOUT = "mail.smtp.connectiontimeout";
154
155    /**
156     * Socket I/O timeout value in milliseconds. Default is infinite timeout.
157     * @since 1.2
158     */
159    public static final String MAIL_SMTP_TIMEOUT = "mail.smtp.timeout";
160
161    /////////////////////////////////////////////////////////////////////////
162    // since 1.3
163    /////////////////////////////////////////////////////////////////////////
164
165    /**
166     * Default socket timeout.
167     * @since 1.3
168     */
169    public static final int SOCKET_TIMEOUT_MS = 60000;
170
171    /**
172     * If true, requires the use of the STARTTLS command. If the server doesn't support
173     * the STARTTLS command, the connection will fail.
174     * @since 1.3
175     */
176    public static final String MAIL_TRANSPORT_STARTTLS_REQUIRED = "mail.smtp.starttls.required";
177
178    /**
179     * If set to true, use SSL to connect and use the SSL port by default.
180     * @since 1.3
181     */
182    public static final String MAIL_SMTP_SSL_ENABLE = "mail.smtp.ssl.enable";
183
184    /**
185     * If set to true, check the server identity as specified in RFC 2595.
186     * @since 1.3
187     */
188    public static final String MAIL_SMTP_SSL_CHECKSERVERIDENTITY = "mail.smtp.ssl.checkserveridentity";
189
190    /**
191     * Specifies the {@link javax.net.ssl.SSLSocketFactory} class to use to create SMTP SSL sockets.
192     * @since 1.3
193     */
194    public static final String MAIL_SMTP_SSL_SOCKET_FACTORY_CLASS = "mail.smtp.ssl.socketFactory.class";
195
196    /**
197     * Specifies the port to connect to when using the SMTP SSL socket factory.
198     * @since 1.3
199     */
200    public static final String MAIL_SMTP_SSL_SOCKET_FACTORY_PORT = "mail.smtp.ssl.socketFactory.port";
201
202    /** Hide constructor. */
203    private EmailConstants()
204    {
205        // do nothing
206    }
207
208}