Naver Mail Imap logo

Naver Mail Imap

Community
bam-bam-2
naver-mail-imap

밤밤의 네이버 메일(you@example.com)을 브라우저 없이 읽어야 할 때 사용. 네이버 웹 세션이 만료돼 로그인 화면으로 튕기거나, 메일 본문·첨부파일(대용량 첨부 포함)을 그대로 받아와야 할 때. "메일 확인해줘", "회신 왔어?" 요청에서 웹 로그인이 막히면 이 경로로 우회한다.

Overview

Publisherbam-bam-2
Repositorysolo-skills
Skill namenaver-mail-imap
Stars
366
Forks
87
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by bam-bam-2 on GitHub. Read the source before you install it.

Installation

Install the Naver Mail Imap AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/bam-bam-2/solo-skills/tree/main/skills/naver-mail
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bam-bam-2/solo-skills.git /tmp/solo-skills
mkdir -p .claude/skills
cp -r /tmp/solo-skills/skills/naver-mail .claude/skills/naver-mail-imap
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Naver Mail Imap in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Naver Mail Imap on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Naver Mail Imap is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

이 스킬이 시스템에 하는 일 (설치 전 확인)

  • 네이버 IMAP/SMTP 서버에 접속해 메일을 읽고 보냅니다.
  • 계정 정보는 .env에서만 읽습니다. 코드에 값을 넣지 말고, 애플리케이션 비밀번호를 발급해 쓰세요.
  • 자격증명을 출력하거나 다른 파일로 복사하지 않습니다.

네이버 메일 IMAP 읽기

네이버 웹메일은 세션이 자주 만료되고, 만료되면 저장된 비밀번호가 없어 로그인 화면에서 막힌다. 앱 비밀번호가 이미 .env에 있으므로 IMAP으로 바로 붙는 게 빠르다.

자격증명 위치

~/Projects/getback/운영/.env
~/Projects/getback/운영/서초aict-웰커밍데이/.env

키 이름: NAVER_MAIL_USER, NAVER_MAIL_APP_PASSWORD (GET100 레터 발송용으로 세팅된 것)

⚠️ 값을 출력하거나 다른 파일로 복사하지 말 것. 스크립트 안에서만 읽어 쓴다.

접속

imap.naver.com:993 SSL. 표준 imaplib이면 충분하다.

python
import imaplib, email
from email.header import decode_header
from pathlib import Path

env = {}
for p in [Path('.env'), Path('서초aict-웰커밍데이/.env')]:
    if p.exists():
        for line in p.read_text().splitlines():
            if '=' in line and not line.strip().startswith('#'):
                k, v = line.split('=', 1)
                env.setdefault(k.strip(), v.strip().strip('"').strip("'"))

M = imaplib.IMAP4_SSL('imap.naver.com', 993)
M.login(env['NAVER_MAIL_USER'], env['NAVER_MAIL_APP_PASSWORD'])
M.select('INBOX')

자주 쓰는 조회

python
# 발신자로 검색 (한글 검색어는 인코딩 이슈가 있으니 이메일 주소로 찾는 게 안전)
typ, data = M.search(None, 'FROM', '"someone@example.com"')
ids = data[0].split()

# 헤더만 빠르게 (읽음 처리 안 되게 BODY.PEEK)
typ, d = M.fetch(ids[-1], '(BODY.PEEK[HEADER.FIELDS (FROM SUBJECT DATE)])')

# 전문 + 첨부
typ, d = M.fetch(ids[-1], '(RFC822)')
msg = email.message_from_bytes(d[0][1])

제목·파일명은 반드시 decode_header로 디코드한다(MIME 인코딩).

첨부파일

일반 첨부는 part.get_filename() + part.get_payload(decode=True)로 바로 저장된다.

대용량 첨부(네이버 "대용량 첨부")는 본문에 안 들어 있다. HTML 파트에서 링크를 뽑아 따로 받아야 한다.

