Saturday, February 25, 2012

Database Mail Works Locally but not from Web

I'm building a web site in Visual Web Developer Express on a SQL Server 2005 Developer Edition database, on XP Pro with IIS 5.1 up and running.

Database Mail is configured and works well from the VWD environment. I can launch the site locally from VWD and the stored procedures that call the database mail functions execute perfectly.

However, when I copy the site from the development folder under VWD to my IIS default web page, nothing is ever generated from database mail. I can open the site in IIS and everything looks like it's responding correctly (data updates, refreshes etc) but the behind-the-scenes processes that should be generating email traffic don't do anything.

Review of the database mail log through SQL Server Management Studio shows no activity at all during the timeframe of the "on line" IIS sessions, so it appears that the process isn't hearing anything calling it (or is ignoring the calls if they are happening).

Why would it work in one environment and not another on the same machine? Is there a setup configuration or permissions issue that I've missed somewhere?

Thanks in advance.

I suggest it is a permissions thing. I suggest this is asked in the development forums, in how to conifgure your website to talk to your database with the correct permissions.|||

You were correct, the sp_send_dbmail SPROC used by my stored procedure resides in the MSDB database. The default configuration does not include the ASPNET account with any permissions. Once I found the SPROC and granted Execute permission to ASPNET, everything started working as intended. It's magic!

No comments:

Post a Comment