Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating E-mails from within Crystal 1

Status
Not open for further replies.

IdoMillet

Instructor
Feb 6, 2001
5,290
US
I want to draw your attention to a very cool UFL
(User Function Library) available from Chelsea Technologies at: as the "Outlook Library".

It allows you to automatically generate e-mails from within your report.

After downloading the demo or full ($99.97) zip file, you install the software following simple instructiuons in
a 2-page pdf file. It boild down, in my case, to:

1. copying a single 32KB dll (CRUFLMail.dll) to the C:\WINNT\Crystal\directory

2. Registering by issuing
“Regsvr32 C:\Winnt\Crystal\CRUFLMail.DLL”
from the Start, RUN command line.

3. Starting Crystal.

At this point you would notice 4 new functions in the Crystal formula editor under the “Additional Functions” category.

The simplest option is to use
OutLookMessageSendNow( Address, Subject, Body, CC, BCC)
To immediately send an Outlook e-mail message from within any report section where this formula is used. All arguments to this function can be dynamically specified using database columns and formula expressions.

To Build a more complex message or a message that collects its content from multiple sections, you begin with: OutlookMessageStart(Address, Subject, Body, CC, BCC).
This starts message, but doesn’t yet send it.

You then append Body content to the message by
Issuing calls to the OutLookMessageAppendBody(Body) function, which adds more text to the body of the message, but still doesn’t send it.

The message gets sent when you use the OutLookMessageSendBody(Body) to append one last piece of body text and send the resulting e-mail message.

I recently used this utility to send automatic e-mail messages to students who registered for courses for which they lack some prerequisites. The design process was simple and the speed of generating several hundred messages was impressive.

Within each course and section, each student formed a group with detail sections showing what prerequisites they are missing. In the group header for the student I started the e-mail with the following formula:

IF {?Enable Email} THEN
(
WhilePrintingRecords;
OutlookMessageStart ({@Clean E-mail}, // e-mail address
"Missing Prerequisites for " + {Missing_PreReq.course} + " ",
CHR(13) + "Dear " + {Missing_PreReq.name_pers_first} + " " + {Missing_PreReq.name_pers_last} + ":" + CHR(13) + CHR(13) +
"It looks like you have registered for " + {Missing_PreReq.course} + " Section " + {Missing_PreReq.section} + CHR(13) +
"even though you are missing the following prerequisites: " + CHR(13) +
"--------------------------------------------------"
+ CHR(13),"","") ;
)


The {?Enable Email} parameter is a technique I used to disable automatic e-mail using a simple TRUE/FALSE prompt. This is useful in order to allow the report to be designed and used without constantly spewing e-mails. I recommend you use a similar approach.

Note the use of CHR(13) to build line breaks into the text.

Finally, I recommend you start by setting the Address argument to your own e-mail address. This allows you to test the resulting e-mails without bothering other people.
When everything looks good, change the address argument to the true information provided by the database records.

I estimate most report designers would be able to generate e-mails from within their Crystal reports within 3 hours of downloading this very useful utility.

Cheers,
- Ido
ixm7@psu.edu
 
I also have used this UFL on a report to automatically generate AR statements and email them to the client. It is very cool and easy to work with. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
I wrote an article on 4/1 about Email options and mentioned this technique and a few others. The article is at:


Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
does this allow you to use other email packages such as Lotus notes or Groupwise?

Thanks
 
Canine,

I have personally tested this with Outlook and Outlook Express. I would like to see it with Eudora but I have not had the chance to test that yet.

According to the documentation, it uses any MAPI compliant mail. You should go to or email Bruce at bruce@chelseatech.co.nz

Bruce is a frequent contributor to this forum and very knowledgeable. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Hi guys and thanks for the kind words.

The UFL uses CDO and MAPI, and I've used the same email functions at a groupwise site, and they work fine. Lotus Notes requries a different mail transfer method, but I'm sure there would be an API we could use somehow. Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top