You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2015/06/08 19:22:15 UTC

svn commit: r1684228 - in /jmeter/trunk: src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java xdocs/changes.xml

Author: fschumacher
Date: Mon Jun  8 17:22:15 2015
New Revision: 1684228

URL: http://svn.apache.org/r1684228
Log:
Bug 58013 - Enable all protocols that are enabled on the default SSLContext for usage with the SMTP Sampler.

Bugzilla Id: 58013

Modified:
    jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java?rev=1684228&r1=1684227&r2=1684228&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java (original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java Mon Jun  8 17:22:15 2015
@@ -39,8 +39,10 @@ import javax.mail.internet.InternetAddre
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
+import javax.net.ssl.SSLContext;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.services.FileServer;
 import org.apache.jmeter.testelement.property.CollectionProperty;
@@ -137,6 +139,17 @@ public class SendMailCommand {
         props.setProperty("mail." + protocol + ".timeout", getTimeout());
         props.setProperty("mail." + protocol + ".connectiontimeout", getConnectionTimeout());
 
+        if (useStartTLS || useSSL) {
+            try {
+                String allProtocols = StringUtils.join(
+                    SSLContext.getDefault().getSupportedSSLParameters().getProtocols(), " ");
+                logger.info("Use ssl/tls protocols for mail: " + allProtocols);
+                props.setProperty("mail.smtp.ssl.protocols", allProtocols);
+            } catch (Exception e) {
+                logger.error("Problem setting ssl/tls protocols for mail", e);
+            }
+        }
+
         if (enableDebug) {
             props.setProperty("mail.debug","true");
         }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1684228&r1=1684227&r2=1684228&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Mon Jun  8 17:22:15 2015
@@ -132,6 +132,7 @@ Summary
 
 <h3>Other Samplers</h3>
 <ul>
+    <li><bug>58013</bug>Enable all protocols that are enabled on the default SSLContext for usage with the SMTP Sampler.</li>
 </ul>
 
 <h3>Controllers</h3>