Page 1 of 1

E-mail Notification - Report in the Body of the mail

Posted: Thu Jun 07, 2012 7:52 am
by DSFreddie
Hi All,

I am creating a statistics report after the ETL cycle run & I am currently attaching this report through the email notification & sending it to stakeholders.

Is there a way I can send the content of the report in the e-mail body itself?

I browsed through the forum for an answer & couldnt find any solution to it.

Any thoughts are appreciated
Freddie

Posted: Thu Jun 07, 2012 8:04 am
by chulett
It's been discussed a number of times here. To get it in the body you need to "roll your own" routine to send mail with a variable body. You could start with DSSendMail and tweak it, or start from scratch.

Posted: Thu Jun 07, 2012 11:18 am
by josh.guffey
DSFreddie here is an example of server routine that will take a variable for the body:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

   FullArg = ""

   If ToAddress <> "" Then
      FullArg<-1> = "To:":ToAddress
   End
   If FromAddress <> "" Then
      FullArg<-1> = "From:":FromAddress
   End
   If Subject <> "" Then
      FullArg<-1> = "Subject:":Subject
   End
   If SMTPServer <> "" Then
      FullArg<-1> = "Server:":SMTPServer
   End
   If Attachments <> "" Then
      FullArg<-1> = "Attach:":Attachments
   End
   If MessageBody <> "" Then
      FullArg<-1> = "Body:":MessageBody
   End

   Code = DSSendMail(FullArg)
   
   Ans = Code
Here are the descriptions for the Arguments:

Code: Select all

ToAddress - Who to send mail to, e.g. you@there.com
FromAddress - Who the mail is from, e.g. me@here.com
Subject - Subject line
SMTPServer - Name of server to contact for sending mail
Attachments - Pathname of file to send as attachment - multiple paths may be given separated by commas
MessageBody - One or more lines of text, separated by \n if multi-line