Send report to e-mail ID-BCA only

hello all.
I have a report that needs to be sent to different users using BCA. I want to send those reports via e-mail ID. I did a search on this board. All of the VBA code I found, got the solution by creating a MAPI Session -using Lotus notes/Outlook.

But I am looking for a solution in which i dont need to use notes/outlook . Is there any solution just by using e-mail id? Just need to send this report to BCA and distribute to user mail Ids. Thanks in advance for your help.


john_ed (BOB member since 2004-09-08)

I think BCA publisher might be of use to you if you do not want to use VBA code for sending reports through VBA code.

BCA publisher comes at a cost from Business Objects.


JaiGupta (BOB member since 2002-09-12)

I’m sure BCA Publisher could do this, but it’s unlikely a good alternative for you. The solutions provided use MAPI, because the vast majority of customers can do it this way. There is likely nothing preventing you from using a generic SMTP gateway and supplying the appropriate parameters. In fact, this is what BCA Publisher does.l

I don’t have a sample, but this may give you soe ideas.


Steve Krandel :us: (BOB member since 2002-06-25)

I can confirm that Steve’s suggestion does work. Using CDO (Collaboration Data Objects) and a SMTP server is a barebones, but “easy” solution. The benefit is that CDO is already “there” in any Windows installation … MAPI / Outlook / Lotus Notes, may not.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

hello everybody, Thanks for ur suggestions.
Actually, I have no problem using VB code. but if that code includes a MAPI session…etc, then it is giving me headache. you were right, I have CDO, So using SMTP sever can i generate something? Thanks in Advance.


john_ed (BOB member since 2004-09-08)

Yes. This is a sample of some code that I use:

Dim Cfg As CDO.Configuration
Dim Msg As CDO.Message

'establish server settings
Set Cfg = New CDO.Configuration
Cfg.Fields(cdoSendUsingMethod) = cdoSendUsingPort
Cfg.Fields(cdoSMTPServer) = "smtp.server.address"
Cfg.Fields.Update

'now create and send the message
Set Msg = New CDO.Message
Set Msg.Configuration = Cfg 'use the server settings established above
Msg.From = "user@address.com"
Msg.To = "user@address.com
Msg.CC = "user@address.com"
Msg.Subject = "text"
Msg.TextBody = "text"
Msg.AddAttachment "filename"
Msg.Send

Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

hey Dwayne,
Thanks for the code. I’ll try this, and get back to you.


john_ed (BOB member since 2004-09-08)

No problem. Also, a search for CDO here on BOB may also give you some other ideas. If I remember correctly, there are also links to other online resources regarding CDO.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

hi Dwayne, this might be a stupid Q, but I need to know…
I am trying to implement your code, I dont have SMTP server Address. How can i get the Server address?
Our Admin is on vacation and nobody is around to ask,…people around dont know!
there should be a way, Thanks in advance for help!


john_ed (BOB member since 2004-09-08)

hey Dwayne,
I was able to find the port num for SMTP : 25
name: Default SMTP Virtual Server
But its IP address says: (All Unassigned)(But if i pull down the box there is another IP address…should i use this address?) let me know…
Thanks


john_ed (BOB member since 2004-09-08)

Sorry, I don’t know the address of your smtp server either :rotf: . I’m not familiar enough with the network / server side of things to know if it’s possible to reverse engineer it either. Good luck.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

hi Dwayne,
I tried to implement ur code. I encounterd the following error!

“run-time error ‘-2147220977(8004020f):’
the server rejected one or more recipient addresses. the server responce was 550 5.7.1 Unable to relay for Username@email.com

I tried by changing the username too, still i get the error!

Can you please clarify this?
Thanks,


john_ed (BOB member since 2004-09-08)

This is a Server configuration issue. It seems that the SMTP server is configured NOT to forward messages (i.e. Not to act as an Open relay).

You might want to:

  1. Talk to your Network admin about it
  2. You may need to authenticate with a valid username/pwd before sending emails
    3.If this SMTP server is handling emails for the domain you are sending emails to (e.g. yourcompany.com ) then try sending an email from you@yourcompany.com to you@yourcompany.com.
  3. Have a look at the Outlook Express / Outlook settings to know what configuration is expected by server.

HTH


shamit (BOB member since 2004-07-01)

hey, thanks Shamit for the information.


carlosvirgo (BOB member since 2004-08-28)

Hi,
l am using this code, but can’t seem to make it work. lt is refreshing data, but l don’t get email notification. thanks

Public Sub SendEmail()

Dim ObjMessage As CDO.Message
Dim Cfg As CDO.Configuration
Dim Msg As CDO.Message
Dim doc As Document
Dim docname, tempdoc As String
Dim Rep As REPORT
Dim i As Integer

Set doc = ActiveDocument
doc.Refresh
doc.Save
docname = doc.FullName
tempdoc = doc.Name & format(Now, "MM-DD-YYYY hh\hmm")
doc.SaveAs (tempdoc)

For i = 1 To doc.Reports.Count
Set Rep = doc.Reports.Item(i)
Rep.ExportAsPDF ("C:\Reports\" & Rep.Name)
Next i
On Error Resume Next

Set ObjMessage = New CDO.Message


'establish server settings
Set Cfg = New CDO.Configuration
Cfg.Fields(cdoSendUsingMethod) = 25
Cfg.Fields(cdoSMTPServer) = "mailhost.global.com"
Cfg.Fields.Update

'now create and send the message
Set Msg = New CDO.Message
Set Msg.Configuration = Cfg 'use the server settings established above
Msg.From = "joy@jjj.com"
Msg.To = "joy@jjj.com "
'Msg.CC = "user@address.com"
Msg.subject = "bca text"
Msg.TextBody = "testing"
Msg.AddAttachment "doc"
Msg.Send


End Sub

abieyuwae (BOB member since 2004-06-07)

I’m not sure if this is causing it, but the .AddAttachment line doesn’t look right. The parameter is the filename to be attached, so unless you have a file literally named “doc” (current path, no extension) that portion is failing. What you probably want is Msg.AddAttachment Doc.Fullname, and I’m not sure if the file will attach while it is still open. You’d have to test that part.

Again, I’m not sure if that is causing the email message to fail, but I’m pretty sure it’s a problem of some sort.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

l commented out the attachement, but it is still not working. thanks alot


abieyuwae (BOB member since 2004-06-07)