feat(email): add thread_id field to EmailAddedToFolder

This commit is contained in:
rustmailer
2025-08-18 00:54:41 +08:00
parent 1b8fc39037
commit f838e66018
3 changed files with 6 additions and 0 deletions
+2
View File
@@ -774,6 +774,7 @@ async fn process_email_added_events(
) -> RustMailerResult<()> {
for fetch in fetches {
let envelope = extract_envelope(fetch, account.id, &remote.name)?;
let thread_id = envelope.compute_thread_id();
let message_content = match envelope.body_meta {
Some(sections) => {
let request = MessageContentRequest {
@@ -823,6 +824,7 @@ async fn process_email_added_events(
.attachments
.as_ref()
.map(|atts| atts.iter().cloned().map(Attachment::from).collect()),
thread_id,
}),
),
))
+1
View File
@@ -185,6 +185,7 @@ impl RustMailerEvent {
html: Some(String::from("<p>Welcome to use rustmailer!</p>")),
},
thread_name: Some("Meeting Thread".into()),
thread_id: id!(64),
reply_to: Some(vec![addr("reply@example.com")]),
to: Some(vec![addr("recipient@example.com")]),
attachments: Some(vec![Attachment {
+3
View File
@@ -44,6 +44,9 @@ pub struct EmailAddedToFolder {
pub subject: Option<String>,
/// Content of the email, including body and related metadata.
pub message: MessageContent,
/// The identifier of the thread this email belongs to.
/// This is computed based on `in_reply_to` / `references` / `message_id`.
pub thread_id: u64,
/// Optional name of the thread to which the email belongs.
pub thread_name: Option<String>,
/// Optional list of reply-to addresses for the email.