Page 1 of 2

cobasystems EMAIL via AutoIt

Posted: Tue Apr 18, 2017 2:53 pm
by cobasystems
Alaska Xbase ++ and eXpress ++ version 1.9 library Asinet have an email client that supports SSL encryption. This support has been introduced only in version 2.0 or version 1.9 users do not have it. For this reason, work with version 1.9 used in a variety of solutions, and the most commonly used ActiveX Controls.

I am here used the Windows CDO CDOSYS.DLL ActiveX control that urge from EXE program eMailAutoit.exe written in free Windows script language AutoIt. Complete project and source code for autoit program eMailAutoit.exe I gave in the file:
Alaska Xbase++ EMAIL autoit.zip

https://onedrive.live.com/redir.aspx?ci ... J3Rk2dc3Kw

In this file is located and AutoIt program, and the story of AutoIt program and instructions for working with Autoit tool, and an explanation as to why I believe that programs directly related to the Windows API to write from Autoit Windows script languages.

Its operation is as follows:
SENDING MAIL


Xbase ++ / eXpress ++ application make data and text for mail and all recorded in a plain text file EMAIL.TXT
Then Xbase ++ / eXpress ++ application calls the external program eMailAutoit.exe which loads data from a text file EMAIL.TXT and send them as a mail recipient.

SETTING MAIL SERVER

Xbase ++ / eXpress ++ application calls the external program eMailAutoitConfig.exe which open dialogue for data entry:
- the name of the SMTP mail server,
- port number,
- mail address of the sender
- mail address of the sender to which it sends copies of sent mail,
- username for the mail server
- password for the mail server
- SSL connection Yes / No
The registered information enroll in the Windows registry database.

When Xbase ++ / eXpress ++ application calls the external program eMailAutoit.exe he loaded the data from the Windows registry and uses them to send mail to the recipient. If this information is incorrect mail will be sent.
Complete project and source code for Xbase ++ / eXpress ++ program with eMailAutoit.exe I gave in the file:
Alaska Xbase++ EMAIL via autoit.zip

https://onedrive.live.com/redir.aspx?ci ... 392Bp7K4pY

Re: cobasystems EMAIL via AutoIt

Posted: Wed Apr 19, 2017 12:00 pm
by Auge_Ohr
hi,

ZIP File need Password ???

i wonder why you use AutoIt for CDO while you can use it direct with Xbase++

Code: Select all

#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "os.ch"
#pragma library( "ascom10.lib" )

PROCEDURE MAIN
LOCAL oCdoMessage
LOCAL oCdoConf
LOCAL cFromTo 

   oCdoMessage := CreateObject("CDO.Message")
   oCdoConf    := CreateObject("CDO.Configuration")

   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/sendusing",2)

// this is for "WEB.DE"
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.web.de")
// Port 25 or 587 or other depend on Provider  
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25)
*  oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpserverport", 587)
// SSL
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpusessl", 1)

   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/sendusername", "USERNAME")
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/sendpassword", "USERPASSWORD")

   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60)
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)

   oCdoConf:fields:callMethod("Update")

   oCdoMessage:Configuration := oCdoConf
   oCdoMessage:Subject := "CDO Beispiel"

// send FROM -> TO
   oCdoMessage:setproperty("From", "XXX@web.de")
   oCdoMessage:setproperty("To", "ZZZ@T-ONLINE.de")
   oCdoMessage:TextBody := "von WEB.DE Bla bla bla. "+OS(OS_VERSION)

   oCdoMessage:Send()

WAIT

RETURN

Re: cobasystems EMAIL via AutoIt

Posted: Thu Apr 20, 2017 3:53 pm
by cobasystems
password for all my zip files is: cobasystems

Re: cobasystems EMAIL via CDO

Posted: Tue Jun 26, 2018 1:49 am
by skiman
Hi,

I was trying to use the below code, but it doesn't work. Anyone who is using the CDOsys.dll for sending emails? It looks easy, but apparently it isn't.

The error is: the transport failed to connect to the server. I checked Google, and it seems that this is something rather common. It looks as there is never a real concrete answer to this. Same code is working on different PC's and on some it doesn't.

Is there someone who is successfully using CDO for sending mail?
Auge_Ohr wrote:hi,

i wonder why you use AutoIt for CDO while you can use it direct with Xbase++

Code: Select all

