add deferred Close to connection

This commit is contained in:
Chris Camel 2020-06-16 18:45:34 +02:00
parent 599d23e080
commit c58be715bd
No known key found for this signature in database
GPG Key ID: 125EFEF60AEF6949
1 changed files with 1 additions and 0 deletions

View File

@ -91,6 +91,7 @@ func (m *SendMailRequest) Execute() error {
if err != nil {
return fmt.Errorf("failed initiating smtp connection (%s)", err)
}
defer conn.Close()
smtpClient, err := smtp.NewClient(conn, smtpServerHost)
if err != nil {