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   * @version $Id: EmailConstants.java 1421492 2012-12-13 20:25:53Z tn $
28   */
29  public final class EmailConstants
30  {
31      /** @deprecated since 1.3, not in use since 1.0 */
32      @Deprecated
33      public static final String SENDER_EMAIL = "sender.email";
34  
35      /** @deprecated since 1.3, not in use since 1.0 */
36      @Deprecated
37      public static final String SENDER_NAME = "sender.name";
38  
39      /** @deprecated since 1.3, not in use since 1.0 */
40      @Deprecated
41      public static final String RECEIVER_EMAIL = "receiver.email";
42  
43      /** @deprecated since 1.3, not in use since 1.0 */
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 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 }