-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: send no-reply email to user on unresolvable functional errors
- Loading branch information
1 parent
380d3a5
commit 0e76805
Showing
6 changed files
with
177 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> | ||
<xsl:output method="xml" indent="yes" cdata-section-elements="message" /> | ||
<xsl:param name="fromAddress"/> | ||
<xsl:param name="fromName"/> | ||
<xsl:param name="messageType" select="'text/plain'" /> | ||
<xsl:param name="message"/> | ||
<xsl:param name="mailaddresses"/> | ||
<xsl:param name="subject" /> | ||
<xsl:variable name="to" select="tokenize($mailaddresses,',')[1]"/> | ||
<xsl:variable name="cc" select="substring-after($mailaddresses,',')"/> | ||
|
||
<xsl:template match="/"> | ||
<email> | ||
<recipients> | ||
<recipient type="to"><xsl:value-of select="$to"/></recipient> | ||
<xsl:for-each select="tokenize($cc,',')"> | ||
<recipient type="cc"><xsl:value-of select="."/></recipient> | ||
</xsl:for-each> | ||
</recipients> | ||
<from><xsl:value-of select="$fromName"/><<xsl:value-of select="$fromAddress"/>></from> | ||
<subject><xsl:value-of select="$subject"/> | ||
</subject> | ||
<messageType><xsl:value-of select="$messageType"/></messageType> | ||
<!-- | ||
CDATA will be added by cdata-section-elements="message" attribute | ||
on xsl:output. This will prevent the MailSender from removing | ||
whitespace at the beginning of the message. | ||
--> | ||
<message> | ||
<!-- | ||
http://support.xink.io/support/solutions/articles/1000064098-why-is-outlook-stripping-line-breaks-from-plain-text-emails | ||
https://stackoverflow.com/questions/247546/outlook-autocleaning-my-line-breaks-and-screwing-up-my-email-format | ||
https://www.masternewmedia.org/newsletter_publishing/newsletter_formatting/remove_line_breaks_issue_Microsoft_Outlook_2003_when_publishing_text_newsletters_20051217.htm | ||
--> | ||
<xsl:call-template name="replace"> | ||
<xsl:with-param name="string" select="$message"/> | ||
<xsl:with-param name="old" select="' '"/> | ||
<xsl:with-param name="new" select="' '"/> | ||
</xsl:call-template> | ||
</message> | ||
</email> | ||
</xsl:template> | ||
|
||
<xsl:template name="replace"> | ||
<xsl:param name="string"/> | ||
<xsl:param name="old"/> | ||
<xsl:param name="new"/> | ||
<xsl:choose> | ||
<xsl:when test="contains($string, $old)"> | ||
<xsl:value-of select="concat(substring-before($string, $old), $new)"/> | ||
<xsl:call-template name="replace"> | ||
<xsl:with-param name="string" select="substring-after($string, $old)"/> | ||
<xsl:with-param name="old" select="$old"/> | ||
<xsl:with-param name="new" select="$new"/> | ||
</xsl:call-template> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$string"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/configurations/bpel/Configuration_Handler_SendNoReplyUserEmailCommand.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../FrankConfig.xsd"> | ||
<Adapter | ||
name="Handler_SendNoReplyUserEmailCommand" | ||
active="${Handler_SendNoReplyUserEmailCommand.Active}" | ||
description="" | ||
> | ||
|
||
<Receiver | ||
name="Handler_SendNoReplyUserEmailCommand" | ||
transactionAttribute="RequiresNew" | ||
pollInterval="5" | ||
maxRetries="0" | ||
> | ||
<MessageStoreListener | ||
name="Handler_SendNoReplyUserEmailCommand" | ||
slotId="${instance.name}/SendNoReplyUserEmailCommand" | ||
peekUntransacted="true" | ||
statusValueInProcess="I" | ||
sessionKeys="TemplateName" | ||
/> | ||
</Receiver> | ||
|
||
<Pipeline> | ||
<Exits> | ||
<Exit name="EXIT" state="SUCCESS" /> | ||
<Exit name="EXCEPTION" state="ERROR" /> | ||
</Exits> | ||
|
||
<FixedResultPipe | ||
name="SubstituteMailTemplateVariables" | ||
filename="${openforms2bpel.noreply-smtp.mail-templates-file}" | ||
substituteVars="true" | ||
> | ||
<Param name="vars.signature-from-name" value="${openforms2bpel.noreply-smtp.signature-from-name}" /> | ||
</FixedResultPipe> | ||
|
||
<XsltPipe | ||
name="SelectMailTemplateByTemplateName" | ||
xpathExpression="//mailTemplates[ name = $TemplateName ]" | ||
outputType="XML" | ||
> | ||
<Param name="TemplateName" sessionKey="TemplateName" /> | ||
</XsltPipe> | ||
|
||
<XmlWellFormedCheckerPipe | ||
name="TemplateNotFound_Condition" | ||
> | ||
<Forward name="success" path="CreateMailMessage" /> | ||
<Forward name="exception" path="TemplateNotFound_Exception" /> | ||
</XmlWellFormedCheckerPipe> | ||
|
||
<ExceptionPipe name="TemplateNotFound_Exception" /> | ||
|
||
<XsltPipe | ||
name="CreateMailMessage" | ||
styleSheetName="Common/xsl/CreateMail.xslt" | ||
storeResultInSessionKey="MailMessage" | ||
> | ||
<Param name="subject" xpathExpression="/mailTemplates/subject" /> | ||
<Param name="fromName" value="${openforms2bpel.noreply-smtp.default-from-name}" /> | ||
<Param name="fromAddress" value="${openforms2bpel.noreply-smtp.default-from-address}" /> | ||
<Param name="mailaddresses" sessionKey="originalMessage" xpathExpression="//*[starts-with(name(), 'contactgegevens')]/*[starts-with(name(), 'eMailadres')]" /> | ||
<Param name="messageType" xpathExpression="/mailTemplates/messageType" /> | ||
<Param name="message" xpathExpression="/mailTemplates/message" /> | ||
</XsltPipe> | ||
|
||
<SenderPipe | ||
name="NoReplySender" | ||
> | ||
<MailSender | ||
name="NoReplyMailSender" | ||
authAlias="${openforms2bpel.noreply-smtp.auth-alias}" | ||
smtpHost="${openforms2bpel.noreply-smtp.host}" | ||
smtpPort="${openforms2bpel.noreply-smtp.port}" | ||
useSsl="${openforms2bpel.noreply-smtp.use-ssl}" | ||
timeout="${openforms2bpel.noreply-smtp.timeout}" | ||
> | ||
</MailSender> | ||
</SenderPipe> | ||
</Pipeline> | ||
</Adapter> | ||
</Module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<root> | ||
<mailTemplates> | ||
<name>unable-to-add-document-to-case-default</name> | ||
<subject>Document toevoegen aan zaak niet gelukt</subject> | ||
<messageType>text/html</messageType> | ||
<message> | ||
<![CDATA[ | ||
Beste, | ||
U heeft onlangs geprobeerd om één of meerdere documenten toe te voegen aan een aanvraag die u eerder bij ons heeft gedaan. Dit is helaas niet gelukt. | ||
Reden is dat het zaaknummer waaraan u document(en) toe wilde voegen [OF-Nummer] niet klopt. Het juiste zaaknummer vindt u in de bevestigingsmail van de originele aanvraag. | ||
Wij vragen u de aanvraag opnieuw toe te sturen en daarin het juiste zaaknummer in te vullen. | ||
Met vriendelijke groet, | ||
${vars.signature-from-name} | ||
]]> | ||
</message> | ||
</mailTemplates> | ||
</root> |