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
26
votes
6 answers

Error: NOTE: Failed to notify 'operator' via email. when trying to send e-mail when job fails

I have a problem with sending notification when the job fails. I created Database Mail Profile and assigned it to SQL Agent and the restarted SQL Agent. When I run a procedure msdb.dbo.sp_send_dbmail the e-mail is being sent. Also when I send a test…
Konrad Z.
  • 1,592
  • 4
  • 20
  • 34
15
votes
1 answer

Scripting setup of database mail

I've used the SQL Server 2008 GUI to set up database mail profiles & accounts on my test server, and I'd now like to duplicate those to our production database. Is there a way to generate a script to do this?
chris
  • 36,094
  • 53
  • 157
  • 237
10
votes
4 answers

How to give access to SQL Server database mail procedures for a Login in a different database?

I'd like to know how to set up permissions within SQL Server to allow my application Login/Role to be able to send email using msdb.dbo.sp_send_dbmail. I have a database MyDb, a user MyUser who is a member of role AppRole. I have a stored procedure…
Rory
  • 40,559
  • 52
  • 175
  • 261
10
votes
1 answer

SQL Maintenance Plan sends mail when no mail configured

I have a Maintenance plan under SQL Server 2008 R2 which runs at midnight. Within this maintenance task, there is no notify operator task. Within the SQL Agent job that executes the maintenance plan, there is no email alert. However, every time this…
9
votes
1 answer

SQL server "Cannot send mails to mail server" "Failure sending mail"

I am using MS SQL Server 2008 R2 SP2 Express edition, 64 bit. I do not have access to the Database Mail setup wizard, but the Binn directory contains DatabaseMail.exe (v10.50.16600.1) and DatabaseMailengine.dll. I found several references to "Cannot…
WeststarEric
  • 321
  • 1
  • 2
  • 12
5
votes
2 answers

Is it a good idea to use Database Mail as an email relay server?

One of our problems is that our outbound email server sucks sometimes. Users will trigger an email in our application, and the application can take on the order of 30 seconds to actually send it. Let's make it even worse and admit that we're not…
Samantha Branham
  • 7,350
  • 2
  • 32
  • 44
4
votes
1 answer

Database mail not working / Nothing in queue or log

After configuring database mail on one server and sending a test email, I am finding nothing in the queue or the log. The mail id, however, keeps incrementing with each retry. I have checked the following: I am sysadmin on the box, so I do have…
Mark Wojciechowicz
  • 4,287
  • 1
  • 17
  • 25
3
votes
1 answer

SQL Server DatabaseMail failing very frequently all of a sudden

We have automated emails with attachments sent every day, and it's been this way for years. Last Wednesday the email side of things began failing frequently. If it was failing 100%, it might be easier to troubleshoot. But it seems very miss with…
CCNabey
  • 31
  • 4
3
votes
2 answers

No rows in MSDB.dbo.sysmail_faileditems

Initially I was getting a "no SELECT privilege" error when attempting to query contents for a report I need to create. So we granted DatabaseMailUserRole in MSDB to my account - I see columns, but none of the data we know to exist. What am I…
OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
3
votes
2 answers

How can I set a custom email header when using sp_send_dbmail from MS SQL Server?

I'm currently using T-SQL to send an email with attachment from a stored procedure: EXEC @return_status = msdb.dbo.sp_send_dbmail @profile_name = 'ProfileName', @recipients = @recipients, @body = @mailbody, @subject = @subject, …
Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114
2
votes
1 answer

SQL Server Database Mail with "Modern" authentication to connect to Microsoft 365 / Exchange

In Database Mail, I find this statement: Database Mail is an enterprise solution for sending e-mail messages from the SQL Server Database Engine or Azure SQL Managed Instance. Your applications can send e-mail messages to users using Database Mail…
2
votes
3 answers

Database Mail will not send email to smtp.office365.com

I am using SQL Server 2017, trying to configure Database Mail. If I use smtp.gmail.com Database Mail works fine. However a client is using smtp.office365.com and I cannot get it to work. The error I get is: The mail could not be sent to the…
Clinemi
  • 906
  • 6
  • 20
  • 33
2
votes
1 answer

Getting SQL Database Mail to Format HTML Table with 2 Columns

I'm using SQL Server 2005 and am sending a Database Mail formatted in HTML. I am getting the results I need, but I'm having difficulty formatting the table the way I want it. There are two separate SELECT statements being run that populate the…
TK-42-1
  • 41
  • 1
  • 5
2
votes
2 answers

How to set up access to MSSQL 2005 Database Mail?

I've just setup Database mail within MSSQL 2005. I have been able to send email from an administrator account on the server and through a SQL Server Agent job. But, I unable to send email when I tried to send email via a login that just has access…
Eddie
  • 5,050
  • 8
  • 37
  • 46
2
votes
1 answer

SQL Server Database Mail is sending blank messages when I give it an HTML body

I'm trying to use the SQL Server Management Studio Database Mail to send automated HTML-formatted emails. It works fine when I give it a plain-text body, but as soon as I change it to HTML, the messages are blank. They still send with the proper…
noandpickles
  • 218
  • 2
  • 12
1
2 3 4 5 6 7