?
Solved

From Access: How to determine the email address of the CC's in an incoming email in Outllok

Posted on 2011-02-10
6
Medium Priority
?
418 Views
Last Modified: 2012-05-11
Hi,
I am using Access VBA to import incoming emails from an Outlook 2000 inbox into an Access 2007 database.
I have used redemption to determine the email address of the sender, and this is working fine.
Now I need to determine the email address of any cc's (recipients who were carbon copied on the email).
Can someone help me out with the code needed to do this?
I'm not sure if I need to use Redemption for this like I do for the sender's email address or if I can do it using Outlook. (I can't use CDO)
I've attached the code using Redemption to get the sender's email, but I don't understand how to alter this to get the cc's.
thanks.
Paul

Function R_GetSenderAddress(objMsg)
  Dim strType
  Dim objSenderAE ' Redemption.AddressEntry
  Dim objSMail    ' Redemption.SafeMailItem
  Const PR_SENDER_ADDRTYPE = &HC1E001E
  Const PR_EMAIL = &H39FE001E

  Set objSMail = CreateObject("Redemption.SafeMailItem")
  objSMail.Item = objMsg
  strType = objSMail.Fields(PR_SENDER_ADDRTYPE)
  Set objSenderAE = objSMail.Sender
  If Not objSenderAE Is Nothing Then
    If strType = "SMTP" Then
      R_GetSenderAddress = objSenderAE.Address
    ElseIf strType = "EX" Then
      R_GetSenderAddress = objSenderAE.Fields(PR_EMAIL)
    End If
   End If

   Set objSenderAE = Nothing
   Set objSMail = Nothing
End Function

Open in new window

0
Comment
Question by:LearningToProgram
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 34870045
Hi, Paul.

Something like this should get the job done.  I'm not in a position to test this right now as I don't have a computer available that has Redemption loaded.
Function R_GetCCAddresses(objMsg As Outlook.MailItem) As String
    Dim objSMail    ' Redemption.SafeMailItem
    Dim objRecip
    Set objSMail = CreateObject("Redemption.SafeMailItem")
    objSMail.Item = objMsg
    For Each objRecip In objSMail.Recipients
        If objRecip.Type = olCC Then
            R_GetCCAddresses = R_GetCCAddresses & objRecip.Address & ","
        End If
    Next
    If Len(R_GetCCAddresses) > 0 Then
        R_GetCCAddresses = Mid(R_GetCCAddresses, 1, Len(R_GetCCAddresses) - 1)
    End If
    Set objRecip = Nothing
    Set objSMail = Nothing
End Function

Open in new window

0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34870072
I would think you can use objSMail to get them along the lines of:

for each recip in objSMail.recipients
    debug.print recip.address
next

YOu will need to consider each as SMTP or exchange as for the from but in terms of getting the root data it should be that easy.

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34870088
JUst ignore me, morning David!

Chris
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Expert Comment

by:David Lee
ID: 34871285
Good morning, Chris!  Well, probably more like afternoon for you.
0
 

Author Closing Comment

by:LearningToProgram
ID: 34889905
thanks! that worked perfectly!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34890094
You're welcome.  Happy I could be of service.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question