Xbase++ Requires Chilkat v11.0.0+
Xbase++
Example: Email.GetDsnInfo method
See more Email Object Examples
Demonstrates how to call the GetDsnInfo method.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oEmail
LOCAL oJson
LOCAL cStrVal
LOCAL cReporting_mta
LOCAL cAction
LOCAL cStatus
LOCAL cRemote_mta
LOCAL cX_supplementary_info
LOCAL cX_display_name
LOCAL i
LOCAL nCount
nSuccess := 0
oEmail := CreateObject("Chilkat.Email")
nSuccess := oEmail:LoadEml("qa_data/eml/sample_multipart_report.eml")
IF (nSuccess == 0)
? oEmail:LastErrorText
oEmail:destroy()
RETURN
ENDIF
oJson := CreateObject("Chilkat.JsonObject")
nSuccess := oEmail:GetDsnInfo(oJson)
IF (nSuccess == 0)
? oEmail:LastErrorText
oEmail:destroy()
oJson:destroy()
RETURN
ENDIF
oJson:EmitCompact := 0
? oJson:Emit()
// Sample output:
// {
// "reporting-mta": "dns; Exchange2016.example.com",
// "final-recipient": [
// "herb.butterworth1247692846@gmail.com"
// ],
// "action": "failed",
// "status": "5.1.1",
// "remote-mta": "dns; mx.google.com",
// "x-supplementary-info": "<mx.google.com #5.1.1 smtp;550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 https://support.google.com/mail/?p=NoSuchUser o8-20020a056870968800b001b55816bea9si2188132oaq.70 - gsmtp>",
// "x-display-name": "herb.butterworth1247692846@gmail.com"
// }
// Code for parsing the JSON:
cReporting_mta := oJson:StringOf("reporting-mta")
cAction := oJson:StringOf("action")
cStatus := oJson:StringOf("status")
cRemote_mta := oJson:StringOf("remote-mta")
cX_supplementary_info := oJson:StringOf("x-supplementary-info")
cX_display_name := oJson:StringOf("x-display-name")
i := 0
nCount := oJson:SizeOfArray("final-recipient")
DO WHILE i < nCount
oJson:I := i
cStrVal := oJson:StringOf("final-recipient[i]")
i := i + 1
ENDDO
oEmail:destroy()
oJson:destroy()