mirror of
https://github.com/1f349/lotus.git
synced 2024-12-22 08:04:06 +00:00
Use full from address in mail data
This commit is contained in:
parent
fb1ef41088
commit
37b2e555f6
@ -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) {
|
||||
|
@ -101,7 +101,7 @@ func (s Json) PrepareMail(now time.Time) (*Mail, error) {
|
||||
}
|
||||
|
||||
return &Mail{
|
||||
From: from.String(),
|
||||
From: from,
|
||||
Body: out.Bytes(),
|
||||
}, nil
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user