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

Access - Send report as body of an LotusNotes email

Status
Not open for further replies.

NWildblood

Technical User
Nov 12, 2007
113
GB
Hi, I have found an old thread that sends a report as the body of an Outlook email:
Access SendObject outlook email? thread702-1114426
Works perfectly well, unforrtunately my company in its wisdom has shifted us onto Lotus Notes
I have tried so far unsuccesfully to modify it to work with Lotus Notes - any mods or ideas ???

Original code from Remou (more or less):
_______________________________________

Option Compare Database
_______________________
Sub RTFBody()
Const ForReading = 1, ForWriting = 2, ForAppending = 3

Dim fs, f
Dim RTFBody, strTo
Dim MyApp As New Outlook.Application
Dim MyItem As Outlook.MailItem

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("C:\Report.rtf", ForReading)
RTFBody = f.readall
f.Close

Set MyItem = MyApp.CreateItem(olMailItem)
With MyItem
.To = "me@hotmail.com"
.Subject = "txtSubjectLine"
.Body = RTFBody
End With
MyItem.Display
End Sub
______
Any assistance gratfully received !


"No-one got everything done by Friday except Robinson Crusoe...
 
Why not simply send it as an attachment with the SendObject method ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV
Thanks - we get basic web-generated email forms from customers which are currently processed manually on our mainframe, 'estimate numbers' produced therein, then the emails manually updated and returned to the client.

What I've got so far is a VB transfer code to suck the email forms into access, automate the transaction process on the mainframe and produce a report. Sweet (well for this non-techy anyway:)

However, the optimum outcome is to simply return this report as the body of the email so the customer receives it in the same format they do now, with the estimate number field updated, all immediately visible...
Regards
OoS



"No-one got everything done by Friday except Robinson Crusoe...
 
What is the format of this report (txt, doc, rtf, ...) ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi, thanks - it's just an .rtf

(My firewall prevents my uploading)

"No-one got everything done by Friday except Robinson Crusoe...
 
We use Lotus Notes and to-date, I was unable to send via Lotus Notes using automation.

What I have done to automate the mail process is use the following code:
Code:
Function SendEmail(strTo, strMessage, strAttach, strSubject, strBCC)
Dim objemail As Object

Set objemail = CreateObject("CDO.Message")
       objemail.FROM = "<EmailAddress@toreceive.replies.net>"
       objemail.To = strTo
      ' objEmail.BCC = strBCC
       objemail.Subject = strSubject
       objemail.textbody = strMessage
       If strAttach <> "" Then objemail.AddAttachment strAttach
      objemail.Configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
      objemail.Configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "<mailserver.name.goes.here>"
      objemail.Configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
      objemail.Configuration.Fields.Update
      objemail.Send
      Set objemail = Nothing

End Function

You can hardcode your sbj (subject) and bod (body) variables to hardcode a message and it could use rst!<FieldName> as variables in the message.

Then I just do
Code:
X = SendEmail(rst!UserID, bod, "", sbj, "")

Important piece is to make sure you can relay your mail through the mailserver. Likely you would need to talk to someone who maintains the mailserver.
 
Oh, forgot to mention....in the X=SendEmail code, the third field is for attachments. Use the full path.
 
platypus71
Hi, thanks for that.

"No-one got everything done by Friday except Robinson Crusoe...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top