feat(inout): 물류센터 이메일 옵션 · 입고 저장 뒤 입고 요청 메일(Gmail, 본문 안 사진 600px)
- 옵션 → 물류센터 탭: 물류센터 담당자 이메일·입고 요청 메일 참조(기본 king@·bj@dbxcorp.co.kr) - 입고 저장 → 미리보기 팝업 바로 → [메일 발송](입고 담당 본인 Gmail), 입고 기록 줄 보내기/다시 보내기 - 제목 "[입고 요청] yyyy년 mm월 dd일(요일) 입고 요청 합니다.", 본문 = 전산 등록 부탁 + 상품 이름·코드·입고 수량·비고 표 - 입고증 사진은 첨부가 아니라 본문 안 이미지(CID multipart/related), 가로 최대 600px·비율 유지로 줄임 - Gmail 연결 권한을 발주 담당 → 발주·입고 담당으로 - 마이그레이션 inout_db 005(inout_settings·inout_receipt_mails), 초기화 SQL 에도 반영 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,7 +140,9 @@ def access_token(refresh_token: str) -> str:
|
||||
|
||||
|
||||
def build_message(*, sender_name: str, sender_email: str, to: list[str], cc: list[str], subject: str,
|
||||
text: str, html: str) -> bytes:
|
||||
text: str, html: str, inline_images: list[dict[str, Any]] | None = None) -> bytes:
|
||||
"""글 + HTML(multipart/alternative). inline_images = [{cid, data(JPEG)}] 면 HTML 쪽을 multipart/related 로 만들어
|
||||
<img src="cid:…"> 가 첨부가 아니라 본문 안 이미지로 보이게 한다(입고 요청 메일, 2026-10-19)."""
|
||||
msg = EmailMessage()
|
||||
msg["From"] = formataddr((sender_name or sender_email, sender_email))
|
||||
msg["To"] = ", ".join(to)
|
||||
@@ -149,6 +151,10 @@ def build_message(*, sender_name: str, sender_email: str, to: list[str], cc: lis
|
||||
msg["Subject"] = subject
|
||||
msg.set_content(text)
|
||||
msg.add_alternative(html, subtype="html")
|
||||
if inline_images:
|
||||
html_part = msg.get_payload()[1]
|
||||
for im in inline_images: # 파일 이름은 붙이지 않는다 — 메일 프로그램이 첨부 목록에 따로 띄우지 않게
|
||||
html_part.add_related(im["data"], maintype="image", subtype="jpeg", cid=f"<{im['cid']}>", disposition="inline")
|
||||
return msg.as_bytes()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user