Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 11th, 2013, 12:53 AM
Registered User
Join Date: Jan 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need code to set up different auto BCC settings for seperate emails

I am currently using Outlook 2010 with Visual Basic 7.0 installed. I have multiple emails set up on my profile that I need to have access to for wrk. I am trying to set up each email so that it bcc's itself. For example:
When I send an email from abc@joe.ca, I want the auto bcc to go to abc@joe.ca. When I send an email from xyz@joe.ca, I want an email to automatically be bcc'd to xyz@joe.ca.
This is the basic code I am currently using. Regardless of the email account I send an email from, the bcc is always "abc@joe.ca".

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

' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "josh@spurrell.ca"

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 + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If

Set objRecip = Nothing
End Sub
Is there a way I can manipulate this code or do I need to set up a seperate profile for each of my individual emails?

Help? :-)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto generate get and set methods jdang67 .NET Framework 2.0 10 January 16th, 2008 08:20 AM
objCDO.bCc with multi emails xxsuperfly Classic ASP Databases 1 December 31st, 2006 01:34 PM
Auto Emails From Access SparrowCathy Access 6 April 6th, 2006 08:14 PM
Code to send emails maitias C# 2005 2 February 1st, 2006 01:09 PM
Seperate Code JsonTerre1 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 7th, 2004 04:38 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.