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″),”