python
import re
fids = re.findall(r'bigfile\.mail\.naver\.com/download\?fid=([^"\'&<>\s]+)', html)
# 중복 제거 후 각각:
# https://bigfile.mail.naver.com/download?fid=<urlencode한 fid>

이 링크는 REPL 전역 fetch(사용자 쿠키 사용)로 받으면 200으로 그냥 떨어진다. fid 값에 +, /, = 가 들어가므로 반드시 encodeURIComponent로 감싼다. 파일 개수가 안 맞으면 HTML에서 fid를 다시 전부 뽑아 중복 제거할 것(같은 파일이 mybox 링크로도 중복 등장한다).

첨부파일 달아 답장 보내기 (SMTP)

브라우저 없이 바로 보낼 수 있다. 스레드로 묶으려면 원본의 Message-ID를 IMAP으로 먼저 가져와 In-Reply-To·References에 넣는다. 이걸 빼면 상대 메일함에서 별도 메일로 떨어진다.

python
import smtplib, ssl, mimetypes, imaplib, email
from email.message import EmailMessage
from email.utils import formataddr, make_msgid

# 1) 원본 Message-ID 확보
M.select('INBOX', readonly=True)
typ, d = M.fetch(uid, '(BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])')
orig_id = email.message_from_bytes(d[0][1]).get('Message-ID')

# 2) 메일 조립
msg = EmailMessage()
msg['From'] = formataddr(('밤밤', USER))
msg['To'] = '상대@example.com'
msg['Subject'] = '...'
msg['Message-ID'] = make_msgid(domain='naver.com')
msg['In-Reply-To'] = orig_id
msg['References'] = orig_id
msg.set_content(body)

data = att.read_bytes()
maintype, subtype = (mimetypes.guess_type(att.name)[0] or 'application/octet-stream').split('/', 1)
msg.add_attachment(data, maintype=maintype, subtype=subtype, filename=att.name)

# 3) 발송 — 네이버는 465(SSL)로 떨어진다
s = smtplib.SMTP_SSL('smtp.naver.com', 465, context=ssl.create_default_context(), timeout=30)
s.login(USER, PW); s.send_message(msg); s.quit()

보낸 뒤 보낸메일함("Sent Messages")을 열어 파트 구조를 확인한다. BODYSTRUCTURE 정규식은 한글 파일명을 놓치는 경우가 있으니, RFC822로 받아 msg.walk() 로 돌면서 get_filename() 과 바이트 수를 직접 본다. (2026-08-28 양주시 강의계획서 발송 시 실측)

주의

  • 읽기 전용으로 쓴다. 삭제·이동은 하지 않는다.
  • 큰 메일을 연속으로 RFC822 페치하면 socket error: EOF로 연결이 끊긴다. 목록은 BODY.PEEK[HEADER.FIELDS ...]로 훑고, 전문은 필요한 건만 받는다.
  • 글자수를 셀 때 wc -m을 쓰지 않는다. 비대화형 SSH엔 로케일이 없어 한글이 바이트로 세져 약 1.9배로 부풀린다. 파이썬 len()으로 쟴 것.
  • 웹 로그인이 필요한 작업(메일 쓰기 UI, 설정 변경)은 여전히 밤밤이 직접 로그인해야 한다.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Naver Mail Imap AI skill do?

밤밤의 네이버 메일(you@example.com)을 브라우저 없이 읽어야 할 때 사용. 네이버 웹 세션이 만료돼 로그인 화면으로 튕기거나, 메일 본문·첨부파일(대용량 첨부 포함)을 그대로 받아와야 할 때. "메일 확인해줘", "회신 왔어?" 요청에서 웹 로그인이 막히면 이 경로로 우회한다.

Why use Naver Mail Imap on TypingMind?

Because you install it once and use it with any model. Naver Mail Imap is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Naver Mail Imap in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/bam-bam-2/solo-skills/tree/main/skills/naver-mail. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Naver Mail Imap?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Naver Mail Imap?

As many as you like. As long as a model supports skills, you can use Naver Mail Imap with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Naver Mail Imap AI skill free?

Yes. It is published on GitHub by bam-bam-2 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