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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending email with CognosScript 3

Status
Not open for further replies.

PekkaK

Technical User
Jul 8, 2003
4
FI
What would be the easiest way to send email notifications with CognosScript? There aren't any predefined functions and I suppose one would have to install some mail components into the server running the scripts? The dedicated macro "server" would probably be something outdated like win95 or NT4.

Any bright ideas? [bigears]
 
You can use NoticeCast if you have IWR or PP Enterprise. Otherwise do a Keyword search here for "email macro" and you should get a number of good posts on how to do this.

Regards,

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
I have written a vBscript programme which sends an email to users via SMTP. This is kicked off at the end of my Cognos Macro.

Not actually sure how the technology works, just know it does!!
 
Could I possible see your script to see if I have/can get required components?

Does anyone else have good ideas? If I get W2K or XP, it would propable be easier?
 
How about something like this ...

Dim objOutlook as Object
Dim objOutlookEmail as Object
Dim objOutlookAttachments as Object

Sub Outlook(strSubject$, strTo$, strBody$, strAttachment$)

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookEmail = objOutlook.CreateItem(OlMailItem)
objOutlookEmail.Subject = strSubject
objOutlookEmail.Body = strBody
objOutlookEmail.To = strTo
Set objOutlookAttachments = objOutlookEmail.Attachments
objOutlookAttachments.Add strAttachment
objOutlookEmail.Display
objOutlookEmail.Send

Set objOutlook = Nothing
Set objOutlookEmail = Nothing
Set objOutlookAttachments = Nothing

End Sub

You'll notice that the function requires some parameters to be passed to it. Here is a list of the variables that will need to be set.

strSubject - Subject text for the email.

strTo - The distribution list to send the email to. Use a semicolon as a seperator - ";" for multiple addresses.
strBody - Body text for the email.

strAttachment - A file to attach to the email.

objOutlook - Used to reference the Outlook Object Model.
objOutlookEmail - The Email Object.
objOutlookAttachments - The attachments collection.

Hope this helps.

Flex
 
I have created a similar macro for emailing using Novell GroupWise and CognosScript. Let me know if you would like to see it.

Chad
 
Chad,

Please go ahead and post it. It would add to our code base for handling email on different platforms.

Thanks,

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
Option Explicit

Declare Sub Email(Subject$, SendTo$, Body$, Attach$)
Dim objGroupwise as Object
Dim objGWaccount as Object
Dim objGWmessage as Object
Dim objGWrecipient as Object
Dim objGWattachment as Object

Sub Main()

call Email(something,name,text,attachment)
'Call email function



End Sub

Sub Email(Subject$, SendTo$, Body$, Attach$)


Set objGroupwise = CreateObject("NovellGroupWareSession")
Set objGWaccount = objGroupwise.Login("UserName"," ","password")
Set objGWmessage = objGWaccount.MailBox.Messages.Add("GW.MESSAGE.MAIL")
Set objGWrecipient = objGWmessage.Recipients.Add(SendTo$)

objGWmessage.Subject = Subject$
objGWmessage.BodyText.PlainText = Body$
Set objGWattachment = objGWmessage.Attachments.Add(Attach$)

objGWmessage.Send

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top