mirror of
https://github.com/1f349/simplemail.git
synced 2024-12-22 08:04:11 +00:00
Convert FromAddress to use TextUnmarshaler
This commit is contained in:
parent
f84a67ebec
commit
80dd3b55d1
@ -1,17 +1,18 @@
|
|||||||
package simplemail
|
package simplemail
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/mail"
|
"github.com/emersion/go-message/mail"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FromAddress struct {
|
type FromAddress struct {
|
||||||
*mail.Address
|
*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
|
var a string
|
||||||
err := json.Unmarshal(b, &a)
|
err := json.Unmarshal(b, &a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user