views:

556

answers:

2

I would like to send an email from SQL Server 2005 Express using a trigger.

The solutions I have seen use the System Stored Procedures *xp_sendmail* or *sp_send_dbmail*, but these are not available under SQL Express (will only work under full SQL Server).

Any suggestions would be appreciated.

Thanks

+4  A: 

Sending an Email from a trigger sounds like a bad idea.

Why not poll the table and pick up modified records, then send an Email for each new/modified entry?

Leather
While the info about the email in a trigger is informative, it isn't actually useful to his question at hand, which is sending email from Sql Express.
eidylon
The first line of his question is "I would like to send an email from SQL Server 2005 Express using a trigger."I think my answer was pretty relevant to that question.
Leather
Especially when you consider that by informing him that his suggested approach may be flawed it opens the possibility of not sending the Email from within SQL Express at all, but using an external service/component to poll the database and send out mails as required.
Leather
A: 

As Leather said, trying to send an email in a trigger is a bad idea.

While in my opinion upgrading to SQL Standard and using sp_send_dbmail is the best way to send email through a database, I believe you can accomplish what you want to do through the low-fi CDOSYS .

Described here: http://support.microsoft.com/kb/312839

I have not used CDOSYS since SQL 2000 so I don't know for sure that it will be your solution, but it does give you another avenue to learn about sending email pro grammatically.

Gator

related questions