Skip to main content

Kutools for Office — 하나의 패키지. 다섯 가지 도구. 더 많은 일을 처리하세요.

아웃룩에서 하나 또는 여러 이메일로부터 발신자의 이메일 주소를 어떻게 가져올 수 있나요?

Author Siluvia Last modified

아웃룩에서 받은 한 개 이상의 이메일 "보낸 사람" 필드에서 이메일 주소를 추출해 본 적이 있나요? 이 기사에서는 이를 처리하는 데 도움을 줄 VBA 코드를 제공합니다.


아웃룩에서 하나 또는 여러 이메일로부터 발신자의 이메일 주소 가져오기

다음 VBA 코드를 실행하여 아웃룩에서 받은 한 개 이상의 이메일 "보낸 사람" 필드에서 이메일 주소를 추출하세요.

1. 이메일 폴더를 열고, 발신자의 이메일 주소를 가져오려는 이메일 메시지를 선택하세요. Alt + F11 키를 눌러 Microsoft Visual Basic for Applications 창을 엽니다.

참고: 여러 이메일을 선택하려면 Ctrl 키를 누른 상태로 이메일을 하나씩 선택하세요.

2. Microsoft Visual Basic for Applications 창에서 삽입 > 모듈을 클릭한 다음, 다음 VBA 코드를 모듈(코드) 창에 복사하세요.

steps on getting the sender’s email address from one or more emails in Outlook

VBA 코드: 아웃룩에서 하나 또는 여러 이메일로부터 발신자의 이메일 주소 추출하기

Sub GetSmtpAddressOfSelectionEmail()
  Dim xExplorer As Explorer
  Dim xSelection As Selection
  Dim xItem As Object
  Dim xMail As MailItem
  Dim xAddress As String
  Dim xFldObj As Object
  Dim FilePath As String
  Dim xFSO As Scripting.FileSystemObject
  On Error Resume Next
  Set xExplorer = Application.ActiveExplorer
  Set xSelection = xExplorer.Selection
  For Each xItem In xSelection
    If xItem.Class = olMail Then
      Set xMail = xItem
      xAddress = xAddress & VBA.vbCrLf & "  " & GetSmtpAddress(xMail)
    End If
  Next
  If MsgBox("Sender SMTP Address is: " & xAddress & vbCrLf & vbCrLf & "Do you want to export the address list to a txt file? ", vbYesNo, "Kutools for Outlook") = vbYes Then
    Set xFldObj = CreateObject("Shell.Application").BrowseforFolder(0, "Select a Folder", 0, 16)
    Set xFSO = New Scripting.FileSystemObject
    If xFldObj Is Nothing Then Exit Sub
    FilePath = xFldObj.Items.Item.Path & "\Address.txt"
    Close #1
    Open FilePath For Output As #1
    Print #1, "Sender SMTP Address is: " & xAddress
    Close #1
    Set xFSO = Nothing
    Set xFldObj = Nothing
    MsgBox "Address list has been exported to:" & FilePath, vbOKOnly + vbInformation, "Kutools for Outlook"
  End If
End Sub
Function GetSmtpAddress(Mail As MailItem)
  Dim xNameSpace As Outlook.NameSpace
  Dim xEntryID As String
  Dim xAddressEntry As AddressEntry
  Dim PR_SENT_REPRESENTING_ENTRYID As String
  Dim PR_SMTP_ADDRESS As String
  Dim xExchangeUser As exchangeUser
  On Error Resume Next
  GetSmtpAddress = ""
  Set xNameSpace = Application.Session
  If Mail.sender.Type <> "EX" Then
    GetSmtpAddress = Mail.sender.Address
  Else
    PR_SENT_REPRESENTING_ENTRYID = "http://schemas.microsoft.com/mapi/proptag/0x00410102"
    xEntryID = Mail.PropertyAccessor.BinaryToString(Mail.PropertyAccessor.GetProperty(PR_SENT_REPRESENTING_ENTRYID))
    Set xAddressEntry = xNameSpace.GetAddressEntryFromID(xEntryID)
    If xAddressEntry Is Nothing Then Exit Function
    If xAddressEntry.AddressEntryUserType = olExchangeUserAddressEntry Or xAddressEntry.AddressEntryUserType = olExchangeRemoteUserAddressEntry Then
      Set xExchangeUser = xAddressEntry.GetExchangeUser()
      If xExchangeUser Is Nothing Then Exit Function
      GetSmtpAddress = xExchangeUser.PrimarySmtpAddress
    Else
      PR_SMTP_ADDRESS = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
      GetSmtpAddress = xAddressEntry.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS)
    End If
  End If
