From 80cea134375dee002cbc0276934ffbcad1544bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Fri, 24 Apr 2026 13:38:00 +0200 Subject: [PATCH] v0.0.634 add ReplyTo to googleapi.SendMail --- go.mod | 4 ++-- go.sum | 4 ++++ goextVersion.go | 4 ++-- googleapi/mimeMessage.go | 5 ++++- googleapi/mimeMessage_test.go | 4 ++++ googleapi/sendMail.go | 4 ++-- googleapi/sendMail_test.go | 4 ++++ googleapi/service.go | 2 +- 8 files changed, 23 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index ae8a797..943ae7b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/glebarez/go-sqlite v1.22.0 // only needed for tests -.- github.com/jmoiron/sqlx v1.4.0 github.com/rs/xid v1.6.0 - github.com/rs/zerolog v1.35.0 + github.com/rs/zerolog v1.35.1 go.mongodb.org/mongo-driver v1.17.9 golang.org/x/crypto v0.50.0 golang.org/x/sys v0.43.0 @@ -64,7 +64,7 @@ require ( github.com/xuri/efp v0.0.1 // indirect github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect - go.mongodb.org/mongo-driver/v2 v2.5.0 // indirect + go.mongodb.org/mongo-driver/v2 v2.5.1 // indirect golang.org/x/arch v0.26.0 // indirect golang.org/x/image v0.39.0 // indirect golang.org/x/text v0.36.0 // indirect diff --git a/go.sum b/go.sum index 1e32b75..4f20096 100644 --- a/go.sum +++ b/go.sum @@ -130,6 +130,8 @@ github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= github.com/rs/zerolog v1.35.0 h1:VD0ykx7HMiMJytqINBsKcbLS+BJ4WYjz+05us+LRTdI= github.com/rs/zerolog v1.35.0/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw= +github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI= +github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -175,6 +177,8 @@ go.mongodb.org/mongo-driver v1.17.9 h1:IexDdCuuNJ3BHrELgBlyaH9p60JXAvdzWR128q+U5 go.mongodb.org/mongo-driver v1.17.9/go.mod h1:LlOhpH5NUEfhxcAwG0UEkMqwYcc4JU18gtCdGudk/tQ= go.mongodb.org/mongo-driver/v2 v2.5.0 h1:yXUhImUjjAInNcpTcAlPHiT7bIXhshCTL3jVBkF3xaE= go.mongodb.org/mongo-driver/v2 v2.5.0/go.mod h1:yOI9kBsufol30iFsl1slpdq1I0eHPzybRWdyYUs8K/0= +go.mongodb.org/mongo-driver/v2 v2.5.1 h1:j2U/Qp+wvueSpqitLCSZPT/+ZpVc1xzuwdHWwl7d8ro= +go.mongodb.org/mongo-driver/v2 v2.5.1/go.mod h1:yOI9kBsufol30iFsl1slpdq1I0eHPzybRWdyYUs8K/0= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= golang.org/x/arch v0.25.0 h1:qnk6Ksugpi5Bz32947rkUgDt9/s5qvqDPl/gBKdMJLE= diff --git a/goextVersion.go b/goextVersion.go index a1fd27f..aeefe34 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.633" +const GoextVersion = "0.0.634" -const GoextVersionTimestamp = "2026-04-13T16:12:09+0200" +const GoextVersionTimestamp = "2026-04-24T13:38:00+0200" diff --git a/googleapi/mimeMessage.go b/googleapi/mimeMessage.go index 71c8356..4dae79b 100644 --- a/googleapi/mimeMessage.go +++ b/googleapi/mimeMessage.go @@ -8,7 +8,7 @@ import ( ) // https://datatracker.ietf.org/doc/html/rfc2822 -func encodeMimeMail(from string, recipients []string, cc []string, bcc []string, subject string, body MailBody, attachments []MailAttachment) string { +func encodeMimeMail(from string, recipients []string, cc []string, bcc []string, replyTo []string, subject string, body MailBody, attachments []MailAttachment) string { data := make([]string, 0, 32) @@ -22,6 +22,9 @@ func encodeMimeMail(from string, recipients []string, cc []string, bcc []string, if len(bcc) > 0 { data = append(data, "Bcc: "+strings.Join(langext.ArrMap(bcc, func(v string) string { return mime.QEncoding.Encode("UTF-8", v) }), ", ")) } + if len(replyTo) > 0 { + data = append(data, "Reply-To: "+strings.Join(langext.ArrMap(replyTo, func(v string) string { return mime.QEncoding.Encode("UTF-8", v) }), ", ")) + } data = append(data, "Subject: "+mime.QEncoding.Encode("UTF-8", subject)) hasInlineAttachments := langext.ArrAny(attachments, func(v MailAttachment) bool { return v.IsInline }) diff --git a/googleapi/mimeMessage_test.go b/googleapi/mimeMessage_test.go index 8f896a7..fc2cb6f 100644 --- a/googleapi/mimeMessage_test.go +++ b/googleapi/mimeMessage_test.go @@ -13,6 +13,7 @@ func TestEncodeMimeMail(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail", MailBody{Plain: "Plain Text"}, nil) @@ -27,6 +28,7 @@ func TestEncodeMimeMail2(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail (alternative)", MailBody{ Plain: "Plain Text", @@ -44,6 +46,7 @@ func TestEncodeMimeMail3(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail (alternative)", MailBody{ HTML: "Non Plain Text", @@ -64,6 +67,7 @@ func TestEncodeMimeMail4(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail (inline)", MailBody{ HTML: "Non Plain Text", diff --git a/googleapi/sendMail.go b/googleapi/sendMail.go index 3b9e74c..058942e 100644 --- a/googleapi/sendMail.go +++ b/googleapi/sendMail.go @@ -19,9 +19,9 @@ type MailRef struct { LabelIDs []string `json:"labelIds"` } -func (c *client) SendMail(ctx context.Context, from string, recipients []string, cc []string, bcc []string, subject string, body MailBody, attachments []MailAttachment) (MailRef, error) { +func (c *client) SendMail(ctx context.Context, from string, recipients []string, cc []string, bcc []string, replyTo []string, subject string, body MailBody, attachments []MailAttachment) (MailRef, error) { - mm := encodeMimeMail(from, recipients, cc, bcc, subject, body, attachments) + mm := encodeMimeMail(from, recipients, cc, bcc, replyTo, subject, body, attachments) tok, err := c.oauth.AccessToken() if err != nil { diff --git a/googleapi/sendMail_test.go b/googleapi/sendMail_test.go index ae9ab0f..b0223f4 100644 --- a/googleapi/sendMail_test.go +++ b/googleapi/sendMail_test.go @@ -36,6 +36,7 @@ func TestSendMail1(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail", MailBody{Plain: "Plain Text"}, nil) @@ -66,6 +67,7 @@ func TestSendMail2(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail (alternative)", MailBody{ Plain: "Plain Text", @@ -99,6 +101,7 @@ func TestSendMail3(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail (attach)", MailBody{ HTML: "Non Plain Text", @@ -135,6 +138,7 @@ func TestSendMail4(t *testing.T) { []string{"trash@mikescher.de"}, nil, nil, + nil, "Hello Test Mail (inline)", MailBody{ HTML: "Non Plain Text", diff --git a/googleapi/service.go b/googleapi/service.go index c4501a7..70952da 100644 --- a/googleapi/service.go +++ b/googleapi/service.go @@ -6,7 +6,7 @@ import ( ) type GoogleClient interface { - SendMail(ctx context.Context, from string, recipients []string, cc []string, bcc []string, subject string, body MailBody, attachments []MailAttachment) (MailRef, error) + SendMail(ctx context.Context, from string, recipients []string, cc []string, bcc []string, replyTo []string, subject string, body MailBody, attachments []MailAttachment) (MailRef, error) } type client struct {