DISP_E_MEMBERNOTFOUND
Here is the code. It is essentially the same as what others say works for them:
- Code: Select all Expand view
Function CDOSendMail( aTabMail )
Local oEmailCfg,oEmailMsg
TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := TRIM( aTabMail[01] ) //"mail.xxxxxxxx.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := aTabMail[11] // 25
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2 // Remote SMTP = 2, local = 1
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := aTabMail[08] // .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := TRIM( aTabMail[09] ) // "xxanser@xxxxxxxx.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := TRIM( aTabMail[10] ) // "xxxxxx"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 30
:Update()
END WITH
CATCH oError
MsgInfo( "Could not create message configuration" + ";" + ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + ;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + ;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" + ;
"Message: " + oError:Description )
Return .F.
END
oError:=NIL
TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration = oEmailCfg
:From = aTabMail[02] //chr(34)+" Anser K.K. "+chr(34)+ "<anser@xxxxxxxx.com>" // This will be displayed in the From (The email id does not appear)
:To = TRIM( aTabMail[03] ) // "xxanserkk@xxxxx.com" // <----- Place the TO email address
:Subject = aTabMail[04] // "This is a Tst message"
//:ReplyTo = aTabMail[02] //"xxanser@xxxxxxxxx.com"
//:Sender = aTabMail[02] //"xxanser@xxxxxxxxx.com" // Read Receipt message is send to this
//:Organization = TRIM( aTabMail[02] ) // "My xxxxxx Company" // "My Company Name"
:MDNRequested = .T.
:HTMLBody = "<HTML> " + TRIM( aTabMail[05] ) + " </HTML>"
IF LEN( aTabMail[06] ) > 0
For nEle := 1 To Len( aTabMail[06] )
:AddAttachment( ALLTRIM(aTabMail[06][nEle] )) // := AllTrim( aAttach[ nEle ] )
Next
ENDIF
:Send()
END WITH
SysRefresh()
CATCH oError
MsgInfo( "Could not send message" + ";" + CRLF+ ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + CRLF+;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + CRLF+ ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + CRLF +;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" +CRLF+ ;
"Message: " + oError:Description )
Return .F.
END
Return( .t. )
Please note, UseSSL is true, and authentication is being passed as true.
For anyone using CDO who has had success with this, please review and let me know what might be causing the error.