End Function

3. 도구 > 참조를 클릭하고, 참조 – Project1 대화 상자에서 Microsoft Scripting Runtime 항목을 체크하세요.

steps on getting the sender’s email address from one or more emails in Outlook

4. F5 키를 눌러 코드를 실행합니다. 그러면 Kutools for Outlook 대화 상자가 나타나며, 선택된 이메일들의 모든 발신자 이메일 주소가 나열됩니다.

참고:

주소록을 txt 파일로 내보내야 하는 경우, 버튼을 클릭하세요.
또는 아니요 버튼을 클릭하여 프로세스를 종료하세요.
steps on getting the sender’s email address from one or more emails in Outlook

5. 버튼을 클릭한 후, 폴더 찾아보기 대화 상자가 나타납니다. 파일을 저장할 폴더를 선택하고 확인 버튼을 클릭하세요.

steps on getting the sender’s email address from one or more emails in Outlook

6. 마지막으로, Kutools for Outlook 대화 상자가 나타나 내보낸 파일의 경로를 알려줍니다. 확인을 클릭하여 닫으세요.

steps on getting the sender’s email address from one or more emails in Outlook

7. 내보낸 파일이 저장된 폴더로 이동하여 Address라는 이름의 .txt 파일을 열어 선택된 이메일들의 발신자 이메일 주소를 확인하세요.

steps on getting the sender’s email address from one or more emails in Outlook

최고의 오피스 생산성 도구

속보: Kutools for Outlook 무료 버전 출시!

새롭게 달라진 Kutools for Outlook에서100가지 이상의 놀라운 기능을 경험해보세요! 지금 다운로드하세요!

🤖 Kutools AI : 첨단 AI 기술을 활용해 이메일을 손쉽게 처리합니다. 회신, 요약, 최적화, 확장, 번역, 작성까지 모두 지원합니다.

📧 이메일 자동화: 자동 응답(POP 및 IMAP 지원) / 이메일 보내기 예약 / 이메일 전송 시 규칙별 자동 참조/숨은 참조 / 자동 전달(고급 규칙) / 자동 인사말 추가 / 여러 수신자 이메일을 개별 이메일로 자동 분할 ...

📨 이메일 관리: 이메일 회수 / 제목 및 기타 기준으로 의심스러운 이메일 차단 / 중복 이메일 삭제 / 고급 검색 / 폴더 정리 ...

📁 첨부 파일 프로: 일괄 저장 / 일괄 분리 / 일괄 압축 / 자동 저장 / 자동 분리 / 자동 압축 ...

🌟 인터페이스 매직: 😊더 예쁘고 다양한 이모지 / 중요한 이메일이 오면 알림 / Outlook 종료 대신 최소화 ...

👍 원클릭 기능: 모두 회신 (첨부 파일 포함) / 피싱 방지 이메일 / 🕘보낸 사람의 시간대 표시 ...

👩🏼‍🤝‍👩🏻 연락처 및 캘린더: 선택한 이메일에서 연락처 일괄 추가 / 연락처 그룹을 개별 그룹으로 분할 / 생일 알림 제거 ...

원하는 언어로 Kutools를 사용하세요 – 영어, 스페인어, 독일어, 프랑스어, 중국어 및40가지 이상을 지원합니다!

한 번의 클릭으로 Kutools for Outlook을 즉시 활성화하세요. 기다리지 말고 지금 다운로드하여 업무 효율을 높여보세요!

kutools for outlook features1 kutools for outlook features2

🚀 원클릭 다운로드 — 모든 Office 추가 기능 받기

강력 추천: Kutools for Office (5-in-1)

한 번의 클릭으로 다섯 종류의 설치 파일을 동시에 다운로드하세요 — Kutools for Excel, Outlook, Word, PowerPointOffice Tab Pro. 지금 다운로드하세요!

  • 원클릭 편리함: 다섯 가지 설치 패키지를 단 한 번에 다운로드할 수 있습니다.
  • 🚀 모든 Office 작업에 바로 준비 완료: 필요한 추가 기능을 원하는 때에 설치하세요.
  • 🧰 포함됨: Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint