Use full from address in mail data

This commit is contained in:
Melon 2023-08-23 19:14:47 +01:00
parent fb1ef41088
commit 37b2e555f6
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
3 changed files with 5 additions and 4 deletions

View File

@ -41,7 +41,7 @@ func MessageSender(send Smtp) func(rw http.ResponseWriter, req *http.Request, pa
}
// this looks up the underlying account for the sender alias
lookup, err := defaultPostfixLookup(mail.From)
lookup, err := defaultPostfixLookup(mail.From.Address)
// the alias does not exist
if errors.Is(err, postfixLookup.ErrInvalidAlias) {

View File

@ -101,7 +101,7 @@ func (s Json) PrepareMail(now time.Time) (*Mail, error) {
}
return &Mail{
From: from.String(),
From: from,
Body: out.Bytes(),
}, nil
}

View File

@ -1,6 +1,7 @@
package smtp
import (
"github.com/emersion/go-message/mail"
"os/exec"
)
@ -9,7 +10,7 @@ type Smtp struct {
}
type Mail struct {
From string
From *mail.Address
Body []byte
}
@ -19,7 +20,7 @@ var execSendMail = func(from string) *exec.Cmd {
func (s *Smtp) Send(mail *Mail) error {
// start sendmail caller
sendMail := execSendMail(mail.From)
sendMail := execSendMail(mail.From.String())
inPipe, err := sendMail.StdinPipe()
if err != nil {
return err