My questions are regarding implementation of this routine.
Where do I insert this code into my report? I need the PDF one.
When sending to bca, do i just do refresh and custom macro under actions?
Thanks
jozeph78 (BOB member since 2003-10-22)
My questions are regarding implementation of this routine.
Where do I insert this code into my report? I need the PDF one.
When sending to bca, do i just do refresh and custom macro under actions?
Thanks
jozeph78 (BOB member since 2003-10-22)
Sure! Are you having a problem when you do that, or when you put the code in a report? Welcome to Bob, by the way
Nick Daniels (BOB member since 2002-08-15)
It was kinda a two step problem, starting with me not knowing exactly where to put the code ovbiously. THe link to the zipped up example was broken yesterday when I tried to download it but it’s back up now. I’ll work with the example and post when I get stuck again.
Thanks for the welcome and response.
jozeph78 (BOB member since 2003-10-22)
Ok the problem I’m getting now is generated by outlook.
The following prompt occurs.
"A program is trying to acess e-mail addresses you have stored in Outlook. Do you want to allow this?
If it is unexpected it may be a virus…"
I’m sure there is a single setting making this prompt pop up. My administrator is against just lowering all security settings. What can I change to make this go away?
jozeph78 (BOB member since 2003-10-22)
This Outlook behavior was actually part of a security patch to Office distributed quite a while back as a response to the ILoveYou worm which piggybacked some nasty VB Script.
Not sure if there is a work around…
dirmiger (BOB member since 2002-08-28)
so how is anyone automating e-mail through BO these days?
Isn’t there a way to add localhost or whatever as a trusted source or something?
jozeph78 (BOB member since 2003-10-22)
I use blat instead of Outlook. Primitive but always works.
See www.blat.net. I can supply some samples if you like. I’m still using v1.94
dirmiger (BOB member since 2002-08-28)
Hrmmm… The machine doubles as our sqlserverDB and handles quite a load. Anything that opens up any type of security hole would be frowned upon greatly.
Having a stern administrator I must ask:
Are there any drawbacks to installing blat on the machine?
Will it affect outlook in any way?
What do i have to change in my code to get it to work with blat?
Samples would be GREATLY appreciated. And thanks greatly for your help dirmiger.
jozeph78 (BOB member since 2003-10-22)
blat does an end-around Outlook by communicating directly with whatever SMTP server you have.
No install of blat is required although there is an install script which sets a couple of registry entries. You can provide those as parameters at run-time though making it very lightweight.
I use the DLL implementation of v1.94 developed by Toby Korn. Find it at http://home.att.net/~toby_korn/blat/blat3_1.zip. I have no experience with v2.1 or more recent implementations than 1.94.
Notice: no unsolicited e-mails are authorized (SPAM) using blat. This is a gentlemens agreement not a software restriction.
You’ll need the following in the VB General_Declarations section:
Private Declare Function SendBlat _
Lib “C:\Program Files\Business Objects\BusinessObjects 5.0\UserDocs\blat.dll” _
Alias “Send” _
(ByVal strCmd As String) As Integer
I put the blat.dll file in UserDocs. You could put it anywhere you want.
Write the e-mail body to a text file and use the following statement to send your mail:
strCmd = strMailLogFileSpec & _
" -f ““fromuser@yoursite.com””" & _
" -t ““touser@theirsite.com””" & _
" -s ““Subject line””" & _
" -server " & strSMTPSERVER
intRC = SendBlat(strCmd)
Where strMailLogFileSpec contains the filespec of the e-mail body and strSMTPSERVER contains the IP address of your SMTP server and the port it uses (almost always 25). Example: pop.yoursite.com:25.
RC will contain any non-zero error codes blat returns. See the docs.
I can supply more detail but I’d recommend you go to the blat web site and get some of their documentation. Check out http://www.interlog.com/~tcharron/blat.html. You’ll need to know your SMTP server address but this should be all that your administrator needs to supply you.
Have fun. It really works.[/url]
dirmiger (BOB member since 2002-08-28)
Before I get too far into modifying the code, how does this deal with sending .pdfs as attachments.
I don’t understand what is meant by filespec. Do you mean the location of the file attachment? Do I have to created an RTF with the PDF embedded with teh body and assign that to MailLogFileSpec?
Also it’s going to all internal addresses, and we run lotus notes. Shoudl I point the SMTPSERVER to teh domino server ip or the SMTP of the local host?
So…
strMailLogFileSpec = filedirectory(C:…)??? (what goes here)?
strSMTPSERVER = http://127.0.0.1:25
.
.
.
strCmd = strMailLogFileSpec & _
"-f “” …
.
.
“-server” & strSMTPSERVER
intRC=SendBlat(strCMD)
jozeph78 (BOB member since 2003-10-22)
Before I get to far into modifying the code, how does this deal with sending .pdfs as attachments.
Use the ExportAsPDF function to create the pdf and simply attach that to the e-mail. See blat docs for the -attach argument. We do it here. It works.
I don’t understand what is meant by filespec. Do you mean the location of the file?
Yes. Filespec = file specification ([Drive Letter:]|[UNC]+path+filename)
Also it’s going to all internal addresses, and we run lotus notes. Shoudl I point the SMTPSERVER to teh domino server ip or the SMTP of the local host?
Don’t know. Your configuration is not ours. I would suspect the SMTP of the local host but you might want to check with your e-mail admin on this. We run Groupwise here and use its SMTP server. However, you could do another end-run and set up an SMTP server in IIS. Tends to miff security folks though.
So…
strMailLogFileSpec = filedirectory(C:…)???
strSMTPSERVER = http://127.0.0.1:25
Leave off the http://. Use just 127.0.0.1:25.
.
.
strCmd = strMailLogFileSpec & _
"-f “” …
.
.
“-server” & strSMTPSERVER
intRC=SendBlat(strCMD)
It’s a start. Try it…
dirmiger (BOB member since 2002-08-28)
hrm… so strMailLogFileSpec is the body of the e-mail?
Must I create a txt file for this or may I pass a direct string “Here is report x”).
So I’m thinking more along the lines of
strMailLogFileSpec = body (file or direct string)
strSMTPSERVER= (I’ll figure it out)
strCmd = strMailLogFileSpec & _
“-f “” …
.
.
“-attach””(Directory location of my pdf)"""&_
“-server” & strSMTPSERVER
intRC=SendBlat(strCMD)
I’m also unfamilliar with the underscore VB syntax. I’ve done more work in C++ and Java. Is that used to assert the following line is contained int he initial assignment line strCmd due to the lack of using semicolons(that’s a guess)?
jozeph78 (BOB member since 2003-10-22)
hrm… so strMailLogFileSpec is the body of the e-mail?
Must I create a txt file for this or may I pass a direct string “Here is report x”).
You can if you use the DOS version and redirect to stdin. Using the DLL however, I’d create a temporary file containing the e-mail body (“Here is report x”) and use that. Delete it after the blat call completes successfully. In short, the answer to your question is: create a text file.
strCmd = strMailLogFileSpec & _
“-f “” …
.
.
“-attach””(Directory location of my pdf)"""&_
“-server” & strSMTPSERVER
intRC=SendBlat(strCMD)
I’m also unfamilliar with the underscore VB syntax. I’ve done more work in C++ and Java. Is that used to assert the following line is contained int he initial assignment line strCmd due to the lack of using semicolons(that’s a guess)?
The underscore is simply a way of breaking a long logical statement into multiple physical lines: line continuation. The underscore MUST be preceded by a space for it to work and you cannot use them inside a string literal.
dirmiger (BOB member since 2002-08-28)
WOW dirmiger… ure the “Don” (no pun intended).
I’ve felt like I’ve had tech support online all day. I can’t tell you how much this helps me and my company out. I’m now a perment on this forum and hopefully oneday I will be able to return the favor.
jozeph78 (BOB member since 2003-10-22)
Josheph,
I am trying to do something similar with outlook.
Could you pls send me the sample code.
Thanks
Reema
reemagupta (BOB member since 2002-09-18)
You’d use CDONTS or something similar. No experience with it but there are others who have done this.
dirmiger (BOB member since 2002-08-28)
I want to say that BOB’s downloads forum has an example through outlook. I couldn’t get outlook to work because of a prompt through outlook which said somethign about are you sure you want an outside application to access teh program. When I couldn’t get it to go away I used blat instead.
jozeph78 (BOB member since 2003-10-22)
Yes, I remember the Outlook prompting issue was Microsoft’s effort to suppress using Outlook to send SPAM. It was actually an update that all dutiful MS users install. Adds functionality… right…
dirmiger (BOB member since 2002-08-28)
more precisely I read it was to combat the I love you virus. But where’s the love in that.
jozeph78 (BOB member since 2003-10-22)