Programmatically set SMTP host

Forum for users of Redgate's SQL Backup tool

Programmatically set SMTP host

Postby Eric Nolen » Mon Mar 04, 2013 6:51 pm

Hi Everyone,

I wanted to see if there is a way to set the SMTP host information pragmatically rather than going through "Tools" -> "Server Options" -> "Email Settings".

Does anyone know of a way to do this?

I tried checking out the SQL Compact Database and searching for possible config files on the file system but I didn't see anywhere this information is stored on the server. I was browsing the forums as well and I have yet to find anything that might point me in the right direction.

My end goal was to setup a script/process that can go in and update the SMTP host information across all of my SQL Backup installations.

I'm running SQL Backup
-Eric Nolen
Eric Nolen
Posts: 5
Joined: Fri Sep 18, 2009 5:16 pm

Postby petey » Tue Mar 05, 2013 3:40 am

Try this:

Code: Select all
EXEC master..sqbutility 1040, 'SMTPHost', ''
EXEC master..sqbutility 1041, 'SMTPPort', 135
Peter Yeoh
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Posts: 2357
Joined: Sun Apr 24, 2005 11:34 am

Postby Eric Nolen » Tue Mar 05, 2013 7:30 pm


This is what I was looking for, I've tested it out and it seems to work fine.

Thanks for your help.


FYI: For anyone else interested... the SQL Backup GUI must cache the email settings at some level because the only way I can get it to reflect that changes made by the stored proc call is to close out and re-enter the GUI. Even if I forced a refresh on the server it would not reflect the updated value. Thew me off for a minute when I was validating.

Also the actual values seemed to be stored in the registry here:

HKEY_LOCAL_MACHINE\\SOFTWARE\\Red Gate\\SQL Backup\\BackupSettingsGlobal\\<INSTANCE>\\
-Eric Nolen
Eric Nolen
Posts: 5
Joined: Fri Sep 18, 2009 5:16 pm

Return to SQL Backup Previous Versions

Who is online

Users browsing this forum: No registered users and 1 guest