mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 11:27:33 +00:00
feat: add reply-to header in email notification (#6393)
* feat: add reply-to header to smtp messages * fix: grpc reply_to_address min 0 and js var name * fix: add missing translations * fix merge and linting --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -17,9 +17,10 @@ import (
|
||||
var _ channels.NotificationChannel = (*Email)(nil)
|
||||
|
||||
type Email struct {
|
||||
smtpClient *smtp.Client
|
||||
senderAddress string
|
||||
senderName string
|
||||
smtpClient *smtp.Client
|
||||
senderAddress string
|
||||
senderName string
|
||||
replyToAddress string
|
||||
}
|
||||
|
||||
func InitChannel(ctx context.Context, getSMTPConfig func(ctx context.Context) (*Config, error)) (*Email, error) {
|
||||
@@ -36,9 +37,10 @@ func InitChannel(ctx context.Context, getSMTPConfig func(ctx context.Context) (*
|
||||
logging.New().Debug("successfully initialized smtp email channel")
|
||||
|
||||
return &Email{
|
||||
smtpClient: client,
|
||||
senderName: smtpConfig.FromName,
|
||||
senderAddress: smtpConfig.From,
|
||||
smtpClient: client,
|
||||
senderName: smtpConfig.FromName,
|
||||
senderAddress: smtpConfig.From,
|
||||
replyToAddress: smtpConfig.ReplyToAddress,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -54,6 +56,7 @@ func (email *Email) HandleMessage(message channels.Message) error {
|
||||
}
|
||||
emailMsg.SenderEmail = email.senderAddress
|
||||
emailMsg.SenderName = email.senderName
|
||||
emailMsg.ReplyToAddress = email.replyToAddress
|
||||
// To && From
|
||||
if err := email.smtpClient.Mail(emailMsg.SenderEmail); err != nil {
|
||||
return caos_errs.ThrowInternalf(err, "EMAIL-s3is3", "could not set sender: %v", emailMsg.SenderEmail)
|
||||
|
@@ -1,10 +1,11 @@
|
||||
package smtp
|
||||
|
||||
type Config struct {
|
||||
SMTP SMTP
|
||||
Tls bool
|
||||
From string
|
||||
FromName string
|
||||
SMTP SMTP
|
||||
Tls bool
|
||||
From string
|
||||
FromName string
|
||||
ReplyToAddress string
|
||||
}
|
||||
|
||||
type SMTP struct {
|
||||
|
Reference in New Issue
Block a user