Let’s go from simple to more complex. We will first check whether the component is enabled and whether permissions exist, then look at the queue status, and only after that move on to SMTP, TLS, and the network layer.
Database Mail XPs is disabledThis is the most obvious case. It is exactly what leads to the message saying that Database Mail XPs is turned off. The solution is simple: enable the component through
sp_configure and verify the result.
The profile is not found or is not available to the calling userIf the profile exists but the calling login does not have permissions,
sp_send_dbmail will not be able to use it. Here, you need to check:
- whether the profile exists;
- whether it is public or private;
- whether the user has the DatabaseMailUserRole role in msdb;
- under which identity the SQL Agent job or procedure is actually being executed.
The last point is often decisive. Everything works manually under an administrator account, but fails inside a job.
The email is queued but not sentThis is already a more interesting situation. Here, you should check:
- the Database Mail status;
- the queue in sysmail_allitems;
- the sysmail_event_log;
- whether Service Broker is enabled in msdb;
- whether the mail queue is stopped.
You can check the status like this:
EXEC msdb.dbo.sysmail_help_status_sp;If Database Mail is stopped, it can be started:
EXEC msdb.dbo.sysmail_start_sp;Check Service Broker in msdb:
SELECT name, is_broker_enabledFROM sys.databasesWHERE name = N'msdb';If
is_broker_enabled = 0, that is already a separate administrative problem. It should be fixed carefully and usually only during a database maintenance window.
SMTP, authentication, and TLS errorsHere you need to look at the error description in
sysmail_event_log. Usually, that is where you can see what went wrong: incorrect username or password, relay denied, TLS handshake error, inability to connect to the host, or a timeout.
Attachment errorsIf you attach a file through
@file_attachments, SQL Server must have real file-system-level access to it. Here, the important context is the SQL Server service context, not the current interactive administrator session. When the file “exists” locally but Database Mail cannot see it, the problem is usually permissions or the path.
TLS 1.2 and modern security restrictionsThis is the part that older instructions often describe too simplistically. A modern SMTP server usually requires not just “some encryption,” but specific TLS support, a compatible .NET version, and correct Windows system settings.
If the SMTP server expects TLS 1.2, it makes sense to check the following:
- current Windows and SQL Server updates are installed;
- TLS 1.2 support is available on the server;
- .NET Framework and system crypto settings do not block the required handshake;
- a secure connection is enabled in the Database Mail settings.
A typical example of registry settings for enabling strong crypto looks like this:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319]"SchUseStrongCrypto"=dword:00000001[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319]"SchUseStrongCrypto"=dword:00000001[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]"DisabledByDefault"=dword:00000000"Enabled"=dword:00000001[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]"DisabledByDefault"=dword:00000000"Enabled"=dword:00000001After changing these settings, a restart of the SQL Server service is usually required, and sometimes a full server restart, so that Schannel and .NET reliably pick up the new parameters.
There are three practical nuances here.
First, for Database Mail it is usually better to target port 587 with TLS/STARTTLS. Port 465 is often mentioned in older instructions as an option, but in practice it often proves problematic because Database Mail relies on the .NET SMTP stack and works best with STARTTLS rather than implicit SMTPS.
Second, if you use Microsoft 365 or another modern cloud email service, check not only TLS but also the authentication model. Database Mail does not support a modern OAuth flow. If the provider has disabled basic SMTP AUTH, the email will not be sent even if the T-SQL is correct. In such cases, organizations usually use either a dedicated SMTP relay or a mailbox for which SMTP AUTH is allowed by policy.
Third, the SSL checkbox in the SSMS wizard effectively means that the server side must support a correct SMTP-over-TLS scenario. So you should look not only at the UI, but also at the actual compatibility between your SMTP endpoint and Database Mail.
Limitations and pitfalls- sp_send_dbmail confirms that the message has been queued, not that it has been delivered to the user’s mailbox.
- Database Mail depends on SMTP infrastructure, network connectivity, DNS, TLS policy, and authentication rules outside SQL Server.
- It does not support modern OAuth scenarios for cloud email, so not every corporate mail service will work without a relay or special configuration.
- For attachments, the relevant permissions are those of the SQL Server service account, not the administrator account under which you opened SSMS.
- Attachment size and the list of prohibited extensions are limited by Database Mail settings and can unexpectedly break working scenarios.
- Database Mail is available in SQL Server Database Engine and Azure SQL Managed Instance, but not in Azure SQL Database or elastic pools.
SummaryIn summary, Database Mail is best suited for service notifications, scheduled reports, and technical mailings. I would not stretch it toward complex email integration with business logic, templating, and modern cloud-auth scenarios. In those cases, it very quickly stops being convenient.
Useful links