Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [database-mail]

Database Mail is an enterprise solution for sending e-mail messages from the SQL Server Database Engine. Using Database Mail, your database applications can send e-mail messages to users. The messages can contain query results, and files from any resource on your network. Database Mail is designed for reliability, scalability, security, and supportability.

Filter by
Sorted by
Tagged with
0 votes
0 answers
59 views

In SQL Server database mail is not working

Database mail is not working: Below Error while sending a test mail Mail not queued. Database Mail is stopped. Use sysmail_start_sp to start Database Mail. (Microsoft SQL Server, Error: 14641) Checked ...
Ajith Kumar M's user avatar
1 vote
2 answers
111 views

Prevent users from sending an email attachment in sql server

In SQL Server, I want to restrict all users (except a few specific users) to send an email with attachment. For example, someone import data into excel file and send it via mail using the ...
Farid Zahidov's user avatar
0 votes
2 answers
49 views

What to consider for choice of database account email - prevent 'out of office' reply problems

Here's the problem we are having: I have Job Notifications turned on for several SQL Server nightly Jobs. Sometimes those email notifications come to me when I'm out of office, and my Outlook is set ...
JJ from Oregon's user avatar
0 votes
0 answers
44 views

Deleted SQL Agent Job Sending Failed Notifications

I have deleted the job and I don't see it in the object explorer nor in sysjobs, and yet it is sending out notifications when it 'fails'. I've done the following solution: Restart MSSQLSERVER & ...
DigitalInsanity's user avatar
0 votes
0 answers
1k views

How to use multiple email profile in SQL Server agent jobs?

The SQL Server alert system configuration page (see below image) allows me to choose only a single mail profile. Does that mean I can only use a single email address to send notifications in my SQL ...
Fajela Tajkiya's user avatar
0 votes
0 answers
670 views

Transaction aborted when accessing versioned row in table 'dbo.sysmail_profile' in database 'msdb'

I'm having some problens with SQL Database mail, basicaly anything that I try to do gives me an error like this one below: Transaction aborted when accessing versioned row in table 'dbo....
Igor  Amato's user avatar
0 votes
1 answer
350 views

Failed to initialize sqlcmd library with error number -2147467259

This is my code: SET @msg = 'Customer Voice replies.'; SET @query= 'SELECT [column1],[column2] FROM [StagingMX].[dbo].[_CVA] WHERE DATEDIFF(day, [Completion time] ,GETDATE()) = 1 AND [...
Raúl Vélez's user avatar
2 votes
0 answers
663 views

SQL Server DBMail post 1 October 2022 with Oauth 2.0 requirements

I cannot get a straight answer from anyone on whether or not SQL Server mail will continue to work after 1 Oct with OAUTH 2.0 implementation by Microsoft. From what I understand basic authentication ...
Michael Orechoff's user avatar
0 votes
1 answer
758 views

How to make SQL Server Database Mail use "PLAIN" authentication (instead of "LOGIN" authentication)?

I'm having issues sending Database Mail with "PLAIN" authentication on two different versions MSSQL Server. SQL Server 2012 SQL Server 2019 Context I have created backup jobs which ...
Binarus's user avatar
  • 131
0 votes
2 answers
986 views

Which TLS version is database mail using?

How can we find out which TLS version our database mail is using for sending e-mails? We have issues with database mail (mails are sometimes not sent, even after 10 repeats), and it seems that TLS 1.1 ...
askolotl's user avatar
  • 255
1 vote
1 answer
3k views

SQL Server 2016 O365 SMTP "Failure sending mail" intermittently?

We have had a recurring problem since about October, where our emails through our SQL 2016 database will intermittently fail throwing this error through SQL Server Mail: Message The mail could not be ...
Anon 321's user avatar
4 votes
2 answers
16k views

Database mail trying to send 2 times and then failing

Our database mail was running for 3 years without problems, but since one week, we are often (but not always) getting this error: The mail could not be sent to the recipients because of the mail ...
askolotl's user avatar
  • 255
0 votes
3 answers
361 views

How to set email alerts for high IO errors (sql server error log)?

The sql server error logs show multiple entries with the following keywords: IO taking longer longer 15 seconds I want to setup email alerts for these errors. I have email alerts configured for ...
variable's user avatar
  • 3,634
0 votes
1 answer
351 views

SQL job sending email even if not configured to send notifications

I am using this version of SQL Server. Microsoft SQL Server 2016 (SP2-CU12) (KB4536648) - 13.0.5698.0 (X64) Feb 15 2020 01:47:30 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on ...
Danielle Paquette-Harvey's user avatar
5 votes
3 answers
903 views

SQL Server Logon Trigger Implications - are there any side effects possible in my scenario?

Some of developers on my team know passwords from SQL accounts that have extended permissions We would like to track and be alerted whenever any of developers are using any of those SQL accounts to ...
Aleksey Vitsko's user avatar
2 votes
1 answer
691 views

Send a body HTML > 8000 chars long trough database Mail

