Results 1 to 2 of 2

Thread: Email problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    San Jose
    Posts
    70

    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

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    VB Code:
    1. MAPIMessages.RecipIndex = 0
    2. MAPIMessages.RecipDisplayName = Objrst!UserName: ' If the name resolves in the exchange
    3. MAPIMessages.RecipIndex = 1
    4. 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
  •  



Click Here to Expand Forum to Full Width