IMAP, POP, SMTP
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Gmail은 Gmail이 아닌 클라이언트의 경우 표준 IMAP, POP, SMTP 프로토콜을 지원합니다. Gmail IMAP, POP, SMTP 서버가 업계 표준 OAuth 2.0 프로토콜을 통한 승인을 지원하도록 확장되었습니다.
프로토콜
IMAP, POP, SMTP는 기본 네이티브 IMAP AUTHENTICATE
, POP AUTH
, SMTP AUTH
명령어를 사용하여 사용자를 인증하는 표준 Simple Authentication and Security Layer (SASL)을 사용합니다. SASL XOAUTH2 메커니즘을 사용하면 클라이언트가 인증을 위해 OAuth 2.0 사용자 인증 정보를 제공할 수 있습니다. SASL XOAUTH2 프로토콜 문서에는 SASL XOAUTH2 메커니즘이 매우 자세히 설명되어 있으며 프로토콜을 구현한 라이브러리 및 샘플을 사용할 수 있습니다.
imap.gmail.com:993
의 IMAP 서버와 pop.gmail.com:995
의 POP 서버에 대한 수신 연결에는 SSL이 필요합니다. 발신 SMTP 서버(smtp.gmail.com
)는 TLS를 지원합니다. 클라이언트가 일반 텍스트로 시작하는 경우 STARTTLS 명령어를 실행하기 전에 포트 465
(SSL용) 또는 포트 587
(TLS용)를 사용합니다.
세션 길이 제한
Gmail POP 세션은 약 7일로 제한됩니다. Gmail IMAP 세션은 약 24시간으로 제한됩니다. OAuth 사용자 인증 정보를 사용하여 세션이 인증된 경우 사용된 액세스 토큰의 유효 기간 (일반적으로 1시간)으로 제한됩니다. 이 맥락에서 세션은 하나의 연속적인 TCP 연결입니다.
시간이 지나 세션이 만료되면 Gmail은 세션이 만료되었다는 메시지와 함께 연결을 닫습니다. 그런 다음 클라이언트는 다시 연결하고 다시 인증한 후 계속할 수 있습니다. OAuth를 사용하는 경우 사용된 액세스 토큰이 유효한지 확인하세요 (1시간이 지난 액세스 토큰을 사용하려고 하면 유효하지 않을 수 있음).
라이브러리 및 샘플
IMAP 또는 POP를 사용하여 메일에 액세스하고 SMTP를 사용하여 메일을 보내는 작업은 편의를 위해 기존 IMAP 및 SMTP 라이브러리를 사용하여 수행되는 경우가 많습니다. 이러한 라이브러리가 Simple Authentication and Security Layer (SASL)을 지원하는 한 Gmail에서 지원하는 SASL XOAUTH2 메커니즘과 호환되어야 합니다.
SASL XOAUTH2 프로토콜 문서 외에도 OAuth 2.0 클라이언트 구현에 관한 자세한 내용은 OAuth 2.0을 사용하여 Google API에 액세스를 참고하세요.
라이브러리 및 샘플 페이지에서는 IMAP 또는 SMTP와 함께 SASL XOAUTH2 메커니즘을 사용하는 다양한 인기 언어로 된 코드 샘플을 제공합니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-29(UTC)
[null,null,["최종 업데이트: 2025-08-29(UTC)"],[],[],null,["# IMAP, POP, and SMTP\n\nFor non-Gmail clients, Gmail supports the standard IMAP, POP, and SMTP protocols. The Gmail IMAP, POP, and SMTP servers have been extended to support authorization via the industry-standard OAuth 2.0 protocol.\n\nProtocol\n--------\n\nIMAP, POP, and SMTP use the standard [Simple Authentication and Security Layer (SASL)](https://tools.ietf.org/html/rfc4422), using the built-in the native IMAP `AUTHENTICATE`, POP `AUTH`, and SMTP `AUTH` commands, to authenticate users. The SASL XOAUTH2 mechanism enables clients to provide OAuth 2.0 credentials for authentication. The [SASL XOAUTH2 protocol documentation](/workspace/gmail/imap/xoauth2-protocol) describes the SASL XOAUTH2 mechanism in great detail, and [libraries and samples](/workspace/gmail/imap/xoauth2-libraries) which have implemented the protocol are available.\n\nIncoming connections to the IMAP server at `imap.gmail.com:993` and the POP server at `pop.gmail.com:995` require SSL. The outgoing SMTP server, `smtp.gmail.com`, supports TLS. If your client begins with plain text, before issuing the STARTTLS command, use port `465` (for SSL), or port `587` (for TLS).\n\nSession length limits\n---------------------\n\nGmail POP sessions are limited to about 7 days. Gmail IMAP sessions are limited to about 24 hours. If the session was authenticated using OAuth credentials, it's limited to about the validity period of the access token used (usually 1 hour). A session in this context is one continuous [TCP connection](https://en.wikipedia.org/wiki/Transmission_Control_Protocol).\n\nWhen the time elapses and the session expires, Gmail closes the connection with a message saying that the session expired. After that, the client can reconnect, authenticate again, and continue. If using OAuth, make sure that the access token used is valid (if you try to use an access token older than 1 hour, it might be invalid).\n\nLibraries and Samples\n---------------------\n\nAccessing mail using IMAP or POP and sending mail using SMTP is often done using existing IMAP and SMTP libraries for convenience. As long as these libraries support the [Simple Authentication and Security Layer (SASL)](https://tools.ietf.org/html/rfc4422), they should be compatible with the SASL XOAUTH2 mechanism supported by Gmail.\n\nIn addition to the SASL XOAUTH2 [protocol documentation](/workspace/gmail/imap/xoauth2-protocol), you may also want to read [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/OAuth2) for further information on implementing an OAuth 2.0 client.\n\nThe [Libraries and Samples](/workspace/gmail/imap/xoauth2-libraries) page provides code samples in a variety of popular languages using the SASL XOAUTH2 mechanism with either IMAP or SMTP."]]