#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "os.ch"
#pragma library( "ascom10.lib" )

PROCEDURE MAIN
LOCAL oCdoMessage
LOCAL oCdoConf
LOCAL cFromTo 

   oCdoMessage := CreateObject("CDO.Message")
   oCdoConf    := CreateObject("CDO.Configuration")

   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/sendusing",2)

// this is for "WEB.DE"
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.web.de")
// Port 25 or 587 or other depend on Provider  
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25)
*  oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpserverport", 587)
// SSL
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpusessl", 1)

   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/sendusername", "USERNAME")
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/sendpassword", "USERPASSWORD")

   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60)
   oCdoConf:fields:setproperty("item","http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)

   oCdoConf:fields:callMethod("Update")

   oCdoMessage:Configuration := oCdoConf
   oCdoMessage:Subject := "CDO Beispiel"

// send FROM -> TO
   oCdoMessage:setproperty("From", "XXX@web.de")
   oCdoMessage:setproperty("To", "ZZZ@T-ONLINE.de")
   oCdoMessage:TextBody := "von WEB.DE Bla bla bla. "+OS(OS_VERSION)

   oCdoMessage:Send()

WAIT

RETURN

Re: cobasystems EMAIL via CDO

Posted: Tue Jun 26, 2018 9:18 am
by Auge_Ohr
skiman wrote:I was trying to use the below code, but it doesn't work.
i use it every Day

you have to find out which Port your Provider need. it might be 578 for SSL but NOT 25
skiman wrote:Anyone who is using the CDOsys.dll for sending emails? It looks easy, but apparently it isn't.
you do not need any DLL ... it is Windows itself who have CDO.

Re: cobasystems EMAIL via AutoIt

Posted: Tue Jun 26, 2018 10:09 am
by Victorio
Jimmy,
It is very important, is this possible also for sending attach files in mails ?
And works with Foundation version of Alaska Xbase++ ?

Re: cobasystems EMAIL via AutoIt

Posted: Tue Jun 26, 2018 12:04 pm
by Auge_Ohr
Victorio wrote:It is very important, is this possible also for sending attach files in mails ?
YES

Code: Select all

   oCdoAdd := oCdoMessage:AddAttachment("D:\TEST\Test.DOC")
   oCdoAdd:ContentMediaType := "application/msword"
Victorio wrote:And works with Foundation version of Alaska Xbase++ ?
it is Windows so it work with every Programming Language which can use COM / activeX Interface

Re: cobasystems EMAIL via AutoIt

Posted: Tue Jun 26, 2018 12:14 pm
by Victorio
Superr, I must try it tnx

Re: cobasystems EMAIL via CDO

Posted: Wed Jun 27, 2018 12:31 am
by skiman
Auge_Ohr wrote:
skiman wrote:I was trying to use the below code, but it doesn't work.
i use it every Day

you have to find out which Port your Provider need. it might be 578 for SSL but NOT 25
skiman wrote:Anyone who is using the CDOsys.dll for sending emails? It looks easy, but apparently it isn't.
you do not need any DLL ... it is Windows itself who have CDO.
Hi Jimmy,

If I test the port I use with xbsee library with portqry it is 'listening'. I'm using port 578, which is working with xbsee.

I tested now with port 25, and the mail was send.

Both tests have been done with the same .EXE, to be sure that my application isn't blocked by some software.

Apparently it is a port issue. I will give the option in my application, mail by CDO or mail by xbsee.

Re: cobasystems EMAIL via AutoIt

Posted: Wed Jun 27, 2018 12:29 pm
by rdonnay
When I use Chilkat_9_5_0.Mailman ActiveX for smtp I use port 465 for Gmail.

Also, Chilkat has a logical value that must be set to enable SSL:

Code: Select all

oMailman := CreateObject('Chilkat_9_5_0.MailMan')

*  Any string argument automatically begins the 30-day trial.
nSuccess := oMailman:UnlockComponent("30-day trial")
IF (nSuccess <> 1)
  DCMSGBOX oMailman:LastErrorText
  QUIT
ENDIF

*  Set the SMTP server.
oMailman:SmtpHost = "smtp.gmail.com"

oMailman:SmtpUsername := ''
oMailman:SmtpPassword := ''

oMailman:SmtpSsl := 1
oMailman:SmtpPort := 465
Is it possible that your CDO control also has such a requirement?