Private Sub Email_Test_Click()
'---=== Send Mail Code - START ===---
'Dim mail
'Set mail = Nothing
' Send by connecting to port 25 of the SMTP server.
'Dim iMsg
'Dim iConf
Dim strTo As String, rsTo As Recordset
'Dim strCC As String, rsCC As Recordset
'Dim strBCC As String, rsBCC As Recordset
'Dim Flds
'Dim strHTML
Set rsTo = CurrentDb.OpenRecordset("Select * FROM [PERD Security Access] WHERE [EDS Net ID] ='zzpzdc'")
'Const cdoSendUsingPort = 2
'Set iMsg = CreateObject("CDO.Message")
'Set iConf = CreateObject("CDO.Configuration")
'Set rsTo = CurrentDb.OpenRecordset("Select [PERD Security Access].[Email Address], [Email List].To, [Email List].[AR Code Group] FROM [PERD Security Access] INNER JOIN [Email List] ON [PERD Security Access].[EDS Net ID] = [Email List].[EDS Net ID] WHERE ((([Email List].To)=True) AND (([Email List].[AR Code Group])= '" & [AR Group] & "))")
'---=== Handle rs strings & recordsets - START ===---
'With rsTo
' .MoveFirst
'Do
' strTo = strTo & ![Email Address] & ";"
' .MoveNext
'Loop Until .EOF
' strTo = Left(strTo, Len(strTo) - 1)
' .Close
'End With
'---=== Handle rs strings & recordsets - END ===---
'Set Flds = iConf.Fields
' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
'With Flds
' .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
' .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "usahm204.amer.corp.eds.com"
' .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
' .Update
'End With
' Build HTML for message body.
'strHTML = "<HTML>"
'strHTML = strHTML & "<HEAD>"
'strHTML = strHTML & "<BODY>"
'strHTML = strHTML & "This is an automated e-mail to let you know that <b><font color=#FF0000>" & [Name of Requestor] & "</b></font> from <b><font color=#FF0000>" & [Department of Requestor] & "</b></font> has submitted a new <b><font color=#FF0000>A/R " & [A/R Code] & "</b></font> request in PERD."
'strHTML = strHTML & "</BODY>"
'strHTML = strHTML & "</HTML>"
'==== A/R Code Group - 1 - START ====
'If [AR Group] = 1 Then
' Apply the settings to the message.
'With iMsg
' Set .Configuration = iConf
' .To = strTo 'ToDo: Enter a valid email address. "<Diane.Nastasia@examhub.exch.eds.com>;<M.Derivois@examhub.exch.eds.com>"
'.Cc = "<Deborah.Davis@examhub.exch.eds.com>"
'.Bcc = "<Jason.Boney@examhub.exch.eds.com>" '<Carlene.Vitello@examhub.exch.eds.com>,
' .From = "PERD Request<Jason.Boney@eds.com>" 'ToDo: Enter a valid email address.
' .Subject = "New A/R " & [A/R Code] & " Request - TEST"
' .HTMLBody = strHTML
' .Send
'End With
'==== A/R Code Group - 1 - END ====
'End If
' Clean up variables.
'Set iMsg = Nothing
'Set iConf = Nothing
Set rsTo = Nothing
'Set Flds = Nothing
'---=== Send Mail Code - END ===---
'MsgBox "Your request has been submitted!" & vbCrLf & vbCrLf & "Your request will be completed shortly" & vbCrLf & vbCrLf & "-Database Admin", vbInformation, "Request Submitted"
MsgBox "Test Complete"
End Sub