Rechercher

Question
· Nov 4, 2024

Operation Email sender error #6034 connection with SMTP not successfull

I am developing a business operation that receives a request, creates a message with the data contained in it and sends it to an outlook email. For testing purposes both the sender and the destination are the same email account
This is the code:
Class BO.AlertEmailSender Extends Ens.BusinessOperation{

Parameter ADAPTER = "EnsLib.EMail.OutboundAdapter";
Property Adapter As EnsLib.EMail.OutboundAdapter;
Parameter INVOCATION = "Queue";
Method OnMessage(pRequest As Messages.AlertMsgToEmail, Output pResponse As Messages.AlertResponse) As %Status
{
    set sc = $$$OK
    Set msg = ##class(%Net.MailMessage).%New()
    Set msg.Subject=pRequest.mailObject
    set msg.From = pRequest.sender
    Do msg.To.Insert(pRequest.destination)
    Set msg.IsBinary=0
    Set msg.IsHTML=0
    set sc = msg.TextData.Write(pRequest.txtMessage)
    if $$$ISERR(sc) {    
        set ErrorText = "error: 'Write message stream error',"_$CHAR(10)_"details: '"_$SYSTEM.Status.DisplayError(sc)_"'"
        set ErrorCode = "WRT001"
        $$$LOGINFO(ErrorText)
    }
    Set smtp=##class(%Net.SMTP).%New()
    Set smtp.smtpserver="smtp-mail.outlook.com"
    Set smtp.port="587"
    //Set smtp.secure="STARTTLS"
    Set smtp.timezone="LOCAL"
    set smtp.SSLConfiguration = "smpt.office365.com"
    set smtp.UseSTARTTLS = 0
    Set auth=##class(%Net.Authenticator).%New()
    Set auth.UserName=pRequest.sender
    Set auth.Password="password"
    Set smtp.authenticator=auth
    Set smtp.AuthFrom=pRequest.sender
    //set auth.MechanismList = "PLAIN,LOGIN"
    Set sc=smtp.Send(msg)
    If $$$ISERR(sc) {
    Do $System.Status.DisplayError(sc)
    $$$LOGINFO(smtp.Error)
    Quit ""
  }
    // send email  
    //set sc = ..Adapter.SendMail(msg)
    // check for errors
    if sc {
        set report = "Email sent"
    } else {
        set report = "Email NOT sent"
        do $System.Status.DisplayError(sc)
        $$$LOGINFO("Send Failed: "_$System.Status.DisplayError(sc))
    }
    $$$LOGINFO("STATUS SEND: "_sc)
    set pResponse = ##class(Messages.AlertResponse).%New()
    set pResponse.msgStatus = report
    set pResponse.mailStatus = 1
    quit sc
}
}

In the InterSystems production portal I have set the operation, activated it and configured the base settings and connection settings as this
Server SMTP = smpt.office365.com
Port SMTP = 587
Credentials = credentials
Config SSL = smpt.office365

In the past I had obtained these errors: (translated from Italian)
-when I had wrongly defined smtpserver="smpt.office365.com" I obtained error #6031 "impossible to open connection TCP/IP"
- when SSLConfiguration was not present I obtained error #6034 "connection with server SMTP not successfull during command MAIL FROM:<READ>zSend+122^%Net.SMTP.1"
I do not receive anymore these errors after the corrections present in the code above, but I obtain error #6034
Connection with SMTP server not successfull during command init: <READ>zGetResponse+5^%Net.SMTP.1.
How do I proceed?

7 Comments
Discussion (7)4
Connectez-vous ou inscrivez-vous pour continuer
Article
· Nov 4, 2024 2m de lecture

Debugging an <ILLEGAL VALUE> error from $zf(-100) that only happens on Linux

Summary: if you concatenate filenames into /STDOUT and /STDERR in a $zf(-100) call, quote them.

I hit an <ILLEGAL VALUE> error from the following that initially stumped me. This was part of a unit test that worked perfectly fine on Windows, but when CI ran on Docker it failed:

