If you use Database Mail in SQL Server, you can use the sysmail_allitems
view to check the status of all emails that Database Mail has processed.
Tag: send email
Find Out Why an Email Failed to Send in SQL Server (T-SQL)
If you’re trying to send email using Database Mail in SQL Server, but it fails to send, you can check the sysmail_event_log
view to see why it failed.
The sysmail_event_log
view returns one row for each Windows or SQL Server message returned by the Database Mail system. By “message”, I don’t mean the actual mail message. I mean a message such as the error message that explains why the mail failed.
You can also use the sysmail_configure_sp
stored procedure to determine what types of messages are logged.
Check for Failed Email in SQL Server (T-SQL)
If you’re trying to send mail with SQL Server but it’s not being delivered, try checking the sysmail_faileditems
view.
Check Unsent Mail in SQL Server (T-SQL)
When sending emails from SQL Server, you can check for any unsent mail with the sysmail_unsentitems
view.
Fix “profile name is not valid” When Sending Mail from SQL Server
If you try to send mail from SQL Server, but you get a “profile name is not valid” it’s probably because you haven’t specified a valid profile for the @profile_name
argument.
How to Remove a Database Mail Account from a Profile in SQL Server (T-SQL)
In SQL Server, you can use the sysmail_delete_profileaccount_sp
stored procedure to remove a Database Mail account from a profile.
You can remove the account from a specific profile, or you can remove it from all profiles. You can also remove all accounts from a given profile.
The way it works is, you provide two arguments; the account name or its ID, and the profile name or its ID. If you omit the argument for the profile, the account is removed from all profiles. If you omit the argument for the account, then all accounts are removed from the profile.
Continue readingDelete a Database Mail Profile in SQL Server (T-SQL)
In SQL Server, you can use the sysmail_delete_profile_sp
stored procedure to delete an existing Database Mail profile.
You can delete a profile by providing either its name or its ID (but you must provide either one or the other).
Continue readingDelete a Database Mail Account in SQL Server (T-SQL)
In SQL Server, you can use the sysmail_delete_account_sp
stored procedure to delete an existing Database Mail account.
You can delete an account by providing either its name or its ID (but you must provide either one or the other).
Continue readingUpdate a Database Mail Account in SQL Server (T-SQL)
In SQL Server, you can use the sysmail_update_account_sp
stored procedure in the msdb
database to update your existing Database Mail accounts with T-SQL.
Update a Database Mail Profile in SQL Server (T-SQL)
In SQL Server, you can use the sysmail_update_profile_sp
stored procedure in the msdb
database to update your existing Database Mail profiles with T-SQL.