1 /**
2 *
3 * Copyright 2003-2005 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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
18 package org.apache.geronimo.javamail.transport.smtp;
19
20 import java.io.InputStream;
21
22 import javax.mail.MessagingException;
23 import javax.mail.Session;
24 import javax.mail.internet.MimeMessage;
25
26 public class SMTPMessage extends MimeMessage {
27
28
29 public static final int NOTIFY_NEVER = -1;
30
31
32 public static final int NOTIFY_SUCCESS = 1;
33
34
35 public static final int NOTIFY_FAILURE = 2;
36
37
38 public static final int NOTIFY_DELAY = 4;
39
40
41 public static final int RETURN_FULL = 1;
42
43
44 public static final int RETURN_HDRS = 2;
45
46
47 protected boolean allow8bitMIME = false;
48
49
50
51 protected String envelopeFrom = null;
52
53
54 protected String mailExtension = null;
55
56
57 protected int notifyOptions = 0;
58
59
60 protected int returnOption = 0;
61
62
63 protected boolean sendPartial = false;
64
65
66 protected String submitter = null;
67
68 /**
69 * Default (and normal) constructor for an SMTPMessage.
70 *
71 * @param session
72 * The hosting Javamail Session.
73 */
74 public SMTPMessage(Session session) {
75
76 super(session);
77 }
78
79 /**
80 * Construct an SMTPMessage instance by reading and parsing the data from
81 * the provided InputStream. The InputStream will be left positioned at the
82 * end of the message data on constructor completion.
83 *
84 * @param session
85 * The hosting Javamail Session.
86 */
87 public SMTPMessage(Session session, InputStream source) throws MessagingException {
88
89 super(session, source);
90 }
91
92 /**
93 * Construct an SMTPMimeMessage from another source MimeMessage object. The
94 * new object and the old object are independent of each other.
95 *
96 * @param source
97 * The source MimeMessage object.
98 */
99 public SMTPMessage(MimeMessage source) throws MessagingException {
100 super(source);
101 }
102
103 /**
104 * Change the allow8BitMime attribute for the message.
105 *
106 * @param a
107 * The new setting.
108 */
109 public void setAllow8bitMIME(boolean a) {
110 allow8bitMIME = a;
111 }
112
113 /**
114 * Retrieve the current 8bitMIME attribute.
115 *
116 * @return The current attribute value.
117 */
118 public boolean getAllow8bitMIME() {
119 return allow8bitMIME;
120 }
121
122 /**
123 * Change the envelopeFrom attribute for the message.
124 *
125 * @param from
126 * The new setting.
127 */
128 public void setEnvelopeFrom(String from) {
129 envelopeFrom = from;
130 }
131
132 /**
133 * Retrieve the current evelopeFrom attribute.
134 *
135 * @return The current attribute value.
136 */
137 public String getEnvelopeFrom() {
138 return envelopeFrom;
139 }
140
141 /**
142 * Change the mailExtension attribute for the message.
143 *
144 * @param e
145 * The new setting.
146 */
147 public void setMailExtension(String e) {
148 mailExtension = e;
149 }
150
151 /**
152 * Retrieve the current mailExtension attribute.
153 *
154 * @return The current attribute value.
155 */
156 public String getMailExtension() {
157 return mailExtension;
158 }
159
160 /**
161 * Change the notifyOptions attribute for the message.
162 *
163 * @param options
164 * The new setting.
165 */
166 public void setNotifyOptions(int options) {
167 notifyOptions = options;
168 }
169
170 /**
171 * Retrieve the current notifyOptions attribute.
172 *
173 * @return The current attribute value.
174 */
175 public int getNotifyOptions() {
176 return notifyOptions;
177 }
178
179 /**
180 * Change the returnOptions attribute for the message.
181 *
182 * @param option
183 * The new setting.
184 */
185 public void setReturnOption(int option) {
186 returnOption = option;
187 }
188
189 /**
190 * Retrieve the current returnOption attribute.
191 *
192 * @return The current attribute value.
193 */
194 public int getReturnOption() {
195 return returnOption;
196 }
197
198 /**
199 * Change the sendPartial attribute for the message.
200 *
201 * @param a
202 * The new setting.
203 */
204 public void setSendPartial(boolean a) {
205 sendPartial = a;
206 }
207
208 /**
209 * Retrieve the current sendPartial attribute.
210 *
211 * @return The current attribute value.
212 */
213 public boolean getSendPartial() {
214 return sendPartial;
215 }
216
217 /**
218 * Change the submitter attribute for the message.
219 *
220 * @param s
221 * The new setting.
222 */
223 public void setSubmitter(String s) {
224 submitter = s;
225 }
226
227 /**
228 * Retrieve the current submitter attribute.
229 *
230 * @return The current attribute value.
231 */
232 public String getSubmitter() {
233 return submitter;
234 }
235 }