From 80dd3b55d1fbf90db13bd6b044aab404e7e166de Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Sat, 21 Sep 2024 16:08:07 +0100 Subject: [PATCH] Convert FromAddress to use TextUnmarshaler --- fromaddress.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fromaddress.go b/fromaddress.go index acaa78b..ec14b4f 100644 --- a/fromaddress.go +++ b/fromaddress.go @@ -1,17 +1,18 @@ package simplemail import ( + "encoding" "encoding/json" - "net/mail" + "github.com/emersion/go-message/mail" ) type FromAddress struct { *mail.Address } -var _ json.Unmarshaler = &FromAddress{} +var _ encoding.TextUnmarshaler = &FromAddress{} -func (f *FromAddress) UnmarshalJSON(b []byte) error { +func (f *FromAddress) UnmarshalText(b []byte) error { var a string err := json.Unmarshal(b, &a) if err != nil {