~bigbes/core-go

ref: 79dad627f9fe97a3c57609de87a9641a7aae9693 core-go/email/send.go -rw-r--r-- 3.1 KiB
db4d67a2 — Robin Jarry 1 year, 7 months ago
email: fix empty emails sent on retries

io.Reader objects can only be consumed once. On retry, re-reading from
them will return 0 bytes all the time.

Change NewTask to take in a bytes array instead of a reader. Create
a new reader on each retry.

Also remove SendRaw which has an inherent issue related to retry as
well. message.Entity is virtually a reader that can only be consumed
once.

Update EnqueueRaw to take a bytes array directly and have it call
NewTask() like EnqueueStd does.

Fixes: 78cfc5d87a7d ("email: allow sending raw emails")
Signed-off-by: Robin Jarry <robin@jarry.cc>
78cfc5d8 — Robin Jarry 1 year, 8 months ago
email: allow sending raw emails

The current email.Enqueue() function only allows sending messages with
the server's default settings.

In order to support sending any arbitrary message, we need to expose
a lower level API taking a raw message.Entity pointer. This new API will
be reused in a future reimplementation of the lists.sr.ht ingress agent
to forward messages to subscribers.

Add email.EnqueueRaw() that calls email.SendRaw(). Retry sending 10
times in the case of failure.

Signed-off-by: Robin Jarry <robin@jarry.cc>
bbcb2a10 — Robin Jarry 1 year, 8 months ago
email: keep smtp client connection alive

Instead of connecting and disconnecting each and every time we need to
send an email, keep the SMTP connection alive attached to a context
variable.

Before sending an email, check if the connection is still valid and
reconnect if it is not.

Signed-off-by: Robin Jarry <robin@jarry.cc>
069c77be — Drew DeVault 2 years ago
email: update StartTLS usage per go-smtp changes
f762ad22 — Peter Sanchez 4 years ago
Bugfix, mail config placed in wrong setting.
31e77bac — Peter Sanchez 4 years ago
Add support for mail setups that don't support TLS or Auth
f44afb10 — Simon Ser 4 years ago
go fmt
606ff2ef — Drew DeVault 5 years ago
Sign outgoing emails
9af62068 — Drew DeVault 5 years ago
email: remove leftover debug code
0c651498 — Drew DeVault 5 years ago
Add email work queue