Send email via cdo

Topics: User Forum
Feb 5, 2012 at 2:15 PM
Edited Feb 5, 2012 at 2:34 PM

Hi

This works fine upto the point where I want to send the confirmation email. I get the following error:-

Caught .NET exception, source: 0000a1bd001u err#= 1426 line= 304 OLE error code 0x80020006: Unknown name.1426 OLE error code 0x80020006: Unknown name. 80020006: Unknown name .NULL. .NULL. .NULL. .NULL. D:\iwebs\activevfp5\ActiveVFP_5.0_\AVFP5\activevfp.dll message: D:\iwebs\activevfp5\ActiveVFP_5.0_\AVFP5\activevfp.dll

can you say what I'm doing wrong. (I,m using win 7 ultimate)

Here is the code

CASE oProp.Action=='bptaWorkerUpd'
    LOCAL lcHTMLfile,lcHTMLout  &&,lcMembID   
        *lcHTMLout=  bptaUpdate()   
    IF .NOT. USED('workers')
        USE ('workers') IN 0 SHARED
    ENDIF

    SELECT workers 

    l_lname=oRequest.FORM("lname")
    l_fname=oRequest.FORM("fname")
    l_email=oRequest.FORM("email")
    l_title=oRequest.FORM("salu")
    l_parish=oRequest.FORM("fld_parish")
*********************
    l_area=oRequest.FORM("area")
    l_town=oRequest.FORM("town")
    l_tel1=oRequest.FORM("tel1")
    l_urChurch=oRequest.FORM("urChurch")
    l_Pastor=oRequest.FORM("pastor")

*********************   

    INSERT INTO workers (salu,lname,fname,email,parish,town,tel1,church,pastor,area) VALUES ;
    (l_title,l_lname,l_fname,l_email,l_parish,l_town,l_tel1,l_urChurch,l_pastor,l_area)

*!*    *loCfg = CREATEOBJECT("CDO.Configuration")
    oCfig= CREATEOBJECT("CDO.Configuration")
    WITH oCfig.FIELDS
      .ITEM("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
      .ITEM("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
      .ITEM("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .ITEM("http://schemas.microsoft.com/cdo/configuration/sendusername") = "cpuja1@gmail.com"
      .ITEM("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "larcoj123"
      .ITEM("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = .T.
      .ITEM("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = .T.
      .UPDATE
    ENDWITH

*!*    *loMsg = CREATEOBJECT ("CDO.Message")
    oSMTP = CREATEOBJECT ("CDO.Message")

 *   oSMTP.cSMTPServer= 'relay-hosting.secureserver.net' &&GoDaddy  'smtp.east.cox.net'  && enter your smtp server name or ip
    oSMTP.cSMTPServer= 'smtpout.secureserver.net' &&GoDaddy  'smtp.east.cox.net'  && enter your smtp server name or ip
    oSMTP.cSenderName = ALLTRIM(l_fname)+" "+ALLTRIM(l_lname)
    oSMTP.cRecipient= ALLTRIM(l_email)
    oSMTP.cBCCList = "cpu_ja@yahoo.com"
    oSMTP.cSubject = "Confirmation- To work with UPCJ"
    oSMTP.cMessage = "You have signed up to work in the"+" "+ALLTRIM(l_area)
    lcSuccess=oSMTP.CDOsend()
    lchtmlfile = 'bp_worker.html'
    lcHTMLout= FILETOSTR(oProp.HTMLpath+lchtmlfile)
    lcHTMLout= oHTML.mergetext(lcHTMLout)   

Coordinator
Feb 5, 2012 at 4:13 PM
Edited Feb 5, 2012 at 4:13 PM

I suggest taking some of the lines out, trying to send, and then gradually adding more until you find the prob.   IOW start simple and make sure a simple e-mail works and then add more

Feb 6, 2014 at 4:26 PM
Hi! I'm wrote here for don't open a new thread. I've the same problem with sending email. I've tried the code of demo example but i'm not on Godaddy server and my smtp server require an authentication. I've tried a my standard CDO2000 class (used on my desktop program) and all seems to be ok but no e-mail is sent.

There is a possibility to insert user and password to your CDOSYS method? Or alternatively, can you have a tested CDO code?

Bye
Coordinator
Feb 6, 2014 at 4:45 PM
This one has an example with User and Password:
http://support.microsoft.com/kb/555287

The original post, now that I looked at it again, looks like it was still using the Cox SMTP server and that was probably the problem