Sending mail with VBA in BCC field

E

Eric van der Niet

Hello,

Hope someone can help. Im using this code to send a mail to some of my
clients:

Set Outmail = ActiveDocument.MailEnvelope.item

With Outmail
.Subject = InputBox("Voer hier het onderwerp van de email in:",
"Onderwerp")
End With

Dim Message, Title, Default, MyValue
Message = "Naar welk type emailadressen wilt u de e-mail versturen" & vbCr &
"1 - Zakelijke emailadressen" & vbCr & "2 - Privé emailadressen" & vbCr &
"3 - Privé & Zakelijke emailadressen"
Title = "Selecteer type emailadressen"
MyValue = InputBox(Message, Title)

Select Case MyValue
Case 1
With rstTemp
While Not .EOF
If rstTemp.Fields("email priv") <> "" Then
Outmail.AddRecipient rstTemp.Fields("email priv")
lijst = rstTemp.Fields("email priv")

enz.enz

You can see im using the AddRecipient method to add recepients to the To
list. My question is: How can i add adresses to the BCC field, I don't want
that my customers can see each others emailadresses... Hope someone can
help..

Eric van der Niet
 
Z

zkid

Where are the addressees' names coming from? It's a bit difficult to tell
from your code.

If the email addresses are contained in a Contacts folder, a Word table, an
Excel spreadsheet or an Access database, you can use Word's mail merge
feature to merge to email and it will send a separate message to each
addressee (you can personalize the email also with each person's name, etc.).
You just need to tell it in which field the email address is located. You
will also need to download the free Click Yes/No program to get around
numerous security prompts.

If that doesn't make you happy, then I don't believe you can use
AddRecipient to plug in names to the bcc field. I think you will need to
loop through all of the names one by one and use something like:
Outmail.bcc = [recipient1]
Outmail.bcc = [recipient2]
.... and so on for each addressee.

or, the following came from Sue Mosher's website (she is THE expert on all
things Outlook - http://www.outlookcode.com):

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objMe As Recipient
Set objMe = Item.Recipients.Add("(e-mail address removed)")
objMe.Type = olBCC
objMe.Resolve
Set objMe = Nothing
End Sub

The above code can be found at: http://www.outlookcode.com/d/code/autobcc.htm

Please keep in mind that some email servers will reject an incoming email
that states "Recipient list suppressed," which is what Outlook plugs into the
To: field when there are no names therein.

Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top