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
1
vote
1answer
124 views

Big difference between send_request_date and sent_date in sysmail_sentitems after running sp_send_dbmail,

A send DB mail process was executed on Friday: placed on the mail queue at 2016-03-04 12:21:22.937, it wasn't sent until 2016-03-04 16:00:01.000, 1311 seconds later. Usually DATEDIFF(SECOND,...
0
votes
2answers
89 views

db_mail Mail Server Failure

Description/Background: I have spent the last couple of days searching everywhere on the internet and have not managed to find a solution or a proper explanation of my issue. since a couple of weeks ...
1
vote
2answers
57 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 ...
0
votes
0answers
16 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 ...
4
votes
1answer
3k views

SQL Server alerts not sending notification emails to the operator

I have setup few SQL Server alerts and added Operator to notify if any alert occurred. I just noticed that couple of alerts did occurred but we didn't receive any alert email. I did send a test ...
0
votes
1answer
82 views

How to send an email with embedded values

I need to do a stored procedure that sends an email when a value reaches 100 with this wording in the body: "100 daily file downloaded from the user:USERID" where USERID is the user that reached 100. ...
0
votes
2answers
749 views

msdb..sp_send_dbmail does not work with @query only with @body

I'm trying to execute the following: msdb.dbo.sp_send_dbmail --@body='Hi from sql server in a sproc' @query='select 1' ,@recipients='mkohn@***.com' ,@subject = 'Test' When I uncomment @body line, ...
0
votes
2answers
54 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 ...
5
votes
1answer
5k views

NVARCHAR(MAX) string appears to have 6326 characters but won't PRINT them all

I am writing a stored procedure to use the sp_send_dbmail system stored procedure to send an HTML email. I have used this procedure before but have not run into this problem before. I am using the ...
4
votes
1answer
936 views

SSMS Cannot show the editor for this task (Notify Operator Task)

I'm getting an error message whenever I double click on a Notify Operator Task in our Maintenance Plans in SSMS, which says "Cannot show the editor for this task." Property IsMailHost is not ...
3
votes
1answer
2k views

Intermittent errors sending email from SQL Server Database Mail

I've been seeing some SMTP errors in my database mail logs. So I have a set up a test SQL Agent job that runs every ten minutes (it's only action is to SELECT NULL). It is set to send email ...
0
votes
2answers
219 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 ...
1
vote
0answers
98 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 ...
0
votes
0answers
43 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 ...
0
votes
0answers
13 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 ...
2
votes
1answer
496 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 ...
-1
votes
1answer
2k views

Cannot find Database Mail option in My SQL Server 2014

I could not find the Database Mail option in my SQL server 2014 under SQL server instance -> Management. Where can I enable it?
0
votes
1answer
208 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 ( ...
2
votes
2answers
211 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 ...
0
votes
1answer
96 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 ...
0
votes
0answers
25 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, ...
3
votes
3answers
50k views

Execute Sql statement and send result to email

I have to execute SQL statement every day and send result to dba by email.I configured database email. Below is query: SELECT account.accountID, account.name FROM ...
0
votes
1answer
77 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), ...
5
votes
2answers
644 views

The database mail configuration saved into a temp table

I am currently dealing with a bunch of servers and they have different Database Mail Configurations. I can see the Database Mail configuration for each of those servers. I use the following script: ...
2
votes
1answer
72 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 ...
1
vote
1answer
215 views

SQL Server 2016 Cluster - mail works in alerts; sp_send_dbmail dosen't send in jobs

I upgraded from 2008 R2 to a 2016 cluster [Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64)]. We have some scheduled emails that happen from the agent that are reporting success as the ...
9
votes
1answer
4k views

What permissions does the service account need to use database mail?

I have an SQL Server 2012 instance running under a managed service account. I've configured database mail with one account and am trying to send a test email, but I'm getting some errors in the server'...
13
votes
2answers
57k views

sp_send_dbmail stored procedure send with attachment