UPDATE I dont know why but instead of using the concatenation with the plus sign SET @bodyHTMLBuild = '<html><and more..' + @company + '..more></html>' I have changed to CONCAT set @...
Nestor C.'s user avatar
0 votes
1 answer
836 views

SQL Server Management Send Mail as Part of a Job

I have a SQL Job that I would like to send an email through, but for some reason I can't get any details on why the email is not sending. This code works as expected when executed in the query window, ...
Danchat's user avatar
0 votes
0 answers
203 views

Automate Microsoft SQL Script and send the Result to email

My organization asked me to setup monitoring for below query and the query needs to run every hour(Automated) , if the below query status results other than STARTED or COMPLETED send them as failure ...
phani's user avatar
  • 9
3 votes
2 answers
2k views

Database Mail has incorrect encoding of CSV attachment

I have a procedure that generates a resultset, which I attach as a CSV file attachment in sp_sendmail. However, the resulting file is encoded UCS-2 LE BOM (according to notepad++). This causes the ...
SqlNightOwl's user avatar
2 votes
2 answers
316 views

Updating Database Email Profile for all notifications

I am creating an email profile for database email in a script that needs to be run on 200+ instances. The script will create a database email profile to send out alerts from agent jobs. Is there a way ...
deadLock's user avatar
  • 388
0 votes
3 answers
2k views

SQL Server Agent & sp_send_dbmail failing on permissions

I have set up a SQL Server Agent job to call sp_send_dbmail with a very simple select on a certain table in a certain database. Within the properties > permissions of the target database, the ...
Columbo's user avatar
  • 123
0 votes
1 answer
649 views

Failure sending Excel attachments larger than 1.5MB

I have innumerous reports that I send from SQL Server to people. But for some reason there's this single one, with 10k+ rows, that I can't send via dbmmail. I tried top 7000 and it worked but top 8000 ...
Racer SQL's user avatar
  • 7,386
0 votes
1 answer
472 views

attach csv file on email sent from postgres

I have the following code to send emails and wanted to see if it's possible to attach a csv file? CREATE OR REPLACE FUNCTION public.send_email_html(text, text, text, text) RETURNS integer LANGUAGE ...
Matias's user avatar
  • 141
0 votes
1 answer
980 views

SQL database mail configuration to use a domain account that is not the SQL Service account

We have been asked to use a domain service account for everything releated to email (smtp). I looked at the SQL Database Mail and the only option that looked like Windows Auth. is the first one: The ...
Dominique Boucher's user avatar
0 votes
1 answer
579 views

Why am I getting an email size error with SQL Server database mail? [closed]

