do not add empty mime parts, fixes #51

This commit is contained in:
Aine
2022-11-17 23:11:11 +02:00
parent 99a89ef87a
commit 66bd1a4fab
3 changed files with 21 additions and 3 deletions

View File

@@ -430,6 +430,10 @@ func (b *Bot) runSend(ctx context.Context) {
for _, to := range tos {
email := utils.NewEmail(ID, "", " "+ID, subject, from, to, body, htmlBody, nil)
data := email.Compose(b.getBotSettings().DKIMPrivateKey())
if data == "" {
b.SendError(ctx, evt.RoomID, "email body is empty")
return
}
queued, err := b.Sendmail(evt.ID, from, to, data)
if queued {
b.log.Error("cannot send email: %v", err)