Questions tagged [database-mail]

is a component of Microsoft SQL Server for sending e-mail messages.

Database Mail is a component of Microsoft SQL Server for sending e-mail messages directly from the SQL Server Database Engine.

95 questions
2
votes
1 answer

Database Mail - File Attachment Access Denied

We have a function that uses SP_Send_DBMail. A user that has the DatabaseMailUserRole can send messages, but as soon as he attaches a file from a network share he receives the following error: MSG 22051, Level 16, State 1, Line 0 Failed to open…
2
votes
1 answer

Sql Server 2008 >> msdb.dbo.sysmail_sentitems

Can anyone please tell me the name of Master table used by sqlserver 2008 to store dbmail information? I tried to truncate "sysmail_sentitems" table but it gives me foreign key constraint violation error. Please reply if anyone knows.
priya patel
  • 45
  • 1
  • 5
2
votes
2 answers

Sending Emails From SQL Server 2012 Stored Procedures

We require the ability to sent emails from stored procedures (SQL Server 2012) via SMTP. We need to retain control over the emails "FROM" address and "Display Name" so this I believe rules out Database Mail as these are hard set in the created…
Paul Brown
  • 4,926
  • 9
  • 32
  • 44
1
vote
2 answers

SQL Server to send email notifying of data inserted into table - options?

I have a SQL Server database which is shared between several ASP.NET (VB.NET) websites, the database has a table which stores customer enquiries - I wish to provide email notifications informing of new enquiries to relevent people within the…
1
vote
0 answers

Database email job succeed but no email with attachment received

I have set a databasemail profile on SQL2014, created a job, run it and the job succeed but I don't receive any email with my attachment. Here is my query: declare @clientname as varchar(50) set @clientname = 'ABCD' declare @stagequery as…
1
vote
1 answer

Many KILLED/ROLLBACK tasks running on SQL Server with 0% progress after 2 days

I created a stored procedure which sends an email and accidentally called the stored procedure within itself creating an endless loop. Within a few seconds of executing the stored procedure I realized what I had done and fixed the loop, but it had…
1
vote
1 answer

Sendgrid setup on SQL Database Mail

I have been trying to setup sendgrid on SQL Database Mail but all the time it says Cannot send mail to mail server. This is what i have done. I have sendgrid accound with abc@mydomain.com and created api key and SG.xxxx password. As this is prod…
Aj S
  • 21
  • 4
1
vote
0 answers

If resetting the msdb queue with NEW_BROKER, does DatabaseMail need anything done?

I'm using Event Notifications (sending messages to another server), and to make it easy to set up I built it in MSDB (existing database, already has service broker, etc). However, we wound up with... issues... and now I'm trying to clean up 5…
mbourgon
  • 1,286
  • 2
  • 17
  • 35
1
vote
1 answer

SQL server sending database mail containing data from database

I am in the process of building a holiday tracking website for my company. I'd like to set up an email system for new holiday requests. I have two tables connected with a foregin key. Employee: CREATE TABLE [dbo].[Employee]( [EmployeeID] [int]…
Conor8630
  • 345
  • 1
  • 17
1
vote
1 answer

SQL Server: Email to operator in a stored procedure

Is it possible to send an email to an email operator in a stored procedure? I need to generate an HTML email. I can use sp_notify_operator, but that doesn't seem to have any option to set body_format to HTML and sp_send_dbmail doesn't seem to have a…
Scope
  • 49
  • 7
1
vote
0 answers

"Failed to initialize sqlcmd library with error number -2147024809" error while sending query result via sql database mail

I want to use SQL Server 2014 database mail. I have configured email profile and successfully send emails with fixed text body. Now I try to send query result with email bit I receive Failed to initialize sqlcmd library with error number…
1
vote
1 answer

After renaming SQL Server 2016 cluster there's still a trace of old name from Database Mail

I followed the Microsoft Docs and changed the name of a new SQL Server cluster I built from SQLCLUSTER to SQLFC01. I ensured everything was updated in AD and @@SYSTEMNAME returns the correct 'SQLFC01'. I'm running SQL Server 2016 Standard on SP2 and…
1
vote
1 answer

Only some e-mail gets sent successfully from sp_send_dbmail (Database Mail) on SQL Server 2005

I want to find an answer to what is happening when I use sp_send_dbmail on SQL Server 2005. I have been googeling but without success and I don't know really where to turn now. This is the scenario: I have set up a mail function on our SQL server. I…
user542051
  • 11
  • 2
  • 4
1
vote
1 answer

Calling Powershell script from SQL Server trigger

Is it possible to use powershell "Send-MailMessage -SMTPServer" command from the sql server trigger? I am trying to send emails when the rows in database update or new row created. I am not able to use Database-mail due to security restrictions.…
nPcomp
  • 8,637
  • 2
  • 54
  • 49
1
vote
1 answer

Agent service will not start on 2012 Standard Edition, claiming unsupported edition

This started out as my trying to determine why I wasn't getting emails from a SQL Server 2012 Standard Edition default instance. Agent jobs have been running fine, but the last time anything tried to send email on the server and succeeded was on…
Mark Freeman
  • 1,155
  • 3
  • 24
  • 42