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
1answer
197 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 ...
0
votes
0answers
43 views

Logon Trigger unable to send Email

I have a logon trigger that is designed to block certain logins (like 'Login%', or = 'Login1', etc.), if they come from: certain IP certain hosts SSMS Example code can be found here: https://paste....
0
votes
1answer
25 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 ...
0
votes
1answer
36 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 ...
0
votes
0answers
25 views

Send email on postgres function

I'd like to incorporate this command line in a postgres 8.4 version function: echo "this is the body" | mail -s "subject" -r sender@sender.com "recepient@recepient.com" ...
0
votes
1answer
48 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. (...
0
votes
0answers
29 views

SQL Trigger fails retrieve new record in second query

Any advice on this will be appreciated This script created a table with new records. My script is failing to assign the "Inserted" ID to the query but manually assigning a value works (a) ...
0
votes
0answers
23 views

Blocking task report is showing false positive

Here is the code I am using to send email alerts. It seems to send more false +ves, can anyone guide me how to resolve this ? DECLARE @Waiting INT; DECLARE @Message NVARCHAR(MAX); SELECT @Waiting =...
0
votes
1answer
44 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% ...
0
votes
0answers
85 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 ...
0
votes
0answers
105 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 ...
0
votes
2answers
249 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 ...
1
vote
2answers
143 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
2answers
381 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 ...
0
votes
0answers
63 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 ...
3
votes
1answer
2k 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
vote
0answers
158 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
1answer
332 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
327 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
243 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
27 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, ...
2
votes
1answer
77 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 ...
0
votes
1answer
84 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), ...
-2
votes
1answer
92 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)...
0
votes
1answer
44 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 ...
6
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 ...
2
votes
0answers
276 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
230 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 ...
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
101 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 ...
5
votes
2answers
3k 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
77 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 ...
2
votes
1answer
488 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 ...
2
votes
1answer
862 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
3answers
137 views

User response to Database Mail

I'm doing some high level planning of an application at the moment. When a bcp import finishes, I'm going to send an email using Database Mail. I'd like the email to have options or filters for the ...
4
votes
1answer
771 views

How to send secure emails using sp_send_dbmail

When using sp_send_dbmail to send an email on SQL Server, how do you specify that the email be sent in an encrypted format? I found a thread discussing including the string "[SECURE]" in the subject ...
0
votes
1answer
79 views

Database Mail works in Production but not in Test Database

I have a Production database that is able to send mail. And a Test that is not able to. They are both on the same SQL Server. The error is (SQL Server 2008): Msg 229, Level 14, State 5, Procedure ...
-1
votes
1answer
52 views

Queries involved in deadlock [duplicate]

Is it possible to send queries involved in a deadlock via db mail alert in SQL Server 2005 on mail? If it is possible, then what is the best way to do this?
0
votes
0answers
376 views

Schannel 36871 Error when sending emails from Database Mail - after upgrading to SQL Server 2016

I have recently upgraded from SQL Server 2014 ENT to 2016 ENT, and now I cannot send emails from Database Mail. I get the usual The mail could not be sent to the recipients because of the mail ...
0
votes
1answer
43 views

Mail Alert when threshold of 10000 pendingcmds are breached

I currently have the below running to monitor replication and send a mail when the threshold of 10000 pendingcmds are breached, however the alert mail is generated every 5 minutes regardless of the ...
0
votes
1answer
497 views

Database Mail Configurations using gmail account

After creating a profile and account using gmail account smtp.gmail.com port 587 I get an error while trying to send a test email The mail could not be sent to the recipients because of the mail ...
2
votes
2answers
1k 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 ...
1
vote
0answers
207 views

Oracle Apex IR subscription not working

I have configured apex instance to use smtp email, and I can send email with IR when using download option from action menu. But the IR subscription is not sending emails. I have checked there is no ...
0
votes
1answer
462 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 ...
0
votes
1answer
1k views

Difference Between Database Mail Profile and SQL Server Agent Operator in MS SQL Server

I have configured Database Mail profile with several accounts. In the SQL Server Agent Properties I've enabled my profile. If I specify whom to send email with Database Mail profile, why do I need to ...
1
vote
0answers
147 views

SQL Server Agent Alert does not pick up some of Events from Application Log written by SQL Server Audit

My end goal is to be emailed when new object (schema, table, procedure etc.) is created / altered / dropped at one of my databases on SQL Server I created a server-level audit, that writes to Windows ...
9
votes
3answers
9k 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, ...
0
votes
1answer
50 views

job send email to developers upon complexion and include DBAs if it fails

I have a job that sends an email to an operator (which contains a list of emails within it) upon complexion. Some of these people that are on that list are the developers who build everything in that ...
0
votes
2answers
933 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, ...