View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.mail;
18  
19  /**
20   * Constants used by Email classes.
21   *
22   * A description of the mail session parameter you find at
23   * <a href="http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html">
24   * http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html</a>.
25   *
26   * @since 1.3
27   */
28  public final class EmailConstants
29  {
30      /** @deprecated since 1.3, not in use since 1.0 */
31      @Deprecated
32      public static final String SENDER_EMAIL = "sender.email";
33  
34      /** @deprecated since 1.3, not in use since 1.0 */
35      @Deprecated
36      public static final String SENDER_NAME = "sender.name";
37  
38      /** @deprecated since 1.3, not in use since 1.0 */
39      @Deprecated
40      public static final String RECEIVER_EMAIL = "receiver.email";
41  
42      /** @deprecated since 1.3, not in use since 1.0 */
43      @Deprecated
44      public static final String RECEIVER_NAME = "receiver.name";
45  
46      /** @deprecated since 1.3, not in use since 1.0 */
47      @Deprecated
48      public static final String EMAIL_SUBJECT = "email.subject";
49  
50      /** @deprecated since 1.3, not in use since 1.0 */
51      @Deprecated
52      public static final String EMAIL_BODY = "email.body";
53  
54      /** @deprecated since 1.3, not in use since 1.0 */
55      @Deprecated
56      public static final String CONTENT_TYPE = "content.type";
57  
58      /** @deprecated since 1.3, not in use since 1.0 */
59      @Deprecated
60      public static final String ATTACHMENTS = "attachments";
61  
62      /** @deprecated since 1.3, not in use since 1.0 */
63      @Deprecated
64      public static final String FILE_SERVER = "file.server";
65  
66      // Charset constants
67  
68      /** charset constant for koi8-r */
69      public static final String KOI8_R = "koi8-r";
70  
71      /** charset constant for iso-8859-1 */
72      public static final String ISO_8859_1 = "iso-8859-1";
73  
74      /** charset constant for us-ascii */
75      public static final String US_ASCII = "us-ascii";
76  
77      /** charset constant for utf-8 */
78      public static final String UTF_8 = "utf-8";
79  
80      /** The debug mode to be used. */
81      public static final String MAIL_DEBUG = "mail.debug";
82  
83      /** The host name of the mail server. */
84      public static final String MAIL_HOST = "mail.smtp.host";
85  
86      /** The port number of the mail server. */
87      public static final String MAIL_PORT = "mail.smtp.port";
88  
89      /** The email address to use for SMTP MAIL command. */
90      public static final String MAIL_SMTP_FROM = "mail.smtp.from";
91  
92      /** If set to true, tries to authenticate the user using the AUTH command. */
93      public static final String MAIL_SMTP_AUTH = "mail.smtp.auth";
94  
95      /** The SMTP user name. */
96      public static final String MAIL_SMTP_USER = "mail.smtp.user";
97  
98      /** The SMTP password. */
99      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     /////////////////////////////////////////////////////////////////////////
234     // since 1.4
235     /////////////////////////////////////////////////////////////////////////
236 
237     /**
238      * The from email address.
239      * @since 1.4
240      */
241     public static final String MAIL_FROM = "mail.from";
242 
243 
244     /** Hide constructor. */
245     private EmailConstants()
246     {
247         // do nothing
248     }
249 
250 }