Fix Cc & Bcc handling in replies

This commit is contained in:
Drew DeVault 2019-06-21 14:33:09 -04:00
parent 63538978f3
commit ceeb30abeb
3 changed files with 14 additions and 7 deletions

View File

@ -36,6 +36,8 @@ func SendMessage(aerc *widgets.Aerc, args []string) error {
"No outgoing mail transport configured for this account") "No outgoing mail transport configured for this account")
} }
aerc.Logger().Println("Sending mail")
uri, err := url.Parse(config.Outgoing) uri, err := url.Parse(config.Outgoing)
if err != nil { if err != nil {
return errors.Wrap(err, "url.Parse(outgoing)") return errors.Wrap(err, "url.Parse(outgoing)")
@ -152,6 +154,7 @@ func SendMessage(aerc *widgets.Aerc, args []string) error {
if err = conn.Mail(from.Address); err != nil { if err = conn.Mail(from.Address); err != nil {
return 0, errors.Wrap(err, "conn.Mail") return 0, errors.Wrap(err, "conn.Mail")
} }
aerc.Logger().Printf("rcpt to: %v", rcpts)
for _, rcpt := range rcpts { for _, rcpt := range rcpts {
if err = conn.Rcpt(rcpt); err != nil { if err = conn.Rcpt(rcpt); err != nil {
return 0, errors.Wrap(err, "conn.Rcpt") return 0, errors.Wrap(err, "conn.Rcpt")

View File

@ -196,6 +196,10 @@ func (aerc *Aerc) Config() *config.AercConfig {
return aerc.conf return aerc.conf
} }
func (aerc *Aerc) Logger() *log.Logger {
return aerc.logger
}
func (aerc *Aerc) SelectedAccount() *AccountView { func (aerc *Aerc) SelectedAccount() *AccountView {
acct, ok := aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name] acct, ok := aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name]
if !ok { if !ok {

View File

@ -228,6 +228,13 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
} }
header.SetAddressList("From", simon_from) header.SetAddressList("From", simon_from)
} }
// Merge in additional headers
txthdr := mhdr.Header
for key, value := range c.defaults {
if !txthdr.Has(key) && value != "" {
mhdr.SetText(key, value)
}
}
if to := c.headers.to.input.String(); to != "" { if to := c.headers.to.input.String(); to != "" {
// Dammit Simon, this branch is 3x as long as it ought to be because // Dammit Simon, this branch is 3x as long as it ought to be because
// your types aren't compatible enough with each other // your types aren't compatible enough with each other
@ -267,13 +274,6 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
rcpts = append(rcpts, addr.Address) rcpts = append(rcpts, addr.Address)
} }
} }
// Merge in additional headers
txthdr := mhdr.Header
for key, value := range c.defaults {
if !txthdr.Has(key) && value != "" {
mhdr.SetText(key, value)
}
}
return &header, rcpts, nil return &header, rcpts, nil
} }