Update an existing database mail account using T-SQL

EXEC msdb..sysmail_update_account_sp @account_name = 'SMTP_database_mail',            -- sysname
                                     @email_address = N'altersemail@example.com',            -- nvarchar(128)
                                     @display_name = N'Database Mail',             -- nvarchar(128)
                                     @replyto_address = N'altersemail@example.com',          -- nvarchar(128)
                                     @description = N'Primary database alerts profile',              -- nvarchar(256)
                                     @mailserver_name = 'smtp.office365.com',         -- sysname
                                     @port = 587,                       -- int
                                     @username = 'altersemail@example.com',                -- sysname
                                     @password = 'SecurePassword',                -- sysname
                                     @use_default_credentials = 0, -- bit
                                     @enable_ssl = 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: