KostyaEsmukov/smtp_to_telegram

Whoa! Very Cool..

bcookatpcsd opened this issue · 4 comments

Just found this on docker hub.. can't wait to try it out..

I just wanted to ask.. is there a local queue? If I use the smtpd as part of an nms.. and the link from me to TG is down.. does the smtp_to_telegram accept responsibility for it and then when the link is up, pass the data to the bot?

Thanks in advance regardless.. this is just way cool to even think about..

From my own experience, if smtp_to_telegram has problems with TG, it just discards the message.

There is no queue, and there are no silent message discards either.

When a request to Telegram API is unsuccessful, the smtp message is rejected with a 5xx error:

return backends.NewResult(fmt.Sprintf("554 Error: %s", err)), err

func TestTelegramUnreachable(t *testing.T) {
smtpConfig := makeSmtpConfig()
telegramConfig := makeTelegramConfig()
d := startSmtp(smtpConfig, telegramConfig)
defer d.Shutdown()
err := smtp.SendMail(smtpConfig.smtpListen, nil, "from@test", []string{"to@test"}, []byte(`hi`))
assert.NotNil(t, err)
}

A decent smtp client should enqueue the message on its side and retry later. If your sender doesn't do that, you can put a queueing MTA in front of smtp_to_telegram, such as exim4.