13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
-
-
-
-
+
|
use std::{
borrow::Cow,
collections::{
HashMap,
HashSet,
},
io::Error,
};
use async_std::{
sync::Arc,
task,
};
use mailin_embedded::{
Response,
response::{
INTERNAL_ERROR,
INVALID_CREDENTIALS,
NO_MAILBOX,
OK
|
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
|
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
-
+
|
self.data.append(buf.to_vec().as_mut());
Ok(())
}
/// Attempt to send email, return temporary error if that fails
fn data_end (&mut self) -> Response {
let mut result = OK;
task::block_on(async {
smol::block_on(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:?}");
|