A SQL Server Agent job fails, but no failure email ever arrives
Your error
The job history shows the job failed, but the operator gets no email2 more lines it can showFix it fast
Most common cause, 1 of 3SQL Server Agent has no mail profile, or was not restarted after you set one
Tick Enable mail profile, choose Database Mail as the mail system, pick your profile, then restart SQL Server Agent so it picks up the profile.
-- Windows: set the profile in SSMS (steps above), then restart the Agent service
-- Linux:
sudo /opt/mssql/bin/mssql-conf set sqlagent.databasemailprofile default
sudo systemctl restart mssql-serverShort answer
SQL Server Agent job failure email needs three things: Database Mail that can deliver, a mail profile enabled under Agent Properties > Alert System followed by an Agent restart, and a job set to e-mail an operator When the job fails. Missing any one, the job fails silently. Applies to SQL Server 2019 to 2025 on Windows and Linux.
Which cause do you have?
Run both queries in msdb. The first shows whether the job is told to e-mail anyone. The second shows whether Database Mail received a message at the time the job failed, and what happened to it. A job with notify_level_email 0 points to cause 2; no queued row at the failure time points to cause 1; a row with failed status points to cause 3.
SELECT j.name, j.notify_level_email, o.name AS operator_name, o.email_address
FROM msdb.dbo.sysjobs AS j
LEFT JOIN msdb.dbo.sysoperators AS o ON o.id = j.notify_email_operator_id;
SELECT TOP (20) mailitem_id, recipients, subject, sent_status, send_request_date
FROM msdb.dbo.sysmail_allitems
ORDER BY send_request_date DESC;Then find the line you see in this list and open its fix:
- 1SQL Server Agent has no mail profile, or was not restarted after you set one
A Database Mail test message arrives, the job has an operator, but sysmail_allitems has no row for the job failure - 2The job is not set to e-mail an operator on failure
notify_level_email is 0 or 1 for the job, or operator_name is NULL in the first query - 3Database Mail itself cannot deliver
Rows for the job failure exist with sent_status failed or unsent, or a test mail from SSMS also never arrives
What does the error look like?
The job history shows the job failed, but the operator gets no emailSend Test E-Mail from Database Mail works, but job notifications never arriveNo row for the job's failure appears in msdb.dbo.sysmail_allitems
Cause 1 of 3
SQL Server Agent has no mail profile, or was not restarted after you set one
You seeA Database Mail test message arrives, the job has an operator, but sysmail_allitems has no row for the job failure
Check
SQL Server Agent does not use Database Mail until a profile is chosen for it. Without that setting, job failure email is never handed to Database Mail, even when everything else works. Open SSMS, right-click SQL Server Agent, select Properties and look at the Alert System page.
-- SSMS: SQL Server Agent > Properties > Alert System > Mail sessionFix
Tick Enable mail profile, choose Database Mail as the mail system, pick your profile, then restart SQL Server Agent so it picks up the profile. On Linux, register the profile with mssql-conf and restart the service.
-- Windows: set the profile in SSMS (steps above), then restart the Agent service
-- Linux:
sudo /opt/mssql/bin/mssql-conf set sqlagent.databasemailprofile default
sudo systemctl restart mssql-serverVerify
Make a test job fail on purpose. A new row for it shows up in sysmail_allitems with sent_status sent.
SELECT TOP (5) subject, sent_status, send_request_date FROM msdb.dbo.sysmail_allitems ORDER BY send_request_date DESC;Confirmed by learn.microsoft.com
Cause 2 of 3
The job is not set to e-mail an operator on failure
You seenotify_level_email is 0 or 1 for the job, or operator_name is NULL in the first query
Check
Each job keeps its own notification choice. notify_level_email 0 means never, 1 only on success, 2 on failure and 3 whenever the job completes. If no e-mail operator is linked, Agent has nobody to write to, and an operator with a mistyped address sends to nobody useful.
SELECT name, email_address FROM msdb.dbo.sysoperators;Fix
Create the operator if it is missing, then set the job to e-mail it on failure. In SSMS, the same switch is on the Notifications page of Job Properties: E-mail, the operator, When the job fails.
EXECUTE msdb.dbo.sp_add_operator
@name = N'DBA Team',
@enabled = 1,
@email_address = N'dba-team@example.com',
@category_name = N'[Uncategorized]';
EXECUTE msdb.dbo.sp_update_job
@job_name = N'Nightly backup',
@notify_level_email = 2,
@notify_email_operator_name = N'DBA Team';Verify
The first query now shows notify_level_email 2 and the operator with the right address.
SELECT name, notify_level_email FROM msdb.dbo.sysjobs WHERE name = N'Nightly backup';Confirmed by learn.microsoft.com
Cause 3 of 3
Database Mail itself cannot deliver
You seeRows for the job failure exist with sent_status failed or unsent, or a test mail from SSMS also never arrives
Check
When Database Mail is disabled or its SMTP account is wrong, nothing leaves the server even though Agent tried to send. Microsoft's troubleshooting guide starts with the sysmail_event_log view, which records one row per message the mail system returns, including SMTP refusals. Database Mail XPs set to 0 keeps the mail program from starting.
SELECT TOP (20) log_date, event_type, description
FROM msdb.dbo.sysmail_event_log
ORDER BY log_date DESC;Fix
Turn on Database Mail XPs if it is off. Then open Configure Database Mail in SSMS and check the account: a fully qualified SMTP server name, the right port, SSL when the server needs it, and an authentication type the server accepts. Use your own profile name in the test below.
EXECUTE sp_configure 'show advanced options', 1;
RECONFIGURE;
EXECUTE sp_configure 'Database Mail XPs', 1;
RECONFIGURE;
EXECUTE msdb.dbo.sp_send_dbmail
@profile_name = 'default',
@recipients = 'dba-team@example.com',
@subject = 'Database Mail test',
@body = 'Test from SQL Server';Verify
The test message shows sent in sysmail_allitems and reaches the inbox; the next job failure does too.
SELECT TOP (5) subject, sent_status FROM msdb.dbo.sysmail_allitems ORDER BY send_request_date DESC;Confirmed by learn.microsoft.com
How do I stop it coming back?
- Keep the operator, the job notification and the Alert System profile in one deployment script so a rebuilt server gets all three.
- Use a group mailbox as the operator address instead of one person's inbox, so leavers do not silence alerts.
- Add a small job that fails on purpose once a month and confirm its email arrives.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.