Skip to content

Commit

Permalink
Merge pull request #112 from psteiwer/dev
Browse files Browse the repository at this point in the history
Optional email domain if SMTP errors without it
  • Loading branch information
psteiwer authored Jan 31, 2022
2 parents 0b95545 + b492925 commit c04b859
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion PivotSubscriptions/Task.cls
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ ClassMethod SendEmail(pID, pSendNow As %Boolean = 0, pPivot As %String, pEmails
Set server=##class(%Net.SMTP).%New()
Set server.smtpserver=##class(%SYS.Task.Config).GetData("MailServer")
Set msg=##class(%Net.MailMessage).%New()
Set msg.From="PivotSubscriptions"
Set emaildomain=##class(PivotSubscriptions.Utils).GetSettings("EmailDomain")
Set msg.From="PivotSubscriptions"_$select(emaildomain'="":"@"_emaildomain,1:"")
Do msg.To.SetAt(tEmail,1)

Set validAdminEmail=##class(PivotSubscriptions.Utils).CheckConfigurationGlobal("AdminEmail")
Expand Down
11 changes: 8 additions & 3 deletions PivotSubscriptions/UI/ConfigurationPage.cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ XData contentPane [ XMLNamespace = "http://www.intersystems.com/zen" ]
<spacer width="20" />
<vgroup cellStyle="padding:2px 0px 6px 2px" enclosingStyle="padding-left:10px;padding-top:20px;" labelPosition="left">
<text id="AdminEmailText" label="Send error email notification to" size="25" />
<text id="EmailDomain" label="Email Domain" size="25" />
<label label="Server Link Configuration" labelClass="sectionCaption" containerStyle="padding-top:5px;padding-bottom:5px;" />
<radioSet id="HTTPButton" label="HTTP or HTTPS?" displayList="HTTP, HTTPs" valueList="http://,https://" />
<text id="ServerText" label="Server" size="25" />
Expand Down Expand Up @@ -88,6 +89,9 @@ Method %OnAfterCreatePage() As %Status
If $G(^PivotSubscriptions.Settings("ErrorTypes"))'="" {
Set ..%GetComponentById("ErrorTypes").value=^PivotSubscriptions.Settings("ErrorTypes")
}
If $G(^PivotSubscriptions.Settings("EmailDomain"))'="" {
Set ..%GetComponentById("EmailDomain").value=^PivotSubscriptions.Settings("EmailDomain")
}


Quit $$$OK
Expand All @@ -106,19 +110,20 @@ ClientMethod ButtonClick() [ Language = javascript ]
var customfootermessage=zen('CustomFooterMessage').getValue();
var changesonly=zen('ChangesOnly').getValue();
var errortypes=zen('ErrorTypes').getValue();
var emaildomain=zen('EmailDomain').getValue();

var status=zenPage.SaveConfiguration(adminemail,http,server,port,nodataemail,nodatamessage,customfooter,customfootermessage,changesonly,errortypes);
var status=zenPage.SaveConfiguration(adminemail,http,server,port,nodataemail,nodatamessage,customfooter,customfootermessage,changesonly,errortypes,emaildomain);
}
catch(ex) {
zenExceptionHandler(ex,arguments);
}
}

Method SaveConfiguration(pAdminEmail, pHttp, pServer, pPort, pNoDataEmail, pNoDataMessage, pCustomFooter, pCustomFooterMessage, pChangesOnly, pErrorTypes) As %Status [ ZenMethod ]
Method SaveConfiguration(pAdminEmail, pHttp, pServer, pPort, pNoDataEmail, pNoDataMessage, pCustomFooter, pCustomFooterMessage, pChangesOnly, pErrorTypes, pEmailDomain) As %Status [ ZenMethod ]
{
Set tSC=$$$OK

Set tSC = ##class(PivotSubscriptions.Utils).ConfigureSettings(pAdminEmail, pHttp, pServer, pPort, pNoDataEmail, pNoDataMessage, pCustomFooter, pCustomFooterMessage, pChangesOnly, pErrorTypes)
Set tSC = ##class(PivotSubscriptions.Utils).ConfigureSettings(pAdminEmail, pHttp, pServer, pPort, pNoDataEmail, pNoDataMessage, pCustomFooter, pCustomFooterMessage, pChangesOnly, pErrorTypes, pEmailDomain)

Quit tSC
}
Expand Down
3 changes: 2 additions & 1 deletion PivotSubscriptions/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ClassMethod GetVersion() As %String
}

/// Utility method for saving and updating global variables
ClassMethod ConfigureSettings(pAdminEmail, pHttp, pServer, pPort, pNoDataEmail, pNoDataMessage, pCustomFooter, pCustomFooterMessage, pChangesOnly, pErrorTypes)
ClassMethod ConfigureSettings(pAdminEmail, pHttp, pServer, pPort, pNoDataEmail, pNoDataMessage, pCustomFooter, pCustomFooterMessage, pChangesOnly, pErrorTypes, pEmailDomain)
{
Set ^PivotSubscriptions.Settings("AdminEmail")=pAdminEmail
Set ^PivotSubscriptions.Settings("Http")=pHttp
Expand All @@ -19,6 +19,7 @@ ClassMethod ConfigureSettings(pAdminEmail, pHttp, pServer, pPort, pNoDataEmail,
Set ^PivotSubscriptions.Settings("CustomFooterMessage")=pCustomFooterMessage
Set ^PivotSubscriptions.Settings("ChangesOnly")=pChangesOnly
Set ^PivotSubscriptions.Settings("ErrorTypes")=pErrorTypes
Set ^PivotSubscriptions.Settings("EmailDomain")=pEmailDomain

Quit $$$OK
}
Expand Down

0 comments on commit c04b859

Please sign in to comment.