GET/users/{userId}/mail/{mailId}

메일을 읽는다.

참고

  • 인라인 이미지
    • 메일본문에서 cid:reddotiVBORw0KGgoAAAA 이런 문자열을 있으면 첨부 파일 정보에서 메일본문에 cid와 같은 값의 data로 변경해서 인라인 이미지 처리해야 이미지가 깨지지 않고 노출된다.
  • 예제) 메일 본문을 아래처럼 치환해야 한다.
    • AS-IS : <img src='cid:reddotiVBORw0KGgoAAAA' alt='Red dot' >
    • TO-BE : <img src='data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==' alt='Red dot' />
    • 메일 발송 시, 다시 <img src=\"cid:reddotiVBORw0KGgoAAAA\" alt=\"Red dot\" /> 치환해야한다. (RFC 2387)
      • RFC 2387: https://www.rfc-editor.org/rfc/rfc2387"

Authorization

oauth2

OAuth 2.0 인증.
자세한 인증 방식은 인가·인증를 참고한다.

Scope

mail
mail.read

HTTP Request

GEThttps://www.worksapis.com/v1.0/users/{userId}/mail/{mailId}

Path Parameters

ParameterTypeDescription
userId string 

구성원 ID (URL인코딩하여 사용)

  • User ID
  • Login ID(email)
  • 자기자신(me)

required
example : me 
mailId string 

메일 ID


required
example : 1 

Query Parameters

ParameterTypeDescription
hasThreads boolean 

주고받은 메일 묶음 조회 여부


default : false
allowEmptyValue : true 
threadCount integer 

주고받은 메일 묶음을 조회할 개수


default : 5
minimum : 0
maximum : 400
format : int32
allowEmptyValue : true 

Header Parameters

HeadertypeDescription
Authorization string 

Bearer {token}


required 

Response

HTTP 200

OK

PropertyTypeDescription
mail object (mail) 

메일


required 
attachments array (AttachmentFile) 

첨부 파일 정보


required
minItems : 0 
threads array (Threads) 
 

mail

PropertyTypeDescription
mailId integer 

메일 ID


required
format : int64 
folderId integer 

메일함 ID


required
format : int32 
status integer 

메일 상태

  • 0x4L: 읽음(현재 상태)
  • 0x8L: 답장을 보냄
  • 0x10L: 전달함
  • 0x20L: 중요 메일로 표시함
  • 0x100L: 보낸 메일임
  • 0x800L: 상대방이 읽음
  • 0x1000L: 다운로드 기한이 있는 파일이 첨부된 메일
  • 0x40000L: 답장을 받은 메일
  • 0x00200000L: 내가 수신자로 설정되어 있는 메일
  • 0x00400000L: 일정 메일

메일 상태(status)는 bit AND 연산자로 구해야 한다.
메일의 읽음 여부를 확인하는 코드 예는 다음과 같다.

public boolean IsRead(long status) {  return 0x4L == (0x4L & status);}

required
format : int64 
from object (from) 

메일 정보


required 
replyTo object (replyTo) 

메일 정보

 
to array (MailAddress) 

받는사람


required
minItems : 1 
cc array (MailAddress) 

참조


minItems : 0 
bcc array (MailAddress) 

숨은참조


minItems : 0
uniqueItems : true 
subject string 

메일 제목


required
minLength : 1
maxLength : 180 
body string 

메일 내용


required
minLength : 1 
receivedTime string 

메일 수신 시간


required
example : 2021-07-16T19:20:30+09:00 
sentTime string 

메일 발송 시간


required
example : 2021-07-16T19:20:30+09:00 
size integer 

메일 크기 (단위 : byte)


required
format : int32 
securityLevel string 

메일의 보안 등급

  • General: 일반(기본값)
  • Restricted: 대외비
  • Confidential: 기밀
  • Non-business: 업무외

default : General
Allowed values : General, Restricted, Confidential, Non-business 
securityDeleteDate string 

보안 메일 삭제 예정일

 
useForwarding boolean 

재전송 가능 여부


default : true 
charset string 

읽을 때 사용할 charset

 
spamType string 

스팸 분류 코드

  • SYSTEM_DEFINE: 시스템 분류 기준
  • USER_DEFINE: 사용자 분류 기준
  • USER_REPORT: 사용자가 스팸으로 보고
  • USER_MOVE: 사용자가 스팸메일함으로 이동
  • NORMAL: 일반 메일

Allowed values : SYSTEM_DEFINE, USER_DEFINE, USER_REPORT, USER_MOVE, NORMAL 
spamTypeDetail string 

스팸 상세 설명

 

from

PropertyTypeDescription
name string 

메일 이름

 
email string 

메일 주소 (RFC822 format)


required
minLength : 1 

replyTo

PropertyTypeDescription
name string 

메일 이름

 
email string 

메일 주소 (RFC822 format)


required
minLength : 1 

MailAddress

PropertyTypeDescription
name string 

메일 이름

 
email string 

메일 주소 (RFC822 format)


required
minLength : 1 

AttachmentFile

PropertyTypeDescription
attachmentId integer 

