유효한 이메일 주소를 가진 사용자에게 채팅 요약 이메일이 건너뛰어지고 있습니다:
분석을 해본 결과, 그 원인을 파악했습니다:
결국 건너뛰기가 발생하는 위치는 다음과 같습니다:
그 이유는 message.to가 비어 있기 때문입니다.
message.to가 비어 있는 이유는 send_user_email에 전달되는 인자에 to_address가 포함되어 있지 않고, 이는 사용자의 기본 이메일로 보강되지 않기 때문입니다. 예를 들어:
args: {"type"=>"chat_summary", "user_id"=>3, "force_respect_seen_recently"=>true, "current_site_id"=>"default"}
args[:type] = args[:type].to_s
send_user_email(args)
if args[:type] == "digest"
# Record every attempt at sending a digest email, even if it was skipped
UserStat.where(user_id: args[:user_id]).update_all(digest_attempted_at: Time.current)
end
end
def send_user_email(args)
post = nil
notification = nil
type = args[:type]
user = User.find_by(id: args[:user_id])
to_address =
args[:to_address].presence || user&.primary_email&.email.presence || "no_email_found"
set_skip_context(type, args[:user_id], to_address, args[:post_id])
return skip(SkippedEmailLog.reason_types[:user_email_no_user]) if !user
이것은 Chat Mailer에 의해 호출되며, to_address가 누락되어 있음을 확인할 수 있습니다:
return unless SiteSetting.chat_enabled
User
.real
.activated
.not_staged
.not_suspended
.where(id: users_with_unreads)
.find_each do |user|
if DiscoursePluginRegistry.apply_modifier(:chat_mailer_send_summary_to_user, true, user)
Jobs.enqueue(
:user_email,
type: "chat_summary",
user_id: user.id,
force_respect_seen_recently: true,
)
end
end
end
private
그것은 괜찮을 수 있지만, send_user_email의 상단에 도달할 때쯤이면 to_address가 사용자 이메일로 보강되어 있어야 한다고 생각합니다. 그렇게 하면 전달될 때 이메일러가 이 프로퍼티에 액세스할 수 있어 이메일 전송이 성공합니다.
send_user_email에 이 작은 몽키 패치를 추가했을 때 문제가 사라졌습니다:
# CORE BUG: to_address를 설정하지 않으면 결국 이메일이 전송되지 않고 건너뛰어집니다.
# 이것은 핵심 버그이며 Meta에서 이를 제기해야 합니다.
if args[:to_address].blank? && user&.primary_email&.email
args[:to_address] = user&.primary_email&.email
end
2개의 좋아요
sam
(Sam Saffron)
3월 9, 2025, 11:07오후
2
@merefield , 디버깅에 감사드립니다. 멤버 XP가 곧 이 문제를 확인하도록 하겠습니다.
2개의 좋아요
davidb
(David B)
5월 26, 2025, 3:23오후
7
이 부분에 대해 조금 조사해 보았는데, 추적해 보면 enrichment가 이루어져야 합니다:
처음으로 여기 의 emailer에서 시작하여, 사용자 알림 확장자를 호출 하고, 여기 에서 사용자 이메일로 enrichment를 한 후, 여기 의 build email 헬퍼로 전달하고, 마지막으로 전송 전에 여기 의 메시지 빌더에서 주소를 설정합니다.
그 외 다른 사이트에서는 채팅 요약 이메일이 이미 정상적으로 작동하고 있으므로, 여기서는 다른 원인이 문제를 일으키고 있을 가능성이 큽니다.
중간 해결책으로, 작업(job)에 사용자 이메일을 전달하는 것이 좋다고 생각합니다. 이렇게 하면 처음부터 올바른 데이터가 있는지 조금 더 확신하고 가시성을 높일 수 있을 것입니다:
committed 03:19PM - 26 May 25 UTC
Pass user email rather than relying on enrichment when sending summary
emails.
3개의 좋아요
j.jaffeux
(Joffrey Jaffeux)
에 닫힘
6월 29, 2025, 9:47오후
8
수정에 대한 피드백을 받지 못했으므로 닫겠습니다.