質問

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?

役に立ちましたか?

解決

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.

他のヒント

Database Mail is not meant for any sort of user or event driven stuff.

You can have a webservice to periodically check the bcp import status (log it to a queue table ) and based on that you can have have a success or failed status. If it is success then show the above fields that you want user to take action.

Remember : Event driven process is complicated, but if you build it right, it can free up a lot of manual hours.

You can use PowerShell or Python depending on what you are comfortable.

As far as I know, you are correct that this is not possible with the built in mail system of SQL Server.

It sounds like you may want to build a GUI to facilitate the next steps for the user after the bulk import is finished and they are notified.

ライセンス: CC-BY-SA帰属
所属していません dba.stackexchange
scroll top