메일 서비스(사이트 대표·독립)·메일함·사용량·보안·전환·보존과 AriMail 도입 수정(KST 월 경계, 발신 키 오류, 도메인별 보장량, 100% 제한, 발송 큐·속도, 운영 상태, SSO) (§15~§18·§0.4)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
a014e3cd05
commit
a1cde81332
@@ -23,7 +23,8 @@ import net from 'node:net';
|
||||
import tls from 'node:tls';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { verifyUser, audit } from './auth.mjs';
|
||||
import { sendMail } from './providers/index.mjs';
|
||||
import { sendMail, outboundMode } from './providers/index.mjs';
|
||||
import { submit } from './sendqueue.mjs';
|
||||
import { normalizeCrlf } from './mime.mjs';
|
||||
import { parseMime, summarize, header, parseAddresses, decodeWords } from './imap-mime.mjs';
|
||||
import { appendMessage, setFlag } from './store.mjs';
|
||||
@@ -87,7 +88,8 @@ function limitReply(e) {
|
||||
case 'attachment_too_large': return new SmtpError(552, '5.3.4', `Attachment exceeds the size limit (${e.limit} bytes after MIME encoding)`);
|
||||
case 'quota_exceeded': return new SmtpError(452, '4.2.2', 'Mailbox full (quota exceeded), free space and try again');
|
||||
case 'storage_full': return new SmtpError(452, '4.3.1', 'Insufficient system storage');
|
||||
case 'monthly_limit_exceeded': return new SmtpError(550, '5.7.1', `Monthly message limit reached (${e.limit})`);
|
||||
case 'monthly_limit_exceeded': return new SmtpError(550, '5.7.1', `Monthly message limit reached (${e.limit})${e.resetAt ? ', resets at ' + e.resetAt : ''}`);
|
||||
case 'mail_domain_frozen': return new SmtpError(451, '4.3.2', 'Mail domain is being migrated, try again later'); // [Ariweb Suite 변경] 이전 중·동결
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +108,11 @@ function limitReply(e) {
|
||||
* @throws {SmtpError} 클라이언트에 돌려줄 SMTP 오류
|
||||
*/
|
||||
export async function submitMessage(env, user, { mailFrom = '', rcpt = [], eml, ip = '' }) {
|
||||
if (!env.RESEND_API_KEY) throw new SmtpError(451, '4.3.0', 'Mail service temporarily unavailable, try again later');
|
||||
// [Ariweb Suite 변경] 오류 수정: Resend 키는 발신 방식이 resend 일 때만 필요합니다. 예전에는 Haraka·외부 SMTP 중계를 쓰는 도메인도 키가 없으면 451 로 모든 제출이 거부됐습니다.
|
||||
if (outboundMode(env) === 'resend' && !env.RESEND_API_KEY) throw new SmtpError(451, '4.3.0', 'Mail service temporarily unavailable, try again later');
|
||||
// [Ariweb Suite 변경] 제출 속도 제한(§17.2): 계정·IP 가 초당 10건 이상이면 임시 거부하고 악용 확인 표에 남깁니다.
|
||||
const th = await submit(env, ['account:' + user.mailbox, ...(ip ? ['ip:' + ip] : [])]);
|
||||
if (th.throttled) throw new SmtpError(451, '4.7.0', `Submission rate limit reached, try again after ${th.until}`);
|
||||
const raw = normalizeCrlf(eml);
|
||||
let parsed, info;
|
||||
try { parsed = parseMime(raw); info = summarize(parsed); } catch { throw new SmtpError(550, '5.6.0', 'Malformed message'); }
|
||||
|
||||
Reference in New Issue
Block a user