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!

e mail automation macro in cognos

Status
Not open for further replies.

billywizz

IS-IT--Management
Jan 20, 2003
4
GB
hi
i have a little problem trying to automate outlook using a cognos .mac file.
i am not skilled in this field but would like a little help please if possible
i am trying to use cognos scheduler to run a job , then open outlook and send this to a user.this i would like to do out of office hours.
the problem i have a message box appear on screen
with the following message.

A PROGRAM IS TRYING TO AUTOMATICALLY SEND E-MAIL ON YOUR BEHALF.DO YOU WANT TO ALLOW THIS.
CHOOSE YES, NO OR HELP
IF THIS IS UNEXPECTED ,IT MAY BE A VIRUS AND YOU SHOULD SAY NO.

if i click yes the job runs ok and send off the e-mail.super stuff wow
so to the question
can the choose yes button be written into the macro somehow?? or somehow tick a box in outlook which turns this off? so i can use this to run, schedule and post off the results.
i have attached the code which i picked up from this site and tried to use
if anyone knows how to do this can they please just insert the required lines

sub main()
Dim objOutlook As Object
Dim objOutlookEmail As Object
Dim objOutlookAttachments As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookEmail = objOutlook.CreateItem(OlMailItem)
objOutlookEmail.Subject = "Daily update"
objOutlookEmail.Body = "Please find attached your daily file"
objOutlookEmail.To = "someone@aol.com"
Set objOutlookAttachments = objOutlookEmail.Attachments
objOutlookAttachments.Add "c:\TEST.xls"
objOutlookEmail.Display
objOutlookEmail.Send
Set objOutlook = Nothing
Set objOutlookEmail = Nothing
Set objOutlookAttachments = Nothing

End Sub


kind regards
pam

 
Pam,
Unfortunately, there is no way around this, as it is a MS 'fix' to Outlook to prevent virii spread. I've been pole-axed by this and both MS & Cognos websites claim there's no way around it. IMHO, you either have to downgrade your Outlook software to a version without this fix (the IT dept are unlikely to love you for this) or seek another way to send the mail. If you're running Cognos on a server you should be able to call SMTP (check it's running as a service) to send mail via your company's Exchange server (or whatever) by code like:

Set objEmail = CreateObject("CDONTS.NewMail")
with objEmail
.To = "someone@whereever.com"
.From = "administrator@yourcompany.co.uk"
.Subject = "Cube Build"
.Body = "All cubes built successfully"
.MailFormat = 0
.AttachFile strfilename
.Send
End with
set objEmail = nothing

Only downside appears to be a fair delay in the recipient receiving his/her mail - however, that may be something to do with our Exchange set-up.

HTH
lex
 
hi

in continuation of the above email macro - if my mail client is 'Netscape Communicator 4.76' - what parameter do i pass to CreateObject(" ??? ")

thanks in advance


 
I had this problem and found a registry hack that fixed it. I am running "Outlook 2000 SR1". I am not sure if this patch applies to any other version of Outlook.
NOTE: Messing with the Registry can have adverse affects on your PC. Know what you are doing and Create a backup first! I will not be responsible for any problems.
1) Create a new text file and put the following information in it:

REGEDIT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Security]
"CheckAdminSettings"=dword:00000001

2) Save the file as "OutlookSecurityPatch.reg
3) Double-click the file to install the patch.

This worked for me. Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top