|
-
Oct 10th, 2002, 02:34 PM
#1
Thread Starter
Lively Member
Email problem
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
-
Oct 10th, 2002, 02:48 PM
#2
VB Code:
MAPIMessages.RecipIndex = 0
MAPIMessages.RecipDisplayName = Objrst!UserName: ' If the name resolves in the exchange
MAPIMessages.RecipIndex = 1
MAPIMessages.RecipDisplayName = Objrst!UserEmailAddress: ' for external mail
something tells me it is here...
you are adding 2 recipents each time.. I am guessing that for your Howard Kline record UserName and UserEmailAddress are the same data..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|