I am sending 6 .csv files as attachments through SQL Server Email. But Email is failing with the following message in the database mail log: Exception Message: Cannot send mails to mail server. (...
amanullah's user avatar
0 votes
1 answer
2k views

dbmail failing to send intermittently [duplicate]

We have a SQL Agent job that runs daily that sends emais out to our drivers with their schedules for the next day. For 85% of drivers, the emails are not getting out of the SQL server. The other 15% ...
Spivonious's user avatar
0 votes
0 answers
864 views

Failed sending an email to outlook account using SQL server management studio

I have been trying to send an email to my outlook account using SQL server management studio but keep facing with error like: The smtp server requires a secure connection or the client was not ...
user207025's user avatar
2 votes
0 answers
2k views

Is it possible to use OAUTH2 in MS SQL Server

I am using msdb.sp_senddbmail procedure to send emails from MS SQL Server but now I need to move to OAUTH2. I tried to implement separate application and call it from procedures using xp_cmdshell but ...
1110's user avatar
  • 121
0 votes
2 answers
1k views

Database mail in Azure VM with SQL Server installed on it

We migrated 4 servers with SQL Server instances to Azure VM around 2-3 months ago. We configured "database mail" the same way we did for the on-prem servers. Mail worked fine immediately. All of a ...
Victor Barajas's user avatar
1 vote
2 answers
2k views

SSRS not sending scheduled email to specific contact [closed]

I have a specific contact for my SSRS subscriptions that does not receive any mail from SSRS. her email is an organization email, everyone else including me are getting emails but only that specific ...
sql_girl's user avatar
  • 345
0 votes
2 answers
2k views

msdb.dbo.sp_send_dbmail temp table does not exist

I have created a temp table and would like to email the results I am getting the following error. Query execution failed: Msg 208, Level 16, State 1, Server PRODYCHDBX3\X3V7, Line 1 Invalid ...
JohnF's user avatar
  • 3
0 votes
0 answers
156 views

xp_sysmail_activate

There are multiple instance that whenever I am seeing xp_sysmail_activate running in SQL Server, DB performance is degrading. Whenever I kill the process, the database can't recover and restarting ...
xedarenas's user avatar
0 votes
0 answers
20 views

Need to break up a large file into smaller files to send via sp_sendsqlmail

I have created a job to send a "report" to someone (actually two reports). My issue is that the query is returning some 150K+ rows of data (no lobs or xml or anything, so not large rows), but ...
Eyespi20's user avatar
4 votes
1 answer
15k views

How to properly configure SQL Database Mail to send through an Office 365 SMTP server without using an on-prem SMTP server? [closed]

We used to use SQL Database Mail through an on-prem SMTP server, but have since transitioned to Office 365. I created a new profile for O365 and tried configuring a new account in that profile like ...
J.D.'s user avatar
  • 37.8k
1 vote
0 answers
779 views

Database Mail with SSL (like GMAIL SMTP) not working

Is anybody successful sending email via MS SQL Server Database Mail while secure connection is set ON in account settings? I'm trying different SMTP servers with SSL to set up - like Gmail - and none ...
jericzech's user avatar
  • 945
0 votes
1 answer
3k views

How to solve a mail issue Failed to initialize sqlcmd library with error number -2147467259?

I got an error while trying to send an email: Msg 22050, Level 16, State 1, Line 0 Failed to initialize sqlcmd library with error number -2147467259. Here is my query: DECLARE @Table TABLE ( ...
Rauf Asadov's user avatar
  • 1,273
2 votes
2 answers
2k views

Cannot find Database Mail feature in SQL Server Express 2012 SP1

I need to use SQL Server Database Mail feature in my project. However Database Mail seems not available on my development instance. There should be a 'Database Mail' node in the Object Explorer. In ...
bluearth's user avatar
  • 131
0 votes
1 answer
1k views

How to add multiple query results into one csv file?

By the help of the members of this community I have created a script which shows recent T-log backup for each database in the server. Instead of sp_MSforeachdb I used a customized script written by ...
Rauf Asadov's user avatar
  • 1,273
0 votes
0 answers
95 views

SSIS Export Text in Email

We are receiving emails from this SSIS package and I need to edit the text that is in The EMAIL and not the data exports themselves. I have checked the stored procedures that produce the report code, ...
Muab Nhoj's user avatar
  • 411
2 votes
1 answer
110 views

How to send mail from a restricted SQL Server

I have created an DB refresh job on a pre-prod SQL server, with latest successful Prod backup to refresh pre-prod DB every monday morning. However, i want to send a status mail post refresh. Due to ...
Kris's user avatar
  • 432
0 votes
1 answer
383 views

Send report to email (HTML)

I have a procedure with two temporary tables CREATE TABLE #temp ( databasename VARCHAR(100), objectname VARCHAR(100), index_id INT, indexname VARCHAR(100), ...
disaster's user avatar
-2 votes
1 answer
2k views

Style bodytext while sending email using sp_send_dbmail [closed]

I am working on an email alert in trigger where body text has to be styled like this: Counterparty: a Previous Status: (Any status should be red) New Status: TRDNG OK(Green colored and Bold Upper)...
V_immo's user avatar
  • 103
0 votes
1 answer
78 views

No email alert on Procedure fail

I have configured Database mail and alert, test email is being sent successfully to designated recipient who were part of OPERATORS but I have created an alert on EXECUTE PROCEDURE (exec ...
safi qadri's user avatar
5 votes
1 answer
3k views

Is .NET Framework 3.5 still needed with a SQL Server 2017 installation to utilize Database Mail?

I'm guessing .NET Framework 3.5 is still needed to use Database Mail with SQL Server 2017? As I had to include this on my SQL Server 2016 installs on Server 2016 not that long ago. I was unable to ...
Eric Swiggum's user avatar
2 votes
0 answers
851 views

How to get more details about root cause of failed Database Mail SSL connection

I'm trying to send database mail over SSL/TLS-encrypted SMTP. It works when sending plain text email, but fails when I enable SSL/TLS. The database mail log shows the following error message: Date ...
Hydrargyrum's user avatar
0 votes
0 answers
865 views

how to collect the information provided by tokens in order to troubleshoot failing jobs quickly?

I was working on a way to take advantage of the SQL Server Agent Tokens and Macros because I work a lot with jobs and job steps and sometimes I have to notify different people depending on the outcome ...
Marcello Miorelli's user avatar
0 votes
0 answers
43 views

Database Mail on SQL Server Express 2017 [duplicate]

I followed this article to create a database mail for SQL Server Express 2017. I got it working but before that I had tried to create accounts and different profiles. How I do I list all database ...
Oldtrafford345's user avatar
-1 votes
2 answers
146 views

SQL Server Express 2017 Database Mail Silent error

I have made an installation of a development environment in VMWare that contains: Windows Server 2016 SQL Server Express 2017 The objective is to perform migration tests of a base that is currently ...
jpussacq's user avatar
  • 146
6 votes
2 answers
7k views

What are the sp_send_dbmail return values?

I have an email failing with function return value of '101' and @@error value of '0' (no rows are added to sysmail_allitems). Where can I find documentation on return codes for this function? ...
youcantryreachingme's user avatar
0 votes
1 answer
164 views

INSERT trigger not SELECTing rows

I'm working with a application and I have no control over the application source code, only SQL. The entire process is this: Row inserted via an application Vendor trigger fires and calls an SP to ...
charliesdad's user avatar