SQL Server Database Mail – User Response Handling

database-mailsql server

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 recipient. Their choices will determine which particular SQL scripts kick off.

For example:

from: database@mail.com

to: henry@mail.com

Import has completed, would you like to:

+------------+---------+
|  Update    |   Find  |
+------------+---------+

My intuition was that I could make the choices mailto links, to populate the body of a response email. But I haven't been able to find any resources on triggering an alert when receiving an email. In fact, the diagram I found below suggests to me that you actually can't reply to Database Mail:

enter image description here

Has anyone ever worked on a project like this?

Best Answer

Database Mail in itself can only send emails, because it only 'talks' SMTP:

A Database Mail account contains the information that SQL Server uses to send e-mail messages to an SMTP server. Each account contains information for one e-mail server.

(from the documentation)

But (depending on the configuration of your SMTP server), you can use a valid email address within your organization (a user, or a group like info@example.com) as the sender of the email. Then, the receiver can just reply as they would to a normal email.

If you need to make some automated actions based on a reply (such as scheduling another task in the database), you're looking at a (much) more complicated integration, way beyond the scope of Database Mail.