mirror of
https://github.com/nikdoof/pocket-id.git
synced 2025-12-14 15:22:18 +00:00
fix: use OS hostname for SMTP EHLO message
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/smtp"
|
"net/smtp"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
|
"os"
|
||||||
ttemplate "text/template"
|
ttemplate "text/template"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -117,8 +118,12 @@ func SendEmail[V any](srv *EmailService, toEmail email.Address, template email.T
|
|||||||
}
|
}
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
|
|
||||||
if err := client.Hello(common.EnvConfig.Host); err != nil {
|
// Set the hello message manually as for example Google rejects the default "localhost" value
|
||||||
return fmt.Errorf("failed to say hello to SMTP server: %w", err)
|
hostname, err := os.Hostname()
|
||||||
|
if err == nil {
|
||||||
|
if err := client.Hello(hostname); err != nil {
|
||||||
|
return fmt.Errorf("failed to say hello to SMTP server: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
smtpUser := srv.appConfigService.DbConfig.SmtpUser.Value
|
smtpUser := srv.appConfigService.DbConfig.SmtpUser.Value
|
||||||
|
|||||||
Reference in New Issue
Block a user