Skip to content

Commit a1deb94

Browse files
committed
Added SSL Identity check configuration option
1 parent f93e518 commit a1deb94

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

45 KB
Binary file not shown.

src/EmailModuleWithTemplates/javasource/emailtemplate/actions/SendEmail.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ public class SendEmail extends CustomJavaAction<java.lang.Boolean>
4343
private java.lang.Boolean UseSSL;
4444
private java.lang.Boolean UseTLS;
4545
private java.lang.String FromDisplayName;
46+
private java.lang.Boolean UseSSLCheckIdentity;
4647

47-
public SendEmail(IContext context, java.lang.String SMTPHost, java.lang.String SMTPUserName, java.lang.String SMTPPassword, java.lang.String CCAddresses, java.lang.String BCCAddresses, java.lang.String ToAddresses, java.lang.String FromAddress, java.lang.String ReplyToAddress, java.lang.String HtmlBody, java.lang.String PlainBody, java.lang.String Subject, java.lang.Long SMTPPort, java.util.List<IMendixObject> AttachmentList, java.util.List<IMendixObject> HeaderList, java.lang.Boolean UseSSL, java.lang.Boolean UseTLS, java.lang.String FromDisplayName)
48+
public SendEmail(IContext context, java.lang.String SMTPHost, java.lang.String SMTPUserName, java.lang.String SMTPPassword, java.lang.String CCAddresses, java.lang.String BCCAddresses, java.lang.String ToAddresses, java.lang.String FromAddress, java.lang.String ReplyToAddress, java.lang.String HtmlBody, java.lang.String PlainBody, java.lang.String Subject, java.lang.Long SMTPPort, java.util.List<IMendixObject> AttachmentList, java.util.List<IMendixObject> HeaderList, java.lang.Boolean UseSSL, java.lang.Boolean UseTLS, java.lang.String FromDisplayName, java.lang.Boolean UseSSLCheckIdentity)
4849
{
4950
super(context);
5051
this.SMTPHost = SMTPHost;
@@ -64,6 +65,7 @@ public SendEmail(IContext context, java.lang.String SMTPHost, java.lang.String S
6465
this.UseSSL = UseSSL;
6566
this.UseTLS = UseTLS;
6667
this.FromDisplayName = FromDisplayName;
68+
this.UseSSLCheckIdentity = UseSSLCheckIdentity;
6769
}
6870

6971
@java.lang.Override
@@ -110,6 +112,7 @@ public java.lang.Boolean executeAction() throws Exception
110112
config.setUserPass((this.SMTPPassword != null ? this.SMTPPassword : ""));
111113
config.setUseSSLSMTP(this.UseSSL);
112114
config.setUseTLSSMTP(this.UseTLS);
115+
config.setUseSSLCheckServerIdentity(this.UseSSLCheckIdentity);
113116

114117
String separator = (String) emailtemplate.proxies.constants.Constants.getEmailAddressSeparator();
115118
if (separator == null)

src/EmailModuleWithTemplates/javasource/emailtemplate/mail/SMTPConfiguration.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class SMTPConfiguration
99
private String userPass;
1010

1111
private boolean useSSLSMTP;
12+
private boolean useSSLCheckServerIdentity;
1213
private boolean useTLSSMTP;
1314

1415
private String fromAddress;
@@ -20,6 +21,7 @@ public SMTPConfiguration()
2021
// Basic configuration
2122
this.useSSLSMTP = false;
2223
this.useTLSSMTP = false;
24+
this.useSSLCheckServerIdentity = false;
2325
this.SMTPPort = 25;
2426
this.SMTPHost = "";
2527
this.userName = "";
@@ -119,5 +121,15 @@ public void setReplyToAddress(String replyToAddress)
119121
this.replyToAddress = replyToAddress;
120122
}
121123

124+
public boolean useSSLCheckServerIdentity()
125+
{
126+
return this.useSSLCheckServerIdentity;
127+
}
128+
129+
public void setUseSSLCheckServerIdentity(boolean useSSLCheckServerIdentity)
130+
{
131+
this.useSSLCheckServerIdentity = useSSLCheckServerIdentity;
132+
}
133+
122134

123135
}

src/EmailModuleWithTemplates/javasource/emailtemplate/mail/Sender.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ private void setConnectionInfo(Email mail, SMTPConfiguration configuration)
238238
mail.setStartTLSEnabled(true);
239239
}
240240

241+
mail.setSSLCheckServerIdentity(configuration.useSSLCheckServerIdentity());
242+
241243
/* because the default session mechanisms uses System.getProperties() (which is not allowed
242244
* in the cloud), we need to construct a session ourselves. The code to do this was lifted
243245
* from Email.java in the commons-email package.

0 commit comments

Comments
 (0)