Skip to content

Commit

Permalink
[BACKLOG-39726] - Provide ability to use only comma or semi colon sen…
Browse files Browse the repository at this point in the history
…ding emails
  • Loading branch information
rmansoor committed Jan 24, 2024
1 parent 7d098a3 commit bbd3a2d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
16 changes: 8 additions & 8 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
<parent>
<groupId>pentaho</groupId>
<artifactId>pentaho-platform-ce-parent</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
<version>10.1.0.0-211</version>
</parent>
<groupId>pentaho</groupId>
<artifactId>pentaho-platform-core</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
<version>10.1.0.0-211</version>
<properties>
<maven-surefire-plugin.reuseForks>false</maven-surefire-plugin.reuseForks>
<powermock.version>1.6.3</powermock.version>
<jcommon.version>1.0.14</jcommon.version>
<license.header.definition.file>${basedir}/../license/styles/javadoc_style_license_header.xml</license.header.definition.file>
<license.header.file>${basedir}/../license/templates/GPL-2.0.txt</license.header.file>
<commons-xul.version>10.1.0.0-SNAPSHOT</commons-xul.version>
<pentaho-connections.version>10.1.0.0-SNAPSHOT</pentaho-connections.version>
<pentaho-actionsequence-dom.version>10.1.0.0-SNAPSHOT</pentaho-actionsequence-dom.version>
<pentaho-metadata.version>10.1.0.0-SNAPSHOT</pentaho-metadata.version>
<pentaho-versionchecker.version>10.1.0.0-SNAPSHOT</pentaho-versionchecker.version>
<pdi.version>10.1.0.0-SNAPSHOT</pdi.version>
<commons-xul.version>10.1.0.0-211</commons-xul.version>
<pentaho-connections.version>10.1.0.0-211</pentaho-connections.version>
<pentaho-actionsequence-dom.version>10.1.0.0-211</pentaho-actionsequence-dom.version>
<pentaho-metadata.version>10.1.0.0-211</pentaho-metadata.version>
<pentaho-versionchecker.version>10.1.0.0-211</pentaho-versionchecker.version>
<pdi.version>10.1.0.0-211</pdi.version>
</properties>
<dependencies>
<dependency>
Expand Down
32 changes: 18 additions & 14 deletions core/src/main/java/org/pentaho/platform/util/ActionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,22 +454,26 @@ public static void sendEmail( Map<String, Object> actionParams, Map<String, Seri
if ( emailGroupResolver == null ) {
emailGroupResolver = new DefaultEmailGroupResolver();
}

emailer.setTo( emailGroupResolver.resolve(to) );
emailer.setCc( emailGroupResolver.resolve(cc) );
emailer.setBcc( emailGroupResolver.resolve(bcc) );

String subject = (String) actionParams.get( "_SCH_EMAIL_SUBJECT" );
if ( subject != null && !"".equals( subject ) ) {
emailer.setSubject( subject );
String resolveToList = emailGroupResolver.resolve(to);
if (resolveToList != null && resolveToList.length() > 0) {
emailer.setTo( emailGroupResolver.resolve( to ) );
emailer.setCc( emailGroupResolver.resolve( cc ) );
emailer.setBcc( emailGroupResolver.resolve( bcc ) );

String subject = ( String ) actionParams.get( "_SCH_EMAIL_SUBJECT" );
if (subject != null && !"".equals( subject ) ) {
emailer.setSubject( subject );
} else {
emailer.setSubject( "Pentaho Scheduler" + ( emailer.getAttachmentName() != null ? " : " + emailer.getAttachmentName() : "" ) );
}
String message = (String) actionParams.get( "_SCH_EMAIL_MESSAGE" );
if ( subject != null && !"".equals( subject ) ) {
emailer.setBody( message );
}
emailer.send();
} else {
emailer.setSubject( "Pentaho Scheduler" + ( emailer.getAttachmentName() != null ? " : " + emailer.getAttachmentName() : "" ) );
}
String message = (String) actionParams.get( "_SCH_EMAIL_MESSAGE" );
if ( subject != null && !"".equals( subject ) ) {
emailer.setBody( message );
logger.error( Messages.getInstance().getErrorString( "ActionUtil.ERROR_0001_INVALID_EMAIL_LIST" ) );
}
emailer.send();
} catch ( Exception e ) {
logger.warn( e.getMessage(), e );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ VersionCheck.NO_RESULT_MESSAGE=Version Check Error: No Results Available
ActionUtil.ERROR_0001_REQUIRED_PARAM_MISSING=Property "{0}" or "{1}" must be set in the action data map
ActionUtil.ERROR_0002_FAILED_TO_CREATE_ACTION=Failed to create an instance of action "{0}"
ActionUtil.ERROR_0003_ACTION_WRONG_TYPE=class {0} must be an instance of "{1}"

ActionUtil.ERROR_0001_INVALID_EMAIL_LIST=Unable to send email. The list of the recipients is invalid

0 comments on commit bbd3a2d

Please sign in to comment.