Sending email and setting calendar from trigger

  • Hi

    I want to create a trigger in my Absence table so when an absence inserted, it sends an email to the employee and set the absence type reminder in his outlook calendar.

    Would you please help me?

    Thanks

  • I wouldn't do this in a trigger.

    Use the trigger to insert into a table then have a scheduled job which polls the table and does the processing when an entry appears.

    In that way you have a record of what's been processed and done hold up/error the system due to email issues.


    Cursors never.
    DTS - only when needed and never to control.

  • Thanks SSC

    But I still do not know how to write the code to make the calendar reminder on the day of absence

  • You will have to look up the format for a calendar entry. This isn't a SQL issue, but rather a mail construction issue. Once you have that, you can construct that and attach it to the mail message.

  • These examples should get you started.

    http://blog.netnerds.net/2008/02/create-a-basic-sql-server-2005-trigger-to-send-e-mail-alerts/[/url]

    http://www.datasprings.com/Resources/ArticlesInformation/CreatingEmailTriggersinSQLServer2005.aspx

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • i thought this was interesting; from what i read on the Wikipedia you have to create a plain text attachment, with specific tags/formats inside that file, and the name of the file ends in .ics

    so you have to create a file as an attachment, and then attach it to the email you were going to send. outlook /thunderbird/whatever mail program which can handle the iCalendar format will interpret the file accordingly.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply