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 1532531 2013-10-15 21:13:11Z 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 html subtype */
111    public static final String TEXT_SUBTYPE_HTML = "html";
112
113    /** defines the text/plain content type */
114    public static final String TEXT_PLAIN = "text/plain";
115
116    /////////////////////////////////////////////////////////////////////////
117    // since 1.1
118    /////////////////////////////////////////////////////////////////////////
119
120    /** @deprecated since 1.3 */
121    @Deprecated
122    public static final String MAIL_TRANSPORT_TLS = "mail.smtp.starttls.enable";
123
124    /**
125     * Indicates if the STARTTLS command shall be used to initiate a TLS-secured connection.
126     * @since 1.1
127     */
128    public static final String MAIL_TRANSPORT_STARTTLS_ENABLE = "mail.smtp.starttls.enable";
129
130    /**
131     * Whether to use {@link java.net.Socket} as a fallback if the initial connection fails or not.
132     * @since 1.1
133     */
134    public static final String MAIL_SMTP_SOCKET_FACTORY_FALLBACK = "mail.smtp.socketFactory.fallback";
135
136    /**
137     * Specifies the {@link javax.net.SocketFactory} class to create smtp sockets.
138     * @since 1.1
139     */
140    public static final String MAIL_SMTP_SOCKET_FACTORY_CLASS = "mail.smtp.socketFactory.class";
141
142    /**
143     * Specifies the port to connect to when using a socket factory.
144     * @since 1.1
145     */
146    public static final String MAIL_SMTP_SOCKET_FACTORY_PORT = "mail.smtp.socketFactory.port";
147
148    /////////////////////////////////////////////////////////////////////////
149    // since 1.2
150    /////////////////////////////////////////////////////////////////////////
151
152    /**
153     * Socket connection timeout value in milliseconds. Default is infinite timeout.
154     * @since 1.2
155     */
156    public static final String MAIL_SMTP_CONNECTIONTIMEOUT = "mail.smtp.connectiontimeout";
157
158    /**
159     * Socket I/O timeout value in milliseconds. Default is infinite timeout.
160     * @since 1.2
161     */
162    public static final String MAIL_SMTP_TIMEOUT = "mail.smtp.timeout";
163
164    /////////////////////////////////////////////////////////////////////////
165    // since 1.3
166    /////////////////////////////////////////////////////////////////////////
167
168    /**
169     * Default socket timeout.
170     * @since 1.3
171     */
172    public static final int SOCKET_TIMEOUT_MS = 60000;
173
174    /**
175     * If true, requires the use of the STARTTLS command. If the server doesn't support
176     * the STARTTLS command, the connection will fail.
177     * @since 1.3
178     */
179    public static final String MAIL_TRANSPORT_STARTTLS_REQUIRED = "mail.smtp.starttls.required";
180
181    /**
182     * If set to true, use SSL to connect and use the SSL port by default.
183     * @since 1.3
184     */
185    public static final String MAIL_SMTP_SSL_ENABLE = "mail.smtp.ssl.enable";
186
187    /**
188     * If set to true, check the server identity as specified in RFC 2595.
189     * @since 1.3
190     */
191    public static final String MAIL_SMTP_SSL_CHECKSERVERIDENTITY = "mail.smtp.ssl.checkserveridentity";
192
193    /**
194     * Specifies the {@link javax.net.ssl.SSLSocketFactory} class to use to create SMTP SSL sockets.
195     * @since 1.3
196     */
197    public static final String MAIL_SMTP_SSL_SOCKET_FACTORY_CLASS = "mail.smtp.ssl.socketFactory.class";
198
199    /**
200     * Specifies the port to connect to when using the SMTP SSL socket factory.
201     * @since 1.3
202     */
203    public static final String MAIL_SMTP_SSL_SOCKET_FACTORY_PORT = "mail.smtp.ssl.socketFactory.port";
204
205    /////////////////////////////////////////////////////////////////////////
206    // since 1.3.2
207    /////////////////////////////////////////////////////////////////////////
208
209    /**
210     * If set to true, and a message has some valid and some invalid addresses, send the message anyway,
211     * reporting the partial failure with a SendFailedException.
212     * If set to false (the default), the message is not sent to any of the recipients
213     * if there is an invalid recipient address.
214     * @since 1.3.2
215     */
216    public static final String MAIL_SMTP_SEND_PARTIAL = "mail.smtp.sendpartial";
217
218    /**
219     * If set to true, and a message has some valid and some invalid addresses, send the message anyway,
220     * reporting the partial failure with a SendFailedException.
221     * If set to false (the default), the message is not sent to any of the recipients
222     * if there is an invalid recipient address.
223     * @since 1.3.2
224     */
225    public static final String MAIL_SMTPS_SEND_PARTIAL = "mail.smtps.sendpartial";
226
227    /**
228     * Defines the default mime charset to use when none has been specified for the message.
229     * @since 1.3.2
230     */
231    public static final String MAIL_MIME_CHARSET = "mail.mime.charset";
232
233    /** Hide constructor. */
234    private EmailConstants()
235    {
236        // do nothing
237    }
238
239}