I’ve written quite a number of tutorials for using Database Mail, and I’ve created this article to list them all in one place.
I first included these links at the bottom of How to Send Emails from SQL Server (T-SQL), but I thought it might be helpful to move them to their own article as a quick-reference.
Tutorials Using the Configuration Wizard
Here’s a list of tutorials that use the SSMS (SQL Server Management Studio) graphical user interface to carry out common Database Mail tasks.
These involve the Database Mail Configuration Wizard, which walks you through each task.
- Setup Database Mail
- Create a Database Mail Profile
- Create a Database Mail Account
- Delete a Database Mail Profile
- Delete a Database Mail Account
- Update a Database Mail Profile
- Update a Database Mail Account
- Add a Database Mail Account to a Profile
- Remove a Database Mail Account from a Profile
- Set a Default Public Profile for Database Mail
- Change the Priority of an Account within a Database Mail Profile
Tutorials using T-SQL
The following tutorials use T-SQL instead of the SSMS GUI.
Using T-SQL is usually a lot quicker (once you’ve written the code), because all you need to do is open a new query tab and run the code.
Sending Mail
- How to Send Emails from SQL Server
- Enable Database Mail
- Send an HTML Email
- Email the Results of a Query
- Email Query Results as an HTML Table
- Email Query Results as an Attachment
- Send Emails with Attachments
- Send Email from a Trigger
- Stop/Start the Database Mail Queue
- Increase the Allowable Attachment Size
- Remove the Column Headers when Emailing Query Results
- Remove Padding When Sending Query Results
- Change the Separator to a Comma when Emailing Query Results
- Fix “profile name is not valid” When Sending Mail
Listing Accounts, Profiles, etc
- Get a List of Database Mail Accounts
- Find the Associations Between Database Mail Accounts and Database Principals
- Return a List of Database Mail Profiles
- List the Accounts Associated with a Database Mail Profile
Configuration Settings
- Show Advanced Server Configuration Options
- Check the Configuration Settings for Database Mail
- Change the Configuration Settings for Database Mail
Checking Sent Mail, etc
- Check Sent Mail
- Check Unsent Mail
- Check for Failed Email
- Find Out Why an Email Failed to Send
- Check the Status of All Database Mail Messages
- Check the Status of the Database Mail Queues
- Check How Many Mail Items are in the Queue
- Delete Database Mail Messages from the msdb Database
- Delete Events from the Database Mail Log
Configuring Accounts & Profiles
- Create a Database Mail Profile
- Create a Database Mail Account
- Update a Database Mail Profile
- Update a Database Mail Account
- Delete a Database Mail Profile
- Delete a Database Mail Account
- Grant an msdb User Access to a Database Mail Profile
- Add a Database Mail Account to a Profile
- Remove a Database Mail Account from a Profile
- Change the Sequence Number of a Database Mail Account within a Profile
- Change the Default Database Mail Profile for a User
- Create a Default Public Profile for Database Mail