How to change SMTP server in SQL Server database mail?
We may come up with a issue when old SMTP (Simple Mail Transfer Protocol) server used by database mail is either retired, replaced, not working and the only option we have is to change the SMTP server with some new server.
Steps to follow:
- Connect to SQL Server Instance and navigate to Management à Database Mail à Right click à Configure Database Mail
- Database Configuration Wizard will open. Click Next
- In this windows select Manage Database Mail accounts and profiles, and then click Next
- On this screen select View, change, or delete an existing account, and then click Next
- On this window change the SMTP server name under the field Server Name. You may also have to change Port number if SMTP server is not using the default port number i.e. Port Number 25
- Next screen will be a summary of changes being made. Review the changes and click Finish to make changes
More Helpful information:
How about if you get a request to find all the database servers where old SMTP server is being used and replaces it with new server.
Here is a query that will help you to find the list of SMTP servers being used by database mail in a specific instance.
SELECT distinct servername, @@SERVERNAME FROM msdb.dbo.sysmail_server