Hi,
I have an email program to send message to a user.
The email works great but I get two of the same name in the "To" section of the email: To Kline, Howard;Kline, Howard
Is there a way to prevent this from occuring?
Thanks,
<Here is the function>
Function SendEmail(ByVal userid As String, ByVal Message As String) As Boolean
Dim Objrst As ADODB.Recordset
Dim strSQL As String
On Error GoTo TrapError
SendEmail = True
strSQL = "Select UserName,UserEmailAddress from Users" & _
" Where userisdeleted = 0 and UserID ='" & userid & "'"
Set Objrst = GetRecordSet(strSQL, adOpenStatic, adLockReadOnly)
MAPISession.UserName = Objrst!UserName
MAPISession.Action = 1
MAPIMessages.SessionID = MAPISession.SessionID
MAPIMessages.Action = 6
MAPIMessages.MsgSubject = "DCS Notification "
MAPIMessages.MsgNoteText = Message
MAPIMessages.RecipIndex = 0
MAPIMessages.RecipDisplayName = Objrst!UserName: ' If the name resolves in the exchange
MAPIMessages.RecipIndex = 1
MAPIMessages.RecipDisplayName = Objrst!UserEmailAddress: ' for external mail
MAPIMessages.Action = 13
MAPIMessages.RecipType = 1
MAPIMessages.Action = 3
MAPISession.Action = 2
MAPIMessages.SessionID = MAPISession.SessionID
Exit Function
TrapError:
If (Err > 32000) And (Err < 32060) Then
Screen.MousePointer = vbNormal
MsgBox "Logon Failure: " + Error$
End If
SendEmail = False
End Function
