Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Emailing Reports from APS

Emailing Reports from APS

Emailing Reports from APS

Does anyone have a solution for emailing in the body of an email reports that are output from an APS?  I have a director who wants to see a report on his Blackberry at scheduled intervals.

I had considered creating a JAVA or VB app that looks for a .txt output from the APS and, when found, parses it into SMTP.  That just seems like such a radical solution for what someone else may have already encountered and solved.

Any suggestions?

RE: Emailing Reports from APS

By "see it on his blackberry I hope that you aren't suggesting anything unbefitting of civilized people..."

I guess emailing in the body of a report means that you want to be able to email to different people based on some field in some section of the report, perhaps based on a condition?

Try using technical terms to describe the intent.

There is a 3rd party report viewer with email "bursting":



RE: Emailing Reports from APS

Maybe I should start over.  

I am scheduling a report to run on an APS server for output at several times per day.  My director is frequently off-site, so I need to send reports to him on his blackberry (a wireless palm-top). The blackberry cannot handle attachments, so I need to send the contents of the report via the body of an email to him.  The address will remain static, but the contents of the report, obviously, will not.

RE: Emailing Reports from APS

You we need to create an UFL or buy one.  I testing this using the below code and it worked.  The UFL will need to be registered on the server as well as an Development PC you use.


Public Function SendMailOutlook(sTo As String, sSubject As String, _
                 sTextBody As String, sFrom As String) As String
  'Create an Outlook object
  Dim Outlook As New Outlook.Application
  Set Outlook = CreateObject("Outlook.Application")
  'Create e new message
  Dim Message As Outlook.MailItem
  Set Message = Outlook.CreateItem(olMailItem)
    'You can display the message To debug And see state
    Message.Subject = sSubject
    'Message.Body = sTextBody
    Message.HTMLBody = sTextBody
    'Set destination email address
    Message.Recipients.Add (sTo)
    'Set sender address If specified.
    Const olOriginator = 0
    If Len(sFrom) > 0 Then
    Message.Recipients.Add(sFrom).Type = olOriginator
    'Send the message

    End If
    Set Outlook = Nothing
End Function

RE: Emailing Reports from APS

I had the same requirement some time ago and elected to use the database (SQL Server) to do this by sending along the results of a query.

Neither Info nor CE allows you to insert the report within the body of the email, you have to send it as an attachment.

Mark's solution looks intriguing, though there's a good deal left to do there.


RE: Emailing Reports from APS


I create a formula that is at the end or report footer of a report.  In the formula I setup my UFL with the information that has been gathered as the report is processing.  Than when the report is processing the footer my UFL runs, sending me totals that the report compiled.
It does not send me the whole report, just a few totals that I want daily in my Inbox/email.

I could have the report sent to me, but all I want is the totals.

This saves me opening e-mail attachements.


RE: Emailing Reports from APS

I see, that makes sense if you're only sending totals, but if you want ot send a report, there's a a bit more to do.

Such as exporting the report to a file, and reading the file in as text and inserting that.

Hence the database solution is much cleaner for me, if that is an option.


RE: Emailing Reports from APS


This is the code I use in my formula.  As I said I put this formula at the ReportFooter.
Have not tested to see if there is a limit to the sTextBody string, my guess would be yes.


// start of code
stringVar sTo :="nospam@nospam.com";
stringVar sSubject := "Reconcile for 2003" ;
stringVar sFrom := "kmsalt@nospam.com";
stringVar sTextBody := "";

sTextBody := "The reconciliation report for " + "<B>"+ {?CalendarYear} + "</B>";
sTextBody := sTextBody + "<BR>" + " The Total Pay Amount is " + totext(Sum ({mpdt.contract_pay_amt}));
sTextBody := sTextBody + "<BR>" + " For the Agency = " + "<I>" + {?Agency} + "</I>";
sTextBody := sTextBody + "<BR>" + " Isn't this a cool way to get your data?";
OutlookFDMFunctions (sTo,sSubject ,sTextBody ,sFrom )
//end of code

RE: Emailing Reports from APS

Well, I found a solution, though it's not pretty.  I created a VB app that checks a given directory for a .txt file and reads the file.  Then it creates a new outlook email (similar to what kmsalt is doing) and outputs the text as the body.  Then I created a .txt report in InDe and output to the specified directory.  

Thanks for all the suggestions.  If anyone needs code for the vb app, I'd be happy to help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close