Home Forums SQL Server 2008 SQL Server Newbies How have Trigger's example after insert send to mail on outlook?. RE: How have Trigger's example after insert send to mail on outlook?.

  • An point worth considering here is that sp_send_dbmail is a system stored procedure provided by MS with the product. Customizing it may result in your functionality "just going away" if you upgrade to a newer version or patch it.

    Another possibility is to wrap the sp_send_dbmail proceudre and then call your procedure instead. Then have your wrapper do whatever it is that you need it to do. Example:

    CREATE PROCDURE my_send_dbmail(parameters_supported_by_db_mail)

    AS

    BEGIN

    EXECUTE sp_send_dbmail passed_parameters;

    --do your stuff here

    END;

    Granted, you'd ideally support all the parameters that sp_send_dbmail supports and should pass them to sp_send_dbmail by name, but you'd lower your risk if you upgrade. Just something to consider.