Author: veithen
Date: Fri Oct 10 16:40:16 2008
New Revision: 703607
URL: http://svn.apache.org/viewvc?rev=703607&view=rev
Log:
Mail transport:
* Improve debugging capabilities by allowing to redirect JavaMail debug output
to the logs (instead of System.out).
* Activate this in the transport tests.
Added:
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailUtils.java
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WriterOutputStream.java
Modified:
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/ParamUtils.java
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailConstants.java
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailTestEnvironment.java
Modified:
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/ParamUtils.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/ParamUtils.java?rev=703607&r1=703606&r2=703607&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/ParamUtils.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/ParamUtils.java
Fri Oct 10 16:40:16 2008
@@ -24,6 +24,7 @@
import org.apache.axis2.description.ParameterInclude;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.util.JavaUtils;
/**
* Utility class with methods to manipulate service or transport parameters.
@@ -77,6 +78,11 @@
return value == null ? defaultValue : value.intValue();
}
+ public static boolean getOptionalParamBoolean(ParameterInclude
paramInclude, String paramName, boolean defaultValue) throws AxisFault {
+ Parameter param = paramInclude.getParameter(paramName);
+ return param == null ? defaultValue :
JavaUtils.isTrueExplicitly(param.getValue(), defaultValue);
+ }
+
public static int getRequiredParamInt(ParameterInclude paramInclude,
String paramName) throws AxisFault {
Integer value = getOptionalParamInt(paramInclude, paramName);
if (value == null) {
Added:
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java?rev=703607&view=auto
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
(added)
+++
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
Fri Oct 10 16:40:16 2008
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.mail;
+
+import java.io.Writer;
+
+import org.apache.commons.logging.Log;
+
+/**
+ * [EMAIL PROTECTED] Writer} implementation that redirects to a logger.
+ */
+public class LogWriter extends Writer {
+ private final Log log;
+ private final String endOfLine;
+ private final StringBuffer lineBuffer = new StringBuffer();
+ private int endOfLineMatch;
+
+ public LogWriter(Log log, String endOfLine) {
+ this.log = log;
+ this.endOfLine = endOfLine;
+ }
+
+ public LogWriter(Log log) {
+ this(log, System.getProperty("line.separator"));
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) {
+ int start = off;
+ for (int i=off; i<off+len; i++) {
+ if (cbuf[i] == endOfLine.charAt(endOfLineMatch)) {
+ endOfLineMatch++;
+ if (endOfLineMatch == endOfLine.length()) {
+ lineBuffer.append(cbuf, start,
i-start+1);
+
lineBuffer.setLength(lineBuffer.length()-endOfLine.length());
+ flushLineBuffer();
+ start = i+1;
+ endOfLineMatch = 0;
+ }
+ } else {
+ endOfLineMatch = 0;
+ }
+ }
+ lineBuffer.append(cbuf, start, off+len-start);
+ }
+
+ @Override
+ public void close() {
+ if (lineBuffer.length() > 0) {
+ flushLineBuffer();
+ }
+ }
+
+ @Override
+ public void flush() {
+ // Nothing to do
+ }
+
+ private void flushLineBuffer() {
+ log.info(lineBuffer.toString());
+ lineBuffer.setLength(0);
+ }
+}
Modified:
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailConstants.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailConstants.java?rev=703607&r1=703606&r2=703607&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailConstants.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailConstants.java
Fri Oct 10 16:40:16 2008
@@ -47,6 +47,8 @@
public static final String TRANSPORT_MAIL_ADDRESS =
"transport.mail.Address";
+ public static final String TRANSPORT_MAIL_DEBUG = "transport.mail.Debug";
+
/**
* Key for the mail store protocol parameter.
* The mail store protocol identifier is used in calls to [EMAIL
PROTECTED] Session#getStore()}.
Modified:
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java?rev=703607&r1=703606&r2=703607&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java
Fri Oct 10 16:40:16 2008
@@ -578,7 +578,7 @@
}
Session session = Session.getInstance(props, null);
- session.setDebug(log.isTraceEnabled());
+ MailUtils.setupLogging(session, log, paramIncl);
entry.setSession(session);
entry.setContentType(
Modified:
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java?rev=703607&r1=703606&r2=703607&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
Fri Oct 10 16:40:16 2008
@@ -122,7 +122,7 @@
session = Session.getInstance(props, null);
}
- session.setDebug(log.isTraceEnabled());
+ MailUtils.setupLogging(session, log, transportOut);
// set the synchronise callback table
if (cfgCtx.getProperty(BaseConstants.CALLBACK_TABLE) == null){
Added:
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailUtils.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailUtils.java?rev=703607&view=auto
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailUtils.java
(added)
+++
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailUtils.java
Fri Oct 10 16:40:16 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.mail;
+
+import java.io.PrintStream;
+
+import javax.mail.Session;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.ParameterInclude;
+import org.apache.axis2.transport.base.ParamUtils;
+import org.apache.commons.logging.Log;
+
+public class MailUtils {
+ private MailUtils() {}
+
+ public static void setupLogging(Session session, Log log, ParameterInclude
params) throws AxisFault {
+ // Note that debugging might already be enabled by the mail.debug
property and we should
+ // take care to override it.
+ if (log.isTraceEnabled()) {
+ // This is the old behavior: just set debug to true
+ session.setDebug(true);
+ }
+ if (ParamUtils.getOptionalParamBoolean(params,
MailConstants.TRANSPORT_MAIL_DEBUG, false)) {
+ // Redirect debug output to where it belongs, namely to the logs!
+ session.setDebugOut(new PrintStream(new WriterOutputStream(new
LogWriter(log)), true));
+ // Only enable debug afterwards since the call to setDebug might
already cause debug output
+ session.setDebug(true);
+ }
+ }
+}
Added:
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WriterOutputStream.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WriterOutputStream.java?rev=703607&view=auto
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WriterOutputStream.java
(added)
+++
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WriterOutputStream.java
Fri Oct 10 16:40:16 2008
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.mail;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CoderResult;
+import java.nio.charset.CodingErrorAction;
+
+/**
+ * [EMAIL PROTECTED] OutputStream} implementation that transforms a byte
stream to a
+ * character stream using a specified charset encoding and writes the resulting
+ * stream to a [EMAIL PROTECTED] Writer}. The stream is transformed using a
+ * [EMAIL PROTECTED] CharsetDecoder} object, guaranteeing that all charset
+ * encodings supported by the JRE are handled correctly.
+ * <p>
+ * The output of the [EMAIL PROTECTED] CharsetDecoder} is buffered using a
fixed size buffer.
+ * This implies that the data is written to the underlying [EMAIL PROTECTED]
Writer} in chunks
+ * that are no larger than the size of this buffer. By default, the buffer is
+ * flushed only when it overflows or when [EMAIL PROTECTED] #flush()} or
[EMAIL PROTECTED] #close()}
+ * is called. In general there is therefore no need to wrap the underlying
[EMAIL PROTECTED] Writer}
+ * in a [EMAIL PROTECTED] java.io.BufferedWriter}. [EMAIL PROTECTED]
WriterOutputStream} can also
+ * be instructed to flush the buffer after each write operation. In this case,
all
+ * available data is written immediately to the underlying [EMAIL PROTECTED]
Writer}, implying that
+ * the current position of the [EMAIL PROTECTED] Writer} is correlated to the
current position
+ * of the [EMAIL PROTECTED] WriterOutputStream}.
+ * <p>
+ * [EMAIL PROTECTED] WriterOutputStream} implements the inverse transformation
of [EMAIL PROTECTED] java.io.OutputStreamWriter};
+ * in the following example, writing to <tt>out2</tt> would have the same
result as writing to
+ * <tt>out</tt> directly (provided that the byte sequence is legal with
respect to the
+ * charset encoding):
+ * <pre>
+ * OutputStream out = ...
+ * Charset cs = ...
+ * OutputStreamWriter writer = new OutputStreamWriter(out, cs);
+ * WriterOutputStream out2 = new WriterOutputStream(writer, cs);</pre>
+ * [EMAIL PROTECTED] WriterOutputStream} implements the same transformation as
[EMAIL PROTECTED] java.io.InputStreamReader},
+ * except that the control flow is reversed: both classes transform a byte
stream
+ * into a character stream, but [EMAIL PROTECTED] java.io.InputStreamReader}
pulls data from the underlying stream,
+ * while [EMAIL PROTECTED] WriterOutputStream} pushes it to the underlying
stream.
+ * <p>
+ * Note that while there are use cases where there is no alternative to using
+ * this class, very often the need to use this class is an indication of a flaw
+ * in the design of the code. This class is typically used in situations where
an existing
+ * API only accepts an [EMAIL PROTECTED] OutputStream} object, but where the
stream is known to represent
+ * character data that must be decoded for further use.
+ * <p>
+ * Instances of [EMAIL PROTECTED] WriterOutputStream} are not thread safe.
+ */
+public class WriterOutputStream extends OutputStream {
+ private static final int DEFAULT_BUFFER_SIZE = 1024;
+
+ private final Writer writer;
+ private final CharsetDecoder decoder;
+ private final boolean writeImmediately;
+
+ /**
+ * ByteBuffer used as input for the decoder. This buffer can be small
+ * as it is used only to transfer the received data to the
+ * decoder.
+ */
+ private final ByteBuffer decoderIn = ByteBuffer.allocate(128);
+
+ /**
+ * CharBuffer used as output for the decoder. It should be
+ * somewhat larger as we write from this buffer to the
+ * underlying Writer.
+ */
+ private final CharBuffer decoderOut;
+
+ /**
+ * Constructs a new [EMAIL PROTECTED] WriterOutputStream}.
+ *
+ * @param writer the target [EMAIL PROTECTED] Writer}
+ * @param charset the charset encoding
+ * @param bufferSize the size of the output buffer in number of characters
+ * @param writeImmediately If <tt>true</tt> the output buffer will be
flushed after each
+ * write operation, i.e. all available data will
be written to the
+ * underlying [EMAIL PROTECTED] Writer}
immediately. If <tt>false</tt>, the
+ * output buffer will only be flushed when it
overflows or when
+ * [EMAIL PROTECTED] #flush()} or [EMAIL
PROTECTED] #close()} is called.
+ */
+ public WriterOutputStream(Writer writer, Charset charset, int bufferSize,
boolean writeImmediately) {
+ this.writer = writer;
+ decoder = charset.newDecoder();
+ decoder.onMalformedInput(CodingErrorAction.REPLACE);
+ decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ decoder.replaceWith("?");
+ this.writeImmediately = writeImmediately;
+ decoderOut = CharBuffer.allocate(bufferSize);
+ }
+
+ /**
+ * Constructs a new [EMAIL PROTECTED] WriterOutputStream} with a default
output buffer size of
+ * 1024 characters. The output buffer will only be flushed when it
overflows or when
+ * [EMAIL PROTECTED] #flush()} or [EMAIL PROTECTED] #close()} is called.
+ *
+ * @param writer the target [EMAIL PROTECTED] Writer}
+ * @param charset the charset encoding
+ */
+ public WriterOutputStream(Writer writer, Charset charset) {
+ this(writer, charset, DEFAULT_BUFFER_SIZE, false);
+ }
+
+ /**
+ * Constructs a new [EMAIL PROTECTED] WriterOutputStream}.
+ *
+ * @param writer the target [EMAIL PROTECTED] Writer}
+ * @param charsetName the name of the charset encoding
+ * @param bufferSize the size of the output buffer in number of characters
+ * @param writeImmediately If <tt>true</tt> the output buffer will be
flushed after each
+ * write operation, i.e. all available data will
be written to the
+ * underlying [EMAIL PROTECTED] Writer}
immediately. If <tt>false</tt>, the
+ * output buffer will only be flushed when it
overflows or when
+ * [EMAIL PROTECTED] #flush()} or [EMAIL
PROTECTED] #close()} is called.
+ */
+ public WriterOutputStream(Writer writer, String charsetName, int
bufferSize, boolean writeImmediately) {
+ this(writer, Charset.forName(charsetName), bufferSize,
writeImmediately);
+ }
+
+ /**
+ * Constructs a new [EMAIL PROTECTED] WriterOutputStream} with a default
output buffer size of
+ * 1024 characters. The output buffer will only be flushed when it
overflows or when
+ * [EMAIL PROTECTED] #flush()} or [EMAIL PROTECTED] #close()} is called.
+ *
+ * @param writer the target [EMAIL PROTECTED] Writer}
+ * @param charsetName the name of the charset encoding
+ */
+ public WriterOutputStream(Writer writer, String charsetName) {
+ this(writer, charsetName, DEFAULT_BUFFER_SIZE, false);
+ }
+
+ /**
+ * Constructs a new [EMAIL PROTECTED] WriterOutputStream} that uses the
default character encoding
+ * and with a default output buffer size of 1024 characters. The output
buffer will only
+ * be flushed when it overflows or when [EMAIL PROTECTED] #flush()} or
[EMAIL PROTECTED] #close()} is called.
+ *
+ * @param writer the target [EMAIL PROTECTED] Writer}
+ */
+ public WriterOutputStream(Writer writer) {
+ this(writer, Charset.defaultCharset(), DEFAULT_BUFFER_SIZE, false);
+ }
+
+ /**
+ * Write bytes from the specified byte array to the stream.
+ *
+ * @param b the byte array containing the bytes to write
+ * @param off the start offset in the byte array
+ * @param len the number of bytes to write
+ */
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ while (len > 0) {
+ int c = Math.min(len, decoderIn.remaining());
+ decoderIn.put(b, off, c);
+ processInput(false);
+ len -= c;
+ off += c;
+ }
+ if (writeImmediately) {
+ flushOutput();
+ }
+ }
+
+ /**
+ * Write bytes from the specified byte array to the stream.
+ *
+ * @param b the byte array containing the bytes to write
+ */
+ @Override
+ public void write(byte[] b) throws IOException {
+ write(b, 0, b.length);
+ }
+
+ /**
+ * Write a single byte to the stream.
+ *
+ * @param b the byte to write
+ */
+ @Override
+ public void write(int b) throws IOException {
+ write(new byte[] { (byte)b }, 0, 1);
+ }
+
+ /**
+ * Flush the stream. Any remaining content accumulated in the output buffer
+ * will be written to the underlying [EMAIL PROTECTED] Writer}. After that
+ * [EMAIL PROTECTED] Writer#flush()} will be called.
+ */
+ @Override
+ public void flush() throws IOException {
+ flushOutput();
+ writer.flush();
+ }
+
+ /**
+ * Close the stream. Any remaining content accumulated in the output buffer
+ * will be written to the underlying [EMAIL PROTECTED] Writer}. After that
+ * [EMAIL PROTECTED] Writer#close()} will be called.
+ */
+ @Override
+ public void close() throws IOException {
+ processInput(true);
+ flushOutput();
+ writer.close();
+ }
+
+ private void processInput(boolean endOfInput) throws IOException {
+ // Prepare decoderIn for reading
+ decoderIn.flip();
+ CoderResult coderResult;
+ while (true) {
+ coderResult = decoder.decode(decoderIn, decoderOut, endOfInput);
+ if (coderResult.isOverflow()) {
+ flushOutput();
+ } else if (coderResult.isUnderflow()) {
+ break;
+ } else {
+ // The decoder is configured to replace malformed input and
unmappable characters,
+ // so we should not get here.
+ throw new IOException("Unexpected coder result");
+ }
+ }
+ // Discard the bytes that have been read
+ decoderIn.compact();
+ }
+
+ private void flushOutput() throws IOException {
+ if (decoderOut.position() > 0) {
+ writer.write(decoderOut.array(), 0, decoderOut.position());
+ decoderOut.rewind();
+ }
+ }
+}
Modified:
webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailTestEnvironment.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailTestEnvironment.java?rev=703607&r1=703606&r2=703607&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailTestEnvironment.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailTestEnvironment.java
Fri Oct 10 16:40:16 2008
@@ -74,6 +74,7 @@
public TransportOutDescription createTransportOutDescription() throws
Exception {
TransportOutDescription trpOutDesc = new
TransportOutDescription(MailConstants.TRANSPORT_NAME);
trpOutDesc.setSender(new MailTransportSender());
+ trpOutDesc.addParameter(new
Parameter(MailConstants.TRANSPORT_MAIL_DEBUG, "true"));
for (Map.Entry<String,String> prop : getOutProperties().entrySet()) {
trpOutDesc.addParameter(new Parameter(prop.getKey(),
prop.getValue()));
}
@@ -81,6 +82,7 @@
}
public void setupPoll(ParameterInclude params, Account account) throws
AxisFault {
+ params.addParameter(new Parameter(MailConstants.TRANSPORT_MAIL_DEBUG,
"true"));
params.addParameter(new Parameter("transport.mail.Protocol",
getProtocol()));
params.addParameter(new Parameter("transport.mail.Address",
account.getAddress()));
params.addParameter(new Parameter("transport.PollInterval", "50ms"));