fix(marketing): honest send-result wording — queued counts, mail_log is source of truth

sentCount tallies async queue submissions, so SMTP failures (e.g. the
2026-07-14 MailAuthenticationException) were invisible in the response.
Meta now says 'N queued, see send history' for both test and live paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
zio 2026-07-14 06:57:12 +09:00
parent b3d3a5588c
commit e47fb0f8aa

View File

@ -128,9 +128,10 @@ public class MarketingService {
sentOk++;
}
skipped += eligible; // 대상 전원 이번엔 미발송(테스트)
// sentOk 적재(시도) 건수 실제 SMTP 성공/실패는 비동기라 mail_log 정본(2026-07-14 인증실패 사례).
String meta = testTo.isEmpty()
? "테스트(dry-run): 대상 " + eligible + "명 · 실발송 없음"
: "테스트 발송: 테스트 수신함 " + sentOk + " · 실대상 " + eligible + "명 미발송";
: "테스트 발송 요청: 테스트 수신함 " + sentOk + " 큐 적재(결과는 발송 이력 참조) · 실대상 " + eligible + "명 미발송";
// 상태 미전이(draft/scheduled 유지) 테스트는 캠페인을 소진하지 않는다.
mapper.markCampaignResult(eventId, campaignId, status, sentOk, skipped, failed, true, meta);
return new CampaignSendResult(campaignId, status, true, mailEnabled,
@ -169,9 +170,9 @@ public class MarketingService {
int remaining = skipped - overCap - failed; // rate cap 잔여
String newStatus = remaining > 0 ? "sending" : "done";
String meta = mailEnabled
? "발송 " + sentOk + " (대상 " + eligibleTotal + ""
? "발송 요청 " + sentOk + " 큐 적재 (대상 " + eligibleTotal + ""
+ (remaining > 0 ? " · 잔여 " + remaining + "" : "")
+ (overCap > 0 ? " · 상한초과 " + overCap + "" : "") + ")"
+ (overCap > 0 ? " · 상한초과 " + overCap + "" : "") + " · 결과는 발송 이력 참조)"
: "발송 대상 " + sentOk + "건 (MAIL 비활성 — 실 전송 없음)";
mapper.markCampaignResult(eventId, campaignId, newStatus, sentOk, skipped, failed, false, meta);
return new CampaignSendResult(campaignId, newStatus, false, mailEnabled,