I've been tasked with sending a small monthly report to for one of my customers. The report has previously been run manually on the instance, the output copied to a spreadsheet and send to the ...
5
votes
3answers
19k views

Create job to send alert using sp_send_dbmail when table value greater than x

PROBLEM The SMScounter.Counter is used to accumulate usage from a service. The service has a programmatic cap of 1000. I would like to alert users when this cap is breached. TABLE CREATE CREATE ...
1
vote
1answer
1k views

How to send big email via procedure sp_send_dbmail?

I need to send emails via MS SQL server. But the problem is that I have too much information to send. Let's say 50-200Kb per one mail. This is HTML formatted reports. For sending, I run ...
2
votes
1answer
2k views

Comprehensive troubleshooting of DatabaseMail

I am having a problem sending email from one of my servers. I want to use DatabaseMail and/or msdb.dbo.sp_send_dbmail I have other production servers that use all the same databaseMail settings ...
0
votes
0answers
28 views

Configure email alert when data comes/insert on table

I have configured Database mail, test email is being sent successfully to designated recipient who were part of OPERATORS but I need to configure email alert when data comes/insert on table "abc" ...
-2
votes
1answer
45 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)...
8
votes
3answers
6k views

Enable TLS 1.2 for SQL Server 2016 database mail

I have been puzzled by this issue for almost 1 week. Hopefully someone in our community has experienced the same issue and already found a solution. So here is my problem: As per our company policy, ...
3
votes
3answers
4k views

SQL-Server login-error of SQL-Server Agent Account

I have to manage a configured SQL-Server version 2005 and have setup Database Mail successfully - test mail works. Also I've changed the agent service to a domain user with (currently) domain admin ...
4
votes
2answers
2k 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? ...
0
votes
1answer
42 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 ...
2
votes
2answers
829 views

Database Mail on Amazon RDS / SQL Server

Since Database Mail is not supported on Amazon RDS with SQL Server, can anyone offer any suggestions on how to send e-mail notifications for failed SQL Server jobs in Amazon RDS? Thanks in advance ...
5
votes
1answer
2k 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 ...
0
votes
1answer
454 views

Send email from SQL Server

I need to send email from SQL Server SP. Until now I used sp_send_cdosysmail. Is it better to use sp_send_dbmail? And the main question - which mail server is used by sp_send_dbmail - is it configured ...
2
votes
0answers
160 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 ...
0
votes
0answers
169 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 ...
1
vote
2answers
387 views

send_db_mail with attachment query can't see user databases

I have a SQL Agent job that calls send_db_mail with the following code: DECLARE @FileName VARCHAR(30) SET @FileName= 'FileName'+CONVERT(VARCHAR(20),GETDATE(),112)+'.csv' EXEC msdb.dbo.sp_send_dbmail ...
0
votes
0answers
36 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 ...
-1
votes
2answers
93 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 ...
1
vote
1answer
2k views

Error when sending email with attachment using SQL Server login

I'm trying to send email using msdb.dbo.sp_send_dbmail by a SQL Server login. It works fine if I'm not attaching anything. But if I attach anything I get the following error: "The client ...
17
votes
4answers
45k views

SQL Server 2016 DB Mail Not Sending

I'm on SQL Server 2016 and having a blast... my DB Mail isn't sending and I'm running out of places to look. I double checked the SQL account permissions to the DBmail executable - it has read and ...
0
votes
1answer
71 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 ...
1
vote
1answer
575 views

how to identify the default mail configurations

In SQL Server, we can setup multiple email configurations out of which only some were set to default. I have tried using the following query to get the list of accounts: select * from msdb.dbo....
2
votes
1answer
354 views

How to send Unicode symbols using SQL Server Database Mail? [closed]

How can I send Unicode symbols using SQL Server Database Mail? My goal is to send a symbol on the subject of an email. Let's say that, for example, I want to send this "🚯 Subject with symbol" on the ...