Outlook, meerdere mailadressen in BCC

Status
Niet open voor verdere reacties.

samabert

Gebruiker
Lid geworden
27 mrt 2010
Berichten
301
Hallo,

Hoe kan de code aangepast worden om onder strBCC meerdere mailadressen te vermelden.
De code werkt wel met 1 mailadres in strBCC.

Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objRecip As Recipient
    Dim strMsg As String
    Dim res As Integer
    Dim strBcc As String
    On Error Resume Next
    If Item.SenderEmailAddress = "test@info.be" Then
        strBcc = "mail@info.be"   '  + 12 andere mailadressen
        Set objRecip = Item.Recipients.Add(strBcc)
        objRecip.Type = olBCC
        If Not objRecip.Resolve Then
            strMsg = "Could not resolve the Bcc recipient. " & _
                     "Do you want still to send the message?"
            res = MsgBox(strMsg, vbYesNo, _
                     "Could Not Resolve Bcc Recipient")
            If res = vbNo Then
                Cancel = True
            End If
        End If
    End If
End Sub

Alvast bedankt.
Marc
 
Zet de adressen gescheiden door een ; in de string.
 
edmoor,

Ik heb volgende getest en dit werkt niet. "abc@info.be; cba@info.be"
Ik krijg de message: "Could Not Resolve Bcc Recipient")
Met 1 mailadres werkt het wel.
 
Je moet dan die adressen per stuk resolven.
 
Ofwel doe ik het verkeerd ofwel is er toch nog iets anders dat niet juist is. Het werkt niet, enkel met 1 mailadres is er geen probleem.
Volgende krijg ik uiteindelijk te zien.

BCC.JPG

De mailadressen die ik gebruik in BCC, zijn mailadressen die in Outlook adresboek staan.
 
Doe het eens zo:
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim arrRecip() As Recipient
    Dim strMsg As String
    Dim i As Integer
    Dim arrEmails()
    
    arrEmails = Array("abc@info.be", "cba@info.be", "a@.com") [COLOR="#008000"]'Hier kan je meer adressen toevoegen[/COLOR]
     
    ReDim arrRecip(UBound(arrEmails))
    For i = 0 To UBound(arrEmails)
        Set arrRecip(i) = Item.Recipients.Add(arrEmails(i))
        arrRecip(i).Type = olBCC
        
        If Not arrRecip(i).Resolve Then
            strMsg = "Could not resolve the Bcc recipient. " & arrRecip(i) & vbCrLf & "Do you want still to send the message?"
            If MsgBox(strMsg, vbYesNo + vbDefaultButton1, "Could Not Resolve Bcc Recipient") = vbNo Then
                Cancel = True
            End If
        End If
        
        Set arrRecip(i) = Nothing
    Next i
End Sub
 
Super! Dit doet zijn werk :thumb:

Bedankt voor jouw hulp.
Mvg.
Marc
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan