mirror of
https://github.com/1f349/simplemail.git
synced 2024-12-21 23:54:07 +00:00
Convert FromAddress to use TextUnmarshaler
This commit is contained in:
parent
f84a67ebec
commit
80dd3b55d1
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user