Forum Discussion
hmmmm007
Sep 07, 2023Copper Contributor
Change the server name in the HELO exchange in SQL Server Database Mail
When my SQL Database mail connects to my SMTP provider (SendGrid) it shows the local server name rather than the FQDN. I would like to find the configuration setting so that the HELO exchange uses the FQDN. For example, the email header shows the following:
Received: from XXXXXXXXXXSQLSVR (unknown) by geopod-ismtpd-8 (SG) with ESMTP id hd6Gp5D_QYKF9OEZESI-tA Thu, 07 Sep 2023 18:49:36.406 +0000 (UTC)
and I would like it to be:
Received: from MailServer.XYZDomain.com (111.111.111.111) by geopod-ismtpd-8 (SG) with ESMTP id hd6Gp5D_QYKF9OEZESI-tA Thu, 07 Sep 2023 18:49:36.406 +0000 (UTC)
I am looking to to find where I can change the HELO server name from XXXXXXXXXXSQLSVR to MailServer.XYZDomain.com. I have not been able to find a config setting anywhere that controls that HELO value.
Thank you
olafhelper It turns out there is one. I received the answer from another forum. Excerpts below:
"since DatabaseMail.exe is the application that actually sends the emails, and it uses SmtpClient apparently, you can try adding to the XML configuration file at DatabaseMail.exe.config. This is located in your SQL Server instance location, in a folder called Binn."
<configuration> <system.net> <mailSettings> <smtp> <network clientDomain="MailServer.XYZDomain.com" /> </smtp> </mailSettings> </system.net> </configuration>
This solved the issue for me. HTH
PS: It is important to note that the database mail service must be stopped and restarted after the configuration changes have been made, if the database mail service was running running when the changes were made. This can be done with the "EXECUTE msdb.dbo.sysmail_stop_sp" and "EXECUTE msdb.dbo.sysmail_start_sp" commands.
- olafhelperBronze Contributor
I have not been able to find a config setting anywhere that controls that HELO value.
Because there isn't one.
SQL Server acts as a very simple email client, you can't modify the behaviour.
- hmmmm007Copper Contributor
olafhelper It turns out there is one. I received the answer from another forum. Excerpts below:
"since DatabaseMail.exe is the application that actually sends the emails, and it uses SmtpClient apparently, you can try adding to the XML configuration file at DatabaseMail.exe.config. This is located in your SQL Server instance location, in a folder called Binn."
<configuration> <system.net> <mailSettings> <smtp> <network clientDomain="MailServer.XYZDomain.com" /> </smtp> </mailSettings> </system.net> </configuration>
This solved the issue for me. HTH
PS: It is important to note that the database mail service must be stopped and restarted after the configuration changes have been made, if the database mail service was running running when the changes were made. This can be done with the "EXECUTE msdb.dbo.sysmail_stop_sp" and "EXECUTE msdb.dbo.sysmail_start_sp" commands.