Simplicty and flexibility!


Knowledge::

E-mailing From DataEase


Parameters


Returns/Result


Examples


Reference

E-mailing From DataEase

Dataease 7.2 allows you to attach any file and send it via e-mail.


Assuming a Payroll System and a monthly paysheet is sent to each employee in the company and you need DataEase to attach the paysheet to the email you will send to the employee and send it automatically.

First of all, you can create each paysheet in PDF format via the procedures “Print Options” window. To do this:

-select menu option: Document -> Print Options;
-select the “File” option in the [Document Print Options] dialogue window;
-select “PDF” from the listbox immediately adjacent to the “File” option;
-finally, specify the path where you want the PDF file to be saved in the textbox immediately below the “File” option.

To create the email functionality, first of all create the following CDF:

Function Name: Convert
CDF library name: STRFUNC.DLL
Return type: String
Parameter Name: Character to Convert
Parameter Type: String

Close and re-open your DataEase application (to register the CDF).

You will then need to create 3 procedures as follows. You can simply copy and paste in the code and amend where necessary:

Procedure 1:
–The below DQL which utilises Visual Basic code and executed by a program called “wscript.exe” found in your c:\WINDOWS\system32 folder. This is just one way of creating email functionality within DataEase.

Define Temp “tText1″ Text 100 .
Define Temp “tText2″ Text 100 .
Define Temp “tText3″ Text 100 .
Define Temp “tText4″ Text 100 .
Define Temp “tText4a” Text 100 .
Define Temp “tText5″ Text 100 .
Define Temp “tText6″ Text 100 .
Define Temp “tText7″ Text 100 .
Define Temp “tText8″ Text 100 .
Define Temp “tText9″ Text 100 .
Define Temp “tText10″ Text 100 .
Define Temp “tText11″ Text 100 .
Define Temp “tText12″ Text 100 .
Define Temp “tText13″ Text 100 .

Define Global “gFileName” Text 50 .
Define Global “gFileName2″ Text 50 .
Define Global “gEmail” text 40 .

– Name & path of the first file to attach gFileName := “C:\Paysheet1.pdf”.

– Name & path of the second file to attach (omit if not required)
gFileName2 := “C:\Paysheet2.pdf”.

– email address of the person you want send the email to gEmail :=”EmployeeName@MyDomainName.com”.

tText1 := Concat(“Set oolApp = CreateObject(“, convert(“n34″), “Outlook.Application”, convert(“n34″), “)”) .
tText2 := Concat(“Set email = oolApp.CreateItem(“,”0″,”)”) .
tText3 := Concat(“email.Recipients.Add(” , convert(“n34″), gEmail,convert(“n34″), “)”) .

– Attach file 1. N.B. the file MUST exist in the specific location otherwise the e-mail will not be sent and an error will be displayed
tText4 := Concat(“email.attachments.Add(“, convert(“n34″), gFileName, convert(“n34″), “)”) .

– Attach file 2 (omit if not required). N.B. the file MUST exist in the specific location otherwise the e-mail will not be sent and an error will be displayed tText4a := Concat(“email.attachments.Add(“, convert(“n34″), gFileName2, convert(“n34″), “)”) .

tText5 := Concat(“MailBody = ” , convert(“n34″),”” , convert(“n34″)) .
tText6 := Concat(“MailBody = MailBody & ” , convert(“n34″),”“,convert(“n34″), “& vbcrlf”) .
tText7 := Concat(“MailBody = MailBody & ” , convert(“n34″),”“,convert(“n34″), “& vbcrlf”) .

– Body of the e-mail. N.B. You can use HTML tags to enhance the look and feel
tText8 := Concat(“MailBody = MailBody & ” , convert(“n34″),”THIS IS A SAMPLE EMAIL,

“,convert(“n34″)) .
tText9 := Concat(“MailBody = MailBody & ” , convert(“n34″),”THAT HAS AN
ATTACHMENT

“,convert(“n34″)) .
tText10 := Concat(“MailBody = MailBody & ” ,
convert(“n34″),”“,convert(“n34″)) .

– E-mail Subject
tText11 := Concat(“email.Subject = ” , convert(“n34″),”THIS IS WHERE YOUR SUBJECT HEADER GOES”,convert(“n34″)) .

tText12 := “email.HTMLBody = MailBody” .
tText13 := “email.Send” .

list Records
tText1 ;
tText2 ;
tText3 ;
tText4 ;
tText4a ;
tText5 ;
tText6 ;
tText7 ;
tText8 ;
tText9 ;
tText10 ;
tText11 ;
tText12 ;
tText13 .

Export to “c:\email.vbs” .
.items
@f[1,1]
@f[1,2]
@f[1,3]
@f[1,4]
@f[1,5]
@f[1,6]
@f[1,7]
@f[1,8]
@f[1,9]
@f[1,10]
@f[1,11]
@f[1,12]
@f[1,13]
@f[1,14]
.end

Procedure 2:
–the following code uses wscript to execute the VB code created by the first procedure:
Call Program “c:\windows\system32\wscript.exe c:\email.vbs” .

Procedure 3:
–the following control procedure calls the above two procedures one after the other:
run procedure “PROCEDURE 1″ .
run procedure “PROCEDURE 2″ .

You are now ready to execute PROCEDURE 3.

 

See Also


On the forum about E-mailing From DataEase

[@EOF@]...

Product: . Written by alembagheri tahmas 07/12/13 at 13:37:32

Hi there,I am trying to use an external MySQL DB in dataease. I have successfully create the ODBC link and added the DB to dataease. I can also access the DB from dataease. Now, just for testing purposes, I am trying to create a simple report b...

Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17

no se pude exportar ahora archivos a pdf, ni a excel o otros cosa mala. en verdad creo que hace faltaen las versiones anteriores me funcionaba mas o menos bien. le hace falta a los aplicativos que se desarrollan en Dataeasegr...

Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11

Thanks. Anyway I'm trying to use this fuction but it seems to me that it doesn't work on 8.2. I tried also in a DQL.There's something wrong?<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9IAAAJ3CAYAAAB4NWk3AAAAAXNSR0IArs4...

Product: . Written by Marco Marchesi 15/02/16 at 14:50:46

[@EOF@]...

Product: Dataease [{8}]FIVE. Written by Chamil Rajindra 21/02/19 at 10:17:46

Thanks for the very good explanation!AS...

Product: . Written by afonso santos 28/10/19 at 00:50:14

I am pleased to see that the migration from Dos 4.53 is then sa 5.5 works. A really useful thing would be a compiler of SQL languages. Will you get there?Original Text:Mi compiaccio a vedere che la migrazione da Dos 4.53 รจ poi sa 5.5 funzio...

Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44

How can i delete a Style sheet?...

Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10

I run W7 and since a few days&nbsp;Dataease 8.5 is not starting any more, do you have an idea? i installed it again but that did not help....

Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40

[@EOF@]...

Product: . Written by Hiralal Rampul 01/12/21 at 17:47:10

On the blog about E-mailing From DataEase


dg3_HelpView