첨부 파일 ID
첨부 파일의 종류에 따라 콘텐츠 검색 방법이 다르다.

  • 양수 : 일반 첨부 파일
    첨부 파일 다운로드 사용
  • -1 : 다운로드 기한이 있는 파일
    bigFileFid 참조
  • -2 : 인라인 이미지
    메일 읽기 설명 참조

required
format : int32 
contentType string 

첨부 파일의 contentType


required 
charset string 

파일의 charset


nullable : true 
filename string 

파일명


required
minLength : 1
maxLength : 250 
encoding string 

파일의 인코딩


nullable : true 
size integer 

파일 크기 (단위는 bytes)


required
format : int32 
bigFileExpireTime string 

다운로드 기한이 있는 파일의 유효 기간

 
bigFileFid string 

다운로드 기한이 있는 파일의 fid

  • https://bigfile.mail.worksmobile.com/download?fid= 형태로 다운로드 기한이 있는 파일을 다운로드할 수 있다.
 
cid string 

Content-ID (인라인 이미지에 사용하는 cid)


nullable : true 
contentDisposition string 

Content-Disposition

  • inline : 인라인 이미지
  • attachment+ : 첨부 파일

Allowed values : inline, attachment 
data string 

인라인 이미지 데이터 (Base64로 인코딩된 데이터)


nullable : true 

Threads

PropertyTypeDescription
mailId integer 

메일 ID


required
format : int64 
folderId integer 

메일함 ID


required
format : int32 
status string 

메일 상태

  • Unread: 안 읽은 메일
  • Read: 읽은 메일

required 
from object (from) 

메일 정보


required 
replyTo object (replyTo) 

메일 정보

 
to array (MailAddress) 

받는사람


required
minItems : 1 
cc array (MailAddress) 

참조(주고받은 메일 묶음에서는 항상 빈값)


minItems : 0 
bcc array (MailAddress) 

숨은참조(주고받은 메일 묶음에서는 항상 빈값)


minItems : 0
uniqueItems : true 
subject string 

메일 제목


required
minLength : 1
maxLength : 180 
receivedTime string 

메일 수신 시간


required
example : 2021-07-16T19:20:30+09:00 
sentTime string 

메일 발송 시간


required
example : 2021-07-16T19:20:30+09:00 
size integer 

메일 크기(단위: byte)


required
format : int32 
securityLevel string 

메일의 보안 등급

  • General: 일반(기본값)
  • Restricted: 대외비
  • Confidential: 기밀
  • Non-business: 업무외

default : General
Allowed values : General, Restricted, Confidential, Non-business 
useForwarding boolean 

재전송 가능 여부


default : true 
attachCount integer 

첨부 파일 개수

 
preview string 

미리보기용 텍스트

 
isImportant boolean 

메일을 쓸 때 중요 메일 여부(메일 제목에 빨간 느낌표 표시)

 

Response Example

example

1{2  "attachments": [3    {4      "attachmentId": 1,5      "contentType": "image/jpeg",6      "charset": null,7      "filename": "file1.jpg",8      "encoding": null,9      "size": 919,10      "bigFileExpireTime": "",11      "bigFileFid": ""12    },13    {14      "attachmentId": 2,15      "contentType": "image/jpeg",16      "charset": null,17      "filename": "file2.jpeg",18      "encoding": null,19      "size": 253,20      "bigFileExpireTime": "2022-10-27T00:02:01+09:00",21      "bigFileFid": "RwnmKqg9FAumKwYZHqUmHqUmKoumFxKwKxvmKquqHqurKoKmFqblaxvj1XUwHqg9aAM/axI0Fov9axpCMobqp6FSazEZaACSFA34aAUd&rl=24101"22    }23  ],24  "mail": {25    "mailId": 76285,26    "folderId": 6,27    "status": 4101,28    "from": {29      "name": "works",30      "email": "works@example.com"31    },32    "replyTo": {33      "name": "reply",34      "email": "reply@example.com"35    },36    "to": [37      {38        "name": "admin",39        "email": "admin@example.com"40      }41    ],42    "cc": [43      {44        "name": "admin",45        "email": "admin@example.com"46      }47    ],48    "bcc": [49      {50        "name": "admin",51        "email": "admin@example.com"52      }53    ],54    "subject": "메일 제목",55    "body": "메일 본문",56    "receivedTime": "2022-10-27T00:02:01+09:00",57    "sentTime": "2022-10-27T00:02:01+09:00",58    "size": 1290078,59    "securityLevel": "General",60    "securityDeleteDate": "",61    "useForwarding": true,62    "charset": "",63    "spamType": "NORMAL",64    "spamTypeDetail": "NORMAL"65  },66  "threads": [67    {68      "mailId": 22715,69      "folderId": 0,70      "status": "Read",71      "from": {72        "name": "admin",73        "email": "admin@example.com"74      },75      "to": [76        {77          "name": "admin",78          "email": "admin@example.com"79        }80      ],81      "subject": "메일제목",82      "receivedTime": "2025-04-09T20:19:07+09:00",83      "sentTime": "2025-04-09T20:19:07+09:00",84      "size": 14452,85      "securityLevel": "General",86      "useForwarding": true,87      "attachCount": 0,88      "preview": "",89      "isImportant": true90    }91  ]92}

HTTP 400

Bad Request