143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
.ok_or(anyhow!("Missing default address in recipient table."))?);
};
// prepating message header
let mut reply: Vec<Cow<'_, str>> = vec![];
if self.fields.contains("subject") {
if let Some(subject) = mail.subject() {
reply.push(format!("**Subject:** `{}`", subject).into());
} else if let Some(thread) = mail.thread_name() {
reply.push(format!("**Thread:** `{}`", thread).into());
}
}
if self.fields.contains("from") {
reply.push(format!("**From:** `{}`", headers.from).into());
}
if self.fields.contains("date") {
if let Some(date) = mail.date() {
reply.push(format!("**Date:** `{}`", date).into());
}
}
reply.push("".into());
let header_size = reply.join("\n").len() + 1;
let html_parts = mail.html_body_count();
let text_parts = mail.text_body_count();
let attachments = mail.attachment_count();
if html_parts != text_parts {
self.debug(format!("Hm, we have {} HTML parts and {} text parts\\.", html_parts, text_parts)).await?;
}
|
|
|
>
>
|
|
|
|
|
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
.ok_or(anyhow!("Missing default address in recipient table."))?);
};
// prepating message header
let mut reply: Vec<Cow<'_, str>> = vec![];
if self.fields.contains("subject") {
if let Some(subject) = mail.subject() {
reply.push(format!("__*Subject:*__ `{}`", subject).into());
} else if let Some(thread) = mail.thread_name() {
reply.push(format!("__*Thread:*__ `{}`", thread).into());
}
}
let mut short_headers: Vec<Cow<'_, str>> = vec![];
// do we need to replace spaces here?
if self.fields.contains("from") {
short_headers.push(format!("__*From:*__ `{}`", headers.from).into());
}
if self.fields.contains("date") {
if let Some(date) = mail.date() {
short_headers.push(format!("__*Date:*__ `{}`", date).into());
}
}
reply.push(short_headers.join(" ").into());
let header_size = reply.join(" ").len() + 1;
let html_parts = mail.html_body_count();
let text_parts = mail.text_body_count();
let attachments = mail.attachment_count();
if html_parts != text_parts {
self.debug(format!("Hm, we have {} HTML parts and {} text parts\\.", html_parts, text_parts)).await?;
}
|