Emailing report

B

Bryan

I have managed to email through my Lotus Notes, but I need to be able to send
to recipients based on a query, i.e., all the names contained in a particular
record. I have written the query, but after dozens of attempts, still cannot
figure out how to implement it. Secondly, although I can send a generic file
with a generic location, I cannot figure out how to send the specific report,
(Based on the record number.) I am including what I have. Please help!!!
Thanks, Bryan

Private Sub sendemail_Click()
Dim Recipients As String, strBody As String
Dim SendTo As String, attachpath As String
Dim Session As Object, db As Object, doc As Object, rtitem As Object, tmp As
Object

'On Error GoTo Err_SendEMail

'Sets up Notes Session and opens the mail database
Set Session = CreateObject("Notes.Notessession")
Set db = Session.GetDatabase("", "")
Call db.OPENMAIL
Recipients = "Bryan Daniels"

'Creates the mail document, sets the body, sendto, and Subject fields
Set doc = db.CreateDocument
Set rtitem = doc.CreateRichTextItem("body")

strBody = "Message"
Call rtitem.AppendText(strBody)
Call rtitem.AddNewLine(2)

'Here is the way to attach a file
Set tmp = rtitem.EmbedObject(1454, "", "c:\temp\picture.gif")
Call doc.replaceitemvalue("SendTo", Recipients)

Call doc.replaceitemvalue("Subject", "PLEASE IMPLEMENT NEW ECN")
Call doc.Send(False)

MsgBox ("Message has been sent.")
Set Session = Nothing

Exit_SendEMail:
Set Session = Nothing
Set db = Nothing
Exit Sub

Err_SendEMail:
MsgBox Err.Description
Resume Exit_SendEMail

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top