Thor Logo dbatools

DatabaseMail

New-DbaDbMailAccount

Chrissy LeMaire (@cl), netnerds.net

New-DbaDbMailAccount View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Creates a new Database Mail account for sending emails from SQL Server Description Creates a new Database Mail account on SQL Server instances to enable automated email notifications, alerts, and reports. Database Mail accounts define the email settings (SMTP server, sender address, authentication) that SQL Server uses when sending emails through stored procedures like sp_send_dbmail. This is essential for setting up automated maintenance notifications, job failure alerts, and scheduled report delivery.

Read more

New-DbaDbMailProfile

Ian Lanham (@ilanham)

New-DbaDbMailProfile View Source Ian Lanham (@ilanham) Windows, Linux, macOS Synopsis Creates a new Database Mail profile for organizing SQL Server email notifications Description Creates a new Database Mail profile on SQL Server instances, which serves as a container for organizing mail accounts used by SQL Server for notifications, alerts, and reports. Database Mail profiles allow you to group multiple mail accounts and set priorities for failover scenarios. You can optionally associate an existing mail account to the profile during creation, making this useful for setting up complete email notification systems or organizing different notification types into separate profiles.

Read more

Remove-DbaDbMailAccount

Mikey Bronowski (@MikeyBronowski), bronowski.it

Remove-DbaDbMailAccount View Source Mikey Bronowski (@MikeyBronowski), bronowski.it Windows, Linux, macOS Synopsis Removes Database Mail accounts from SQL Server instances Description Permanently deletes Database Mail accounts from the specified SQL Server instances, removing them from the MSDB database configuration. This command is useful when decommissioning obsolete email accounts, cleaning up after application retirement, or consolidating accounts during email system migrations. When used without pipeline input, it automatically retrieves accounts using Get-DbaDbMailAccount with the provided parameters before removal.

Read more

Remove-DbaDbMailProfile

Mikey Bronowski (@MikeyBronowski), bronowski.it

Remove-DbaDbMailProfile View Source Mikey Bronowski (@MikeyBronowski), bronowski.it Windows, Linux, macOS Synopsis Removes Database Mail profiles from SQL Server instances. Description Deletes specified Database Mail profiles from the msdb database, permanently removing their configuration and preventing them from sending emails. This is commonly used during security hardening to remove unused profiles or when cleaning up misconfigured mail setups. Accepts profiles via pipeline from Get-DbaDbMailProfile or directly through parameters, making it easy to selectively remove profiles based on specific criteria.

Read more