CDO Once Again ...

CDO Once Again ...

Postby TimStone » Tue Apr 02, 2013 5:21 pm

I realize there are numerous threads on this but none of them has an answer to my specific question.

First, here is the code I am using:

Code: Select all  Expand view

Function CDOSendMail( aTabMail )
    Local oEmailCfg,oEmailMsg

/* Tabmail
01 = MAILSERVER  // A correct mail server address
02 = MAILFROM  // A valid originator of the message
03 = MAILTO  // Who it is being sent to
04 = SUBJECT  // The subect
05 = BODY  // The body in text format
06 = ATTACHMENT  // Attachment(s)
07 = BCC  // Usually NIL  NOT USED
08 = LAUTHORIZATION  // T or F logical for authentication
09 = USERID pour MAILSERVER  // The mail server Username
10 = PW     pour MAILSERVER  // The mail server password
11 = Mail port   defaut = 25  // The port, default is 25, set to 465 for SSL
12 = Mail HTML page  // An HTML page, usually not used
13 = ssl authentification  // T or F logical for SSL
14 = Mail sender  // Mail sender name  NOT USED
15 = Organisation sender  // Organization sender  NOT USED
16 = Host  // Host if needed  NOT USED
*/

    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 :=  aTabMail[13]
         :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"
        :MDNRequested = .T.
        :TextBody =  TRIM( aTabMail[05] )
        IF LEN( aTabMail[06] ) > 0
            For nEle := 1 To Len( aTabMail[06] )
             :AddAttachment( ALLTRIM(aTabMail[06][nEle] )) // := AllTrim( aAttach[ nEle ] )
            Next
        ENDIF
     END WITH
     oEmailMsg:Send( )
    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. )

 


On my computer this works. However, on a client's computer ( and other client's also ), I get the following response to the send() action:

Could not send message
Error 1001
SubC 3
OSCode 0
SubSystem CDO_Message;
Message DISP_E_MEMBERNOTFOUND

I've run out of ideas on what might be causing the problem on some computers. Of course my clients think its something that I should fix in 2 minutes ! By the number of posts I've shown on this problem, its obvious I've spent a lot of time.

Also of note. I am using Windows 8 and it works. The machine I tested on this morning at a client's office is the same computer ( Samsung All In One, same model ) also with Windows 8.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: CDO Once Again ...

Postby James Bott » Tue Apr 02, 2013 9:19 pm

Tim,

I am guessing you are trying to send via gmail?

Can we see all the parameters in aTabMail (except for the username and password, of course)?

Were you using the exact same EXE on the client's computer that was running on yours? If so, I am guessing it is the configuration of the client's PC having to do with cdosys.dll. You could try this:

"To resolve the issue simply open a 32-bit instance of cmd.exe from the SysWow64 directory and run "regsvr32 cdosys.dll" to re-register the 32-bit CDOSYS."

The above is from here:
http://blogs.msdn.com/b/mstehle/archive ... tered.aspx

Also, it could be a problem with the paths of any attachments. Are you using attachments? If so were they also on the client's PC? I would suggest not using attachments until you get it working without attachments.

I would also suggest running the example program by Anser that I sent to your email a couple of days ago. This is a very simple program and it eliminates anything different in your code that could be causing the problem. It would be nice to just know if CDO is working on the client's PC.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: CDO Once Again ...

Postby TimStone » Tue Apr 02, 2013 9:38 pm

James,

I have spent so much time in trial and error. Surely there is some way to know what that error message means.

No, I am not using gmail. I do nothing Google. Anything that passes through a Google server, no matter what it is, is open ( according to their very public license ) to the public domain. They can use the data in any way they wish, including selling or trading it. I deal with confidential information a lot, so I have absolutely no Google connectivity in my system.

n my case, I used the settings for Cox SSL and it worked fine. So, that means the program works fine ... even with attachments.

My client has AT&T and they route through Yahoo ! Other clients with problems are in Arizona and use Qwest, and I have no idea what some others are using.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: CDO Once Again ...

Postby James Bott » Tue Apr 02, 2013 10:10 pm

Tim,

>I have spent so much time in trial and error. Surely there is some way to know what that error message means.

Just about any parameter can cause that error--it is generic from my experience, so it doesn't help much. This is why I suggested eliminating as many variables as possible such as attachments.