Set outFile = ##class(%Library.File).TempFilename()
Set outDir = ##class(%Library.File).NormalizeDirectory(##class(%Library.File).TempFilename()_"dir-out")
Do ##class(%Library.File).CreateDirectoryChain(outDir)
Do $$$AssertEquals($zf(-100,"/STDOUT="_outFile_"/STDERR="_outFile,"tar","-xvf",tempDir_".tgz","-C",outDir)

The problem, which feels painfully obvious once you know the answer, is that on Linux outFile contains slashes, so they're interpreted as keyword flags for $zf(-100) and of course aren't valid. The <ILLEGAL VALUE> is actually helpful here, and the solution is to quote the filenames:

Set outFile = ##class(%Library.File).TempFilename()
Set outDir = ##class(%Library.File).NormalizeDirectory(##class(%Library.File).TempFilename()_"dir-out")
Do ##class(%Library.File).CreateDirectoryChain(outDir)
Do $$$AssertEquals($zf(-100,"/STDOUT="""_outFile_"""/STDERR="""_outFile_"""","tar","-xvf",tempDir_".tgz","-C",outDir)

I'm mostly posting this so that if someone asks the Developer Community AI "Why am I getting an <ILLEGAL VALUE> error from $zf(-100)" this will come up. The initial answer here was actually very helpful, it just didn't cover my specific mistake.

2 Comments
Discussion (2)1
Connectez-vous ou inscrivez-vous pour continuer
Question
· Nov 4, 2024

[DICOM] Help Needed: Seeking Tips to Automate Presentation Contexts Export from Development to Production

Hello,
Please, we would need your help 🙂:

In a development environment, we have added quite a few presentation contexts to the DICOM configurations (the associations). We would need to find a way to export them from this environment to make it easier for us to import them in PRO (and avoid doing it by hand one by one).

 

We know that there is this method, the ImportAssociation(), that given a file, and the names of the local AET and the remote AET, creates it automatically:
    https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.UI...

 

We have already used this method to deploy in the test environments the theme of the associations, executing in the Terminal, like this for example:

    Do ##class(EnsLib.DICOM.Util.AssociationContext).ImportAssociation(“/opt/container/Mape_Syntax_Ensemble_LF.txt”, “[Local AET]”, “[Remote AET]”,0).

However, the file we have created by hand is very basic, it has very few associations, i.e. its content is something like this:

    1.2.840.10008.5.1.4.1.1.4\1.2.840.10008.1.2
    1.2.840.10008.5.1.4.1.1.1.3\1.2.840.10008.1.2
    1.2.840.10008.5.1.4.1.1.1.3\1.2.840.10008.1.2.1
    1.2.840.10008.5.1.4.1.1.1.3\1.2.840.10008.1.2.2
    1.2.840.10008.5.1.4.1.1.1.3\1.2.840.10008.1.2.4.50
    1.2.840.10008.5.1.4.1.1.1.3\1.2.840.10008.1.2.4.51
    [80 more lines]

    

Our need is the following: is there any way to export the presentation contexts of a particular association from the develop environment, and then import it into other environment (Production environment)?

We ask because we need to figure out how to do this when we deploy the integration.

For example, in develop we have all of these:

Is there any way to export all those abstract syntaxes and their transfer syntaxes?

We have read here:

https://docs.intersystems.com/irisforhealthlatest/csp/documatic/%25CSP.D...

but we can't find a way.


Another possible solution that you could provide us, is if there is a way to “allow that whatever abstract syntax the sender sends us in the DICOM file, the HealthShare interoperability engine allows and sends it”. That is, we need that the ESB does not make it impossible for the DICOMs to reach their destination, whatever abstract syntax the DICOM has.

Could you help us?

Thank you for your time, help and replies. Thanks. 🙂🙂🙂

Best regards

2 Comments
Discussion (2)2
Connectez-vous ou inscrivez-vous pour continuer
Résumé
· Nov 4, 2024

InterSystems Developers Publications, Week October 28 - November 03, 2024, Digest

Articles
Announcements
#Global Summit
#Developer Community Official
#Open Exchange
Questions
#InterSystems IRIS
#Ensemble
#Caché
#InterSystems IRIS for Health
#InterSystems IRIS BI (DeepSee)
Discussions
#InterSystems IRIS
October 28 - November 03, 2024Week at a GlanceInterSystems Developer Community