Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with sending notification emails from SQL Server 2008

I have a problem setting up email notifications in SQL Server 2008.

I am using SQL Server 2008 to build a data cube. This process consists of several jobs, that are all scheduled to run each night at a specific time. To see whether a job was running without any failure, it is possible to set up email notification.


(source: smilinginthesun.de)


(source: smilinginthesun.de)

Unfortunately, no email is sent even though I think I have set up database mail correctly.

All guides I can found just explains, how to set up database mail (eg. http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/), but thats it.
If I sent a mail to test functionality (via test email button or from T-SQL script) it works just fine and the email arrives. But when using the notification feature in a job, it doesn't even create a sysmail_mailitems or sysmail_log entry.
I have also send an email using sp_notify_operator, successfully. So the operator set up seems to work, too. (Thanks, Joe Stefanelli, for the hint.)

There is a great workaround written for SQL Server 2005, that works for me, too: http://www.howtogeek.com/howto/database/sending-automated-job-email-notifications-in-sql-server-with-smtp/, but why isn't it possible to just use that build-in functionality?

Does anyone knows if there is anything else to do, to make that email notification task work properly? Thanks in advise.

like image 800
Jan Avatar asked Oct 04 '10 14:10

Jan


People also ask

How can I send email from SQL Server?

Using Object Explorer in SQL Server Management Studio, connect to an instance of SQL Server Database Engine where Database Mail is configured, expand Management, right-click Database Mail, and then select Send Test E-Mail.


1 Answers

I am late but I saw your post having the same problem.

The solution is to enable a mail profile for alerts.

For this:

  1. Right click on "SQL Server Agent"
  2. Then "Properties".
  3. Then go to "Alert System" section.
  4. Tick the "Enable mail profile" box.
  5. Then "OK".
  6. Restart the SQL Server Agent service.
like image 50
ZeuG Avatar answered Sep 25 '22 23:09

ZeuG