summary refs log tree commit diff stats
path: root/widgets/compose.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-05 13:58:07 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-05 13:58:07 -0400
commit92dc31bad0dc69fa96b04242b635fee051ed1965 (patch)
tree9eec9b859a5685b4fbcc27540df645501f766d0e /widgets/compose.go
parent6c6bb4c893432fe165398364e9705bc976d0ef05 (diff)
downloadaerc-92dc31bad0dc69fa96b04242b635fee051ed1965.tar.gz
Use SetAddressList for From header
Diffstat (limited to 'widgets/compose.go')
-rw-r--r--widgets/compose.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index 9bd5350..26b567f 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -217,8 +217,16 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
 	if date, err := header.Date(); err != nil || date == (time.Time{}) {
 		header.SetDate(time.Now())
 	}
-	if from, _ := mhdr.Text("From"); from == "" {
-		mhdr.SetText("From", c.headers.from.input.String())
+	from := c.headers.from.input.String()
+	from_addrs, err := gomail.ParseAddressList(from)
+	if err != nil {
+		return nil, nil, errors.Wrapf(err, "ParseAddressList(%s)", from)
+	} else {
+		var simon_from []*mail.Address
+		for _, addr := range from_addrs {
+			simon_from = append(simon_from, (*mail.Address)(addr))
+		}
+		header.SetAddressList("From", simon_from)
 	}
 	if to := c.headers.to.input.String(); to != "" {
 		// Dammit Simon, this branch is 3x as long as it ought to be because