Index: plugins/email-ext/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
===================================================================
--- plugins/email-ext/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java (revision 9668)
+++ plugins/email-ext/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java (working copy)
@@ -411,11 +411,17 @@
private String smtpHost;
/**
- * If true use SSL on port 465 (standard SMTPS).
+ * If true use SSL on port 465 (standard SMTPS) unless smtpPort
is set.
*/
private boolean useSsl;
/**
+ * The SMTP port to use for sending e-mail. Null for default to the environment,
+ * which is usually 25.
+ */
+ private String smtpPort;
+
+ /**
* This is a global default subject line for sending emails.
*/
private String defaultSubject;
@@ -445,6 +451,9 @@
Properties props = new Properties(System.getProperties());
if(smtpHost!=null)
props.put("mail.smtp.host",smtpHost);
+ if (smtpPort!=null) {
+ props.put("mail.smtp.port", smtpPort);
+ }
if (useSsl) {
/* This allows the user to override settings by setting system properties but
* also allows us to use the default SMTPs port of 465 if no port is already set.
@@ -454,8 +463,9 @@
*/
props.put("mail.smtp.auth","true");
if (props.getProperty("mail.smtp.socketFactory.port") == null) {
- props.put("mail.smtp.port", "465");
- props.put("mail.smtp.socketFactory.port", "465");
+ String port = smtpPort==null?"465":smtpPort;
+ props.put("mail.smtp.port", port);
+ props.put("mail.smtp.socketFactory.port", port);
}
if (props.getProperty("mail.smtp.socketFactory.class") == null) {
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
@@ -495,6 +505,10 @@
return useSsl;
}
+ public String getSmtpPort() {
+ return smtpPort;
+ }
+
public String getDefaultBody() {
return defaultBody;
}
@@ -578,6 +592,9 @@
//specify if the mail server uses ssl for authentication
useSsl = req.getParameter("ext_mailer_smtp_use_ssl")!=null;
+ //specify custom smtp port
+ smtpPort = nullify(req.getParameter("ext_mailer_smtp_port"));
+
//Allow global defaults to be set for the subject and body of the email
defaultSubject = nullify(req.getParameter("ext_mailer_default_subject"));
defaultBody = nullify(req.getParameter("ext_mailer_default_body"));
Index: plugins/email-ext/src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/global.jelly
===================================================================
--- plugins/email-ext/src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/global.jelly (revision 9668)
+++ plugins/email-ext/src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/global.jelly (working copy)
@@ -36,6 +36,11 @@
help="/help/tasks/mailer/smtp-use-ssl.html">