RE: gmail - I just wanted to know if you were using a SSL server.

I just found that CDO is apparently installed when Outlook is installed, and starting with Outlook 2007 CDO was no longer installed. I am running XP PRO SP3 and Outlook is not installed on my PC and CDO is, so this is confusing. I do have Outlook Express, however.

Here is a link to the CDO download page.

http://www.windows8appstore.com/windows ... 50407.html

Unfortunately, this may mean that you will need to install CDO on your client's computer. It would be nice if there was a simple way to determine if CDO was installed. Perhaps looking for the cdosys.dll?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: CDO Once Again ...

Postby TimStone » Wed Apr 03, 2013 1:07 am

OK ... so I went online, CDO was there ... and then I looked at the obvious.

I compared Outlook settings with our email settings.

The guy guaranteed me over and over and over again that it was exactly the same.

Except the user name was not. He omitted the "@hisserver.com" section !

I corrected the error.

Now the CDO is working perfectly. Want to know how its implemented ? Check out the code section in the original post of this thread.

Thanks to everyone who helped along the way. I guess I need to go visit the client and collect a beer !

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: CDO Once Again ...

Postby James Bott » Wed Apr 03, 2013 1:49 pm

Tim,

Glad to hear you got it working.

The guy guaranteed me over and over and over again that it was exactly the same.

Except the user name was not. He omitted the "@hisserver.com" section !


This is why I kept suggesting reducing the number of variables. I would compile a test EXE hardcoded with your email and email server info and with no runtime inputs that you know is working on your PC. Then you can just run this on any client's PC to make sure CDO is working on their PC.

After that you can install and configure your app and if it errors out, then you know it is a configuration issue rather than wondering if CDO is working.

Again, so glad you got it working.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: CDO Once Again ...

Postby QAZWSX2K » Mon Nov 02, 2015 4:47 pm

how you resolve?, can you sharing with me? thanks
Software especializado para oficinas contables con grandes volumenes de Informacion
Impresion de todos los formularios del Seniat, Dian

alex_patino74@hotmail.com
whatsapp 57+3214777217
User avatar
QAZWSX2K
 
Posts: 364
Joined: Tue Oct 25, 2005 7:06 pm
Location: Bogota - Caracas

Re: CDO Once Again ...

Postby TimStone » Mon Nov 02, 2015 4:56 pm

My implementation is shared in the original post. It is correct.

The problem was that the user did not setup the server connection correctly. When I remotely took over his computer, and saw that, I fixed his entry and it all worked.

In most cases, when it asks for user name, it actually uses the full email.

He had: Username: John Doe
It wanted Username : JohnDoe@server.com

I made the change and all worked fine. If you want to implement CDO, my code in the original post works perfectly.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: CDO Once Again ...

Postby lucasdebeltran » Mon Nov 02, 2015 6:17 pm

Hello,

CDO does not work with latest TLS servers, and it´s blocked by many antivirus!.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: CDO Once Again ...

Postby TimStone » Mon Nov 02, 2015 7:15 pm

CDO resolved the issues I've had with SMTP over the years. It continues to work fine for all of my clients, and I hear absolutely no complaints.

I recommend the built in security in Windows 10 which has no problems with it, or Security Essentials for older OS versions.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: CDO Once Again ...

Postby Enrico Maria Giordano » Mon Nov 02, 2015 8:41 pm

TimStone wrote:CDO resolved the issues I've had with SMTP over the years. It continues to work fine for all of my clients, and I hear absolutely no complaints.

I recommend the built in security in Windows 10 which has no problems with it, or Security Essentials for older OS versions.


I agree.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: CDO Once Again ...

Postby MOISES » Mon Dec 30, 2019 9:15 pm

Hi,

How do you send emails via TLS smtp server?

Thank you.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: CDO Once Again ...

Postby MOISES » Wed Jan 01, 2020 3:23 pm

Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: CDO Once Again ...

Postby Jimmy » Thu Jan 02, 2020 3:02 am

MOISES wrote:I guess it is not possible:

https://social.technet.microsoft.com/Fo ... forum=ITCG

have you try Port 465 (mail.gmx.net) :?:
also there are Combination with Port 25 and SSL to work with TLS smtp server. (smtp.web.de)

both need
Code: Select all  Expand view
".../smtpauthenticate",   .t.
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests