How i can send email when a record is inserted into database table.
First/-
user schedule an sql event.
This (script) has created by me.
Second/-
How to notify user when sql event occurs ? Please tell me how to manage this ?
7 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Suraj KumarRank #353 · 7.1K reputationPosted Dec 2, 2018, 7:08 PM EST
✓ Accepted answer+2
You can either create a sql server trigger on that table for sending mail. Another way is to write code just after inserting records into the table for sending email to user. You can also create a sql server job for both the activity.
Below code format is used to send the mail using SMTP
Kashif Ali71 reputationPosted Dec 2, 2018, 8:08 PM EST
0
thank you, I go there Triggers are applicable only for one table or it requires couple of table ?
0
Suraj KumarRank #353 · 7.1K reputationPosted Dec 2, 2018, 8:13 PM EST
0
Triggers are based on single table but you can write your query to affect i.e., update, delete multiple table as well as you can write your select statment joining from several tables in that trigger. Please check these links to know for sending mail using sql server.
Kashif Ali71 reputationPosted Dec 2, 2018, 8:32 PM EST
0
I'm using xamp. (using only for testing scripts) and i want to send email through my purchased hosting service.
I just want when a record inserted (through an event) an email should be sent to some receipts (automatically). Please help me, I'm on final stage of my project. I'm building an task management system.
Some tasks are recurrance so for that i have created event sections, In my webpage, but as you know an event will occur by its scheduled date, a notification should be sent when an will event occur. Please how i can fix this one ?
0
Sourav MukherjeeRank #850 · 2.6K reputationPosted Dec 6, 2018, 11:08 AM EST
0
Hi Kashif, You can use a trigger to notify the moment any record is inserted in the table.
Suraj KumarRank #353 · 7.1K reputationPosted Dec 2, 2018, 7:08 PM EST
Kashif Ali71 reputationPosted Dec 2, 2018, 7:53 PM EST
Event has been created.";
Suraj KumarRank #353 · 7.1K reputationPosted Dec 2, 2018, 7:59 PM EST
Kashif Ali71 reputationPosted Dec 2, 2018, 8:08 PM EST
Triggers are applicable only for one table or it requires couple of table ?
Suraj KumarRank #353 · 7.1K reputationPosted Dec 2, 2018, 8:13 PM EST
Kashif Ali71 reputationPosted Dec 2, 2018, 8:32 PM EST
and i want to send email through my purchased hosting service.
I just want when a record inserted (through an event) an email should be sent to some receipts (automatically).
Please help me, I'm on final stage of my project.
I'm building an task management system.
Some tasks are recurrance so for that i have created event sections,
In my webpage, but as you know an event will occur by its scheduled date, a notification should be sent when an will event occur.
Please how i can fix this one ?
Sourav MukherjeeRank #850 · 2.6K reputationPosted Dec 6, 2018, 11:08 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts