Troubleshooting Guide: SQL Server Error 13026
Why This Error Happens
Error 13026 in Microsoft SQL Server 2025 is typically related to Database Mail or external script processing failures, often triggered when the Database Mail executable (DatabaseMail.exe) cannot access a specified file path or network parameter correctly. This commonly occurs due to insufficient NTFS permissions on the mail pickup/drop folder, a malformed or missing parameter in the stored procedure call, or the SQL Server Agent service account lacking rights to the referenced resource. On Windows Server 2025 and Windows 11, stricter default security policies and credential isolation can also prevent the parameter from resolving correctly at runtime.
Step-by-Step Resolution Guide
Step 1: Verify the Parameter Syntax in the Calling Procedure
- Open SQL Server Management Studio (SSMS) and locate the stored procedure or job step generating Error 13026.
- Check that all required parameters (such as
@file_attachments,@profile_name, or@recipients) are correctly formatted and not NULL when required. - Run the procedure manually with explicit test values to isolate which parameter is causing the fault.
Step 2: Check Service Account Permissions
- Open Services.msc and identify the account running the SQL Server Agent and SQL Server Database Engine services.
- Navigate to the folder referenced in the error (commonly
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Logor a custom mail pickup directory). - Right-click the folder, select Properties > Security, and ensure the service account has Read/Write/Modify permissions.
Step 3: Validate Database Mail Configuration
- Open SSMS, expand Management > Database Mail, and run the Configure Database Mail Wizard.
- Confirm the SMTP server parameters and profile name match exactly what is referenced in the failing job or query.
- Execute the following to test connectivity:
EXEC msdb.dbo.sysmail_help_status_sp;
Step 4: Review Windows Firewall and Group Policy Restrictions
- On Windows Server 2025, check Windows Defender Firewall with Advanced Security for outbound rules blocking port 25/587 (if mail-related) or the relevant application port.
- Verify no Group Policy Object (GPO) is restricting script execution or file system access for the service account via
gpedit.msc.
Step 5: Repair or Reinitialize the Parameter Source
- If the parameter references an external file or configuration XML, validate the file isn’t corrupted by opening it in a text editor.
- Restart the SQL Server Agent service to clear cached parameter states:
Restart-Service SQLSERVERAGENT -Force
Alternative or Verification Steps
- Re-run the original job or query that triggered Error 13026 and check the SQL Server Error Log (via
EXEC sp_readerrorlog) to confirm the error no longer appears. - If the issue persists, create a new, minimal test job with hardcoded parameter values to confirm whether the root cause is environmental (permissions/firewall) rather than code-based.