使用 vbscript 提取电子邮件地址而不是 CC 的电子邮件名称?

Extract email address instead of email name of the CC using vbscript?

我正在编写一个 VBScript 来从电子邮件中提取抄送。当我提取抄送而不是电子邮件地址时,它会显示此人的电子邮件名称。我在提取 "from" 地址时遇到了同样的问题。我检查了发件人 (.SenderEmailType) 的电子邮件地址类型是 SMTP 还是 EX,并且能够获取电子邮件地址而不是电子邮件名称。我不知道如何为 CC 做同样的事情。网上查了一下,写的是循环"Mailitems.Recipent"。我是 vbscript 的新手,我不知道该怎么做。目前我正在使用 .CC 对象来获取抄送详细信息。

Set Arg = WScript.Arguments
dim item1
dim objsubject 
dim intcount
Dim i 
dim savename 
dim vTextFile
dim filename 
dim extension
Dim t
Dim Itimestamp 
dim savefolder 
Dim vSenderEmailAddress
Dim vCcEmailAddress
Dim vFlagTextFileCreate


vFlagTextFileCreate = True
savefolder = "C:\Users\tgssupport\Documents\Automation Anywhere Files\Automation Anywhere\My Scripts\Retro Pricing\junk"
vTextFile = savefolder & "\File Report.txt"
vFlagExcelAttachmentFound = False
Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err.Number <> 0 Then    'Could not get instance of Outlook, so create a new one
   Err.Clear
   Set olApp = CreateObject("Outlook.Application")
End If
on error goto 0
Set olns = olApp.GetNameSpace("MAPI")
olns.logon "Outlook",,False,True
'6 is for Inbox
Set objFolder = olns.GetDefaultFolder(6)
For each item1 in objFolder.Items

  if item1.Unread=true then
    objsubject = item1.subject
      vCcEmailAddress = item1.CC
      If item1.SenderEmailType = "SMTP" Then
               vSenderEmailAddress = item1.SenderEmailAddress
      ElseIf item1.SenderEmailType = "EX" Then
               vSenderEmailAddress = item1.Sender.GetExchangeUser.PrimarySmtpAddress
      End If 'If item1.SenderEmailType
      msgbox vCcEmailAddress.
      msgbox vSenderEmailAddress.
  end if 'if item1.Unread=true
Next
olns.logoff
Set olns  = Nothing
Set olApp = Nothing
WScript.Quit
With item1.Recipients
    For i = 1 To .Count
        If .Item(i).Type = OlMailRecipientType.olCC Then
            vCcEmailAddress = .Item(i).Address
            Exit For
        End If
    Next i
End With
Set objFolder = olns.GetDefaultFolder(6)
For each item1 in objFolder.Items      
   For Each RecipientObject In item1.Recipients
      If RecipientObject.Type = 2 Then
      msgbox RecipientObject.Address
      End if
   Next
Next