From ece1c76aec8433edd0ec6af1bc7cef77d458d441 Mon Sep 17 00:00:00 2001
From: Alexandra Stone <144961922+alexcmatm@users.noreply.github.com>
Date: Fri, 27 Oct 2023 11:33:04 -0600
Subject: [PATCH] implement hello hostname to resolve smtp-relay issue

---
 emailer/smtp.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/emailer/smtp.go b/emailer/smtp.go
index f77db7c..7bc22fe 100644
--- a/emailer/smtp.go
+++ b/emailer/smtp.go
@@ -13,6 +13,7 @@ type SmtpMail struct {
 	port       int
 	username   string
 	password   string
+	helloHostName string
 	authType   mail.AuthType
 	encryption mail.Encryption
 	noTLSCheck bool
@@ -46,8 +47,8 @@ func encryptionType(encryptionType string) mail.Encryption {
 	}
 }
 
-func NewSmtpMail(hostname string, port int, username string, password string, noTLSCheck bool, auth string, fromName, from string, encryption string) *SmtpMail {
-	ans := SmtpMail{hostname: hostname, port: port, username: username, password: password, noTLSCheck: noTLSCheck, fromName: fromName, from: from, authType: authType(auth), encryption: encryptionType(encryption)}
+func NewSmtpMail(hostname string, port int, username string, password string, helloHostName string, noTLSCheck bool, auth string, fromName, from string, encryption string) *SmtpMail {
+	ans := SmtpMail{hostname: hostname, port: port, username: username, password: password, helloHostName: helloHostName, noTLSCheck: noTLSCheck, fromName: fromName, from: from, authType: authType(auth), encryption: encryptionType(encryption)}
 	return &ans
 }
 
@@ -66,6 +67,7 @@ func (o *SmtpMail) Send(toName string, to string, subject string, content string
 	server.Authentication = o.authType
 	server.Username = o.username
 	server.Password = o.password
+	server.Helo = o.helloHostName
 	server.Encryption = o.encryption
 	server.KeepAlive = false
 	server.ConnectTimeout = 10 * time.Second