Hi, I have some code that take email addresses from a table and inserts them into a reminder email we send out to our patients.
The problem is I need to hide the email addresses so they are not listed for all the receivers to see. I searched the forum but can't find any code that is like mine.
here's my code:
I had alot of help building this code and I'm afraid to break it by changing something.....
thanks!
The problem is I need to hide the email addresses so they are not listed for all the receivers to see. I searched the forum but can't find any code that is like mine.
here's my code:
Code:
Function SendMail()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strEmail As String
Dim strbody As String
Dim strESubject As String
Dim fso As Object
Dim f As Object
Dim ts As Object
' Return reference to current database.
Set dbs = CurrentDb
'Find record to send report of
strSQL = "SELECT EmailName " & _
"FROM email2infopromisedtbl"
Set rst = dbs.OpenRecordset(strSQL)
If rst.BOF And rst.EOF Then
rst.Close
Set rst = Nothing
Set dbs = Nothing
Exit Function
End If
strEmailname = ""
Do While Not rst.EOF
strEmailname = strEmailname & rst("Emailname") & ";"
rst.MoveNext
Loop
strEmail = Left(strEmailname, Len(strEmailname) - 1)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("\\server\leads\scripts_etc\emailIP.txt")
Set ts = f.OpenAsTextStream(1, -2) 'ForReading, TristateUseDefault
strbody = ts.ReadAll
ts.Close
Set ts = Nothing
Set f = Nothing
Set fso = Nothing
strESubject = "Reminder from LSI"
' send email.
DoCmd.SendObject acSendNoObject, "", acFormatTXT, strEmail, , , strESubject, strbody, False
rst.Close
Set rst = Nothing
Set dbs = Nothing
End Function
I had alot of help building this code and I'm afraid to break it by changing something.....
thanks!