184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
}
};
*/
if body.is_empty() && text_parts > 0 {
let text = mail.body_text(0)
.context("Failed to extract text from message")?
.replace("\r\n", "\n");
// 6:
// - (headers)
// - (mail text)
// - 6: </pre>
if text.len() < 4096 - ( reply.len() + 6 ) {
body = text;
text_num = 1;
}
};
let msg = format!("{}{}</pre>", reply, validate(&body).stack()?);
// and let's collect all other attachment parts
let mut files_to_send = vec![];
/*
* let's just skip html parts for now, they just duplicate text?
while html_num < html_parts {
files_to_send.push(mail.html_part(html_num).stack()?);
|
>
|
|
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
}
};
*/
if body.is_empty() && text_parts > 0 {
let text = mail.body_text(0)
.context("Failed to extract text from message")?
.replace("\r\n", "\n");
let text = validate(&text).stack()?;
// 6:
// - (headers)
// - (mail text)
// - 6: </pre>
if text.len() < 4096 - ( reply.len() + 6 ) {
body = text.to_string();
text_num = 1;
}
};
let msg = format!("{}{}</pre>", reply, body);
// and let's collect all other attachment parts
let mut files_to_send = vec![];
/*
* let's just skip html parts for now, they just duplicate text?
while html_num < html_parts {
files_to_send.push(mail.html_part(html_num).stack()?);
|
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
fn data_end (&mut self) -> Response {
let mut result = OK;
smol::block_on(Compat::new(async {
// relay mail
if let Err(err) = self.relay_mail().await {
result = INTERNAL_ERROR;
// in case that fails - inform default recipient
if let Err(err) = self.tg.debug(&format!("Sending emails failed:\n{err:?}")).await {
// in case that also fails - write some logs and bail
eprintln!("{err:?}");
};
};
}));
// clear - just in case
self.data = vec![];
self.headers = None;
result
}
}
|
|
|
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
fn data_end (&mut self) -> Response {
let mut result = OK;
smol::block_on(Compat::new(async {
// relay mail
if let Err(err) = self.relay_mail().await {
result = INTERNAL_ERROR;
// in case that fails - inform default recipient
if let Err(err) = self.tg.debug(&format!("Sending emails failed:\n{err:}")).await {
// in case that also fails - write some logs and bail
eprintln!("{err:?}");
};
};
}));
// clear - just in case
self.data = vec![];
self.headers = None;
result
}
}
|