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 1665699 2015-03-10 21:12:09Z 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    @Deprecated
045    public static final String RECEIVER_NAME = "receiver.name";
046
047    /** @deprecated since 1.3, not in use since 1.0 */
048    @Deprecated
049    public static final String EMAIL_SUBJECT = "email.subject";
050
051    /** @deprecated since 1.3, not in use since 1.0 */
052    @Deprecated
053    public static final String EMAIL_BODY = "email.body";
054
055    /** @deprecated since 1.3, not in use since 1.0 */
056    @Deprecated
057    public static final String CONTENT_TYPE = "content.type";
058
059    /** @deprecated since 1.3, not in use since 1.0 */
060    @Deprecated
061    public static final String ATTACHMENTS = "attachments";
062
063    /** @deprecated since 1.3, not in use since 1.0 */
064    @Deprecated
065    public static final String FILE_SERVER = "file.server";
066
067    // Charset constants
068
069    /** charset constant for koi8-r */
070    public static final String KOI8_R = "koi8-r";
071
072    /** charset constant for iso-8859-1 */
073    public static final String ISO_8859_1 = "iso-8859-1";
074
075    /** charset constant for us-ascii */
076    public static final String US_ASCII = "us-ascii";
077
078    /** charset constant for utf-8 */
079    public static final String UTF_8 = "utf-8";
080
081    /** The debug mode to be used. */
082    public static final String MAIL_DEBUG = "mail.debug";
083
084    /** The host name of the mail server. */
085    public static final String MAIL_HOST = "mail.smtp.host";
086
087    /** The port number of the mail server. */
088    public static final String MAIL_PORT = "mail.smtp.port";
089
090    /** The email address to use for SMTP MAIL command. */
091    public static final String MAIL_SMTP_FROM = "mail.smtp.from";
092
093    /** If set to true, tries to authenticate the user using the AUTH command. */
094    public static final String MAIL_SMTP_AUTH = "mail.smtp.auth";
095
096    /** The SMTP user name. */
097    public static final String MAIL_SMTP_USER = "mail.smtp.user";
098
099    /** The SMTP password. */
100    public static final String MAIL_SMTP_PASSWORD = "mail.smtp.password";
101
102    /** Specifies the default transport protocol */
103    public static final String MAIL_TRANSPORT_PROTOCOL = "mail.transport.protocol";
104
105    /** the value to use SMTP as transport protocol */
106    public static final String SMTP = "smtp";
107
108    /** defines the text/html content type */
109    public static final String TEXT_HTML = "text/html";
110
111    /** defines the html subtype */
112    public static final String TEXT_SUBTYPE_HTML = "html";
113
114    /** defines the text/plain content type */
115    public static final String TEXT_PLAIN = "text/plain";
116
117    /////////////////////////////////////////////////////////////////////////
118    // since 1.1
119    /////////////////////////////////////////////////////////////////////////
120
121    /** @deprecated since 1.3 */
122    @Deprecated
123    public static final String MAIL_TRANSPORT_TLS = "mail.smtp.starttls.enable";
124
125    /**
126     * Indicates if the STARTTLS command shall be used to initiate a TLS-secured connection.
127     * @since 1.1
128     */
129    public static final String MAIL_TRANSPORT_STARTTLS_ENABLE = "mail.smtp.starttls.enable";
130
131    /**
132     * Whether to use {@link java.net.Socket} as a fallback if the initial connection fails or not.
133     * @since 1.1
134     */
135    public static final String MAIL_SMTP_SOCKET_FACTORY_FALLBACK = "mail.smtp.socketFactory.fallback";
136
137    /**
138     * Specifies the {@link javax.net.SocketFactory} class to create smtp sockets.
139     * @since 1.1
140     */
141    public static final String MAIL_SMTP_SOCKET_FACTORY_CLASS = "mail.smtp.socketFactory.class";
142
143    /**
144     * Specifies the port to connect to when using a socket factory.
145     * @since 1.1
146     */
147    public static final String MAIL_SMTP_SOCKET_FACTORY_PORT = "mail.smtp.socketFactory.port";
148
149    /////////////////////////////////////////////////////////////////////////
150    // since 1.2
151    /////////////////////////////////////////////////////////////////////////
152
153    /**
154     * Socket connection timeout value in milliseconds. Default is infinite timeout.
155     * @since 1.2
156     */
157    public static final String MAIL_SMTP_CONNECTIONTIMEOUT = "mail.smtp.connectiontimeout";
158
159    /**
160     * Socket I/O timeout value in milliseconds. Default is infinite timeout.
161     * @since 1.2
162     */
163    public static final String MAIL_SMTP_TIMEOUT = "mail.smtp.timeout";
164
165    /////////////////////////////////////////////////////////////////////////
166    // since 1.3
167    /////////////////////////////////////////////////////////////////////////
168
169    /**
170     * Default socket timeout.
171     * @since 1.3
172     */
173    public static final int SOCKET_TIMEOUT_MS = 60000;
174
175    /**
176     * If true, requires the use of the STARTTLS command. If the server doesn't support
177     * the STARTTLS command, the connection will fail.
178     * @since 1.3
179     */
180    public static final String MAIL_TRANSPORT_STARTTLS_REQUIRED = "mail.smtp.starttls.required";
181
182    /**
183     * If set to true, use SSL to connect and use the SSL port by default.
184     * @since 1.3
185     */
186    public static final String MAIL_SMTP_SSL_ENABLE = "mail.smtp.ssl.enable";
187
188    /**
189     * If set to true, check the server identity as specified in RFC 2595.
190     * @since 1.3
191     */
192    public static final String MAIL_SMTP_SSL_CHECKSERVERIDENTITY = "mail.smtp.ssl.checkserveridentity";
193
194    /**
195     * Specifies the {@link javax.net.ssl.SSLSocketFactory} class to use to create SMTP SSL sockets.
196     * @since 1.3
197     */
198    public static final String MAIL_SMTP_SSL_SOCKET_FACTORY_CLASS = "mail.smtp.ssl.socketFactory.class";
199
200    /**
201     * Specifies the port to connect to when using the SMTP SSL socket factory.
202     * @since 1.3
203     */
204    public static final String MAIL_SMTP_SSL_SOCKET_FACTORY_PORT = "mail.smtp.ssl.socketFactory.port";
205
206    /////////////////////////////////////////////////////////////////////////
207    // since 1.3.2
208    /////////////////////////////////////////////////////////////////////////
209
210    /**
211     * If set to true, and a message has some valid and some invalid addresses, send the message anyway,
212     * reporting the partial failure with a SendFailedException.
213     * If set to false (the default), the message is not sent to any of the recipients
214     * if there is an invalid recipient address.
215     * @since 1.3.2
216     */
217    public static final String MAIL_SMTP_SEND_PARTIAL = "mail.smtp.sendpartial";
218
219    /**
220     * If set to true, and a message has some valid and some invalid addresses, send the message anyway,
221     * reporting the partial failure with a SendFailedException.
222     * If set to false (the default), the message is not sent to any of the recipients
223     * if there is an invalid recipient address.
224     * @since 1.3.2
225     */
226    public static final String MAIL_SMTPS_SEND_PARTIAL = "mail.smtps.sendpartial";
227
228    /**
229     * Defines the default mime charset to use when none has been specified for the message.
230     * @since 1.3.2
231     */
232    public static final String MAIL_MIME_CHARSET = "mail.mime.charset";
233
234    /////////////////////////////////////////////////////////////////////////
235    // since 1.4
236    /////////////////////////////////////////////////////////////////////////
237
238    /**
239     * The from email address.
240     * @since 1.4
241     */
242    public static final String MAIL_FROM = "mail.from";
243
244
245    /** Hide constructor. */
246    private EmailConstants()
247    {
248        // do nothing
249    }
250
251}