SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How have Trigger's example after insert send to mail on outlook?.


How have Trigger's example after insert send to mail on outlook?.

Author
Message
Satnam Singh
Satnam Singh
SSC Eights!
SSC Eights! (974 reputation)SSC Eights! (974 reputation)SSC Eights! (974 reputation)SSC Eights! (974 reputation)SSC Eights! (974 reputation)SSC Eights! (974 reputation)SSC Eights! (974 reputation)SSC Eights! (974 reputation)

Group: General Forum Members
Points: 974 Visits: 1084
I hope this helps.

http://www.sql-server-performance.com/2010/dml-triggers-multiple-triggers/

With Thanks,
Satnam
Andrew G
Andrew G
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4025 Visits: 2279
Hey seiyak2009, what happens when the business just decides to record the oil price every 5 seconds due to a new fast trading platform introduced at the company? Your trigger is now sending thousands of emails crashing both SQL and the Exchange server.

Don't send emails from triggers. Use a procedure which can be configured for a set time interval to check the oil price table, then generate an email. (I'd also hesitate sending any non critical alert emails from SQL itself. Business functionality should not be built in the data layer.)
seiyak2009
seiyak2009
SSC Rookie
SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)

Group: General Forum Members
Points: 26 Visits: 6
Thank you all topic, If example trigger send mail ?.
Please, I want send mail if insert table data auto with trigger.
I educate on web applier develop but can't send mail.
Please help me.
Thank you.
Ed Wagner
Ed Wagner
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47981 Visits: 10844
Anthony is right - please look at the MSDN page for how to execute the sp_send_dbmail procedure. He gave you a link to the page. This is one of those things were it's better to teach someone how to fish instead of just giving them a fish. The reasons are:

1. MSDN is a great resource for SQL Server syntax and what what accepts what parameters. If you don't use it already, you should start getting used to it with something simple. Then when you have to use it for something more difficult, you'll be able to.
2. It appears that if we just post the code using your parameters, you'll just copy and paste it without understanding how it works, which is never advisable in a production environment. You are going to have to support the code, so you should always understand how it works.

You're going to want to pass your parameters to the procedure when you execute it. Sorry if I'm being a pain here. You don't have to read the whole MSDN page, but it would help you understand how it works.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
pinakid4u
pinakid4u
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 0
would this code runs on mysql successfully, please help me.
Jan Van der Eecken
Jan Van der Eecken
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3235 Visits: 6497
pinakid4u (6/3/2013)
would this code runs on mysql successfully, please help me.


No.

Please, remember this is an MS SQL forum. You better ask this question on a MySQL forum in order to get a more informed reply.

--------------------------------------------------------------------------
A little knowledge is a dangerous thing (Alexander Pope)

In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)
Lowell
Lowell
SSC Guru
SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)SSC Guru (70K reputation)

Group: General Forum Members
Points: 70836 Visits: 40924
because my Google-Foo is strong, I Gave "mysql send email" a try.

That lead me to a link on the MySQL forums, and a subsequent link to a Visual Studio project someone posted as an example.
While that uses really old style CDO, you could easily adapt it to use the more updated methods in .NEt, which are really easy to use via a programming language.

Dim message As New System.Net.Mail.MailMessage(strFrom, strTo)
message.Subject = ""
message.Body = Me.txtPhoneMessage.Text
message.IsBodyHtml = False

Dim emailClient As New System.Net.Mail.SmtpClient(strSMTPServer)
Dim SMTPUserInfo As New System.Net.NetworkCredential(strSMTPUser, strSMTPPass)
emailClient.UseDefaultCredentials = False
emailClient.Credentials = SMTPUserInfo
Try
emailClient.Send(message)
Catch ex As Exception
MsgBox(ex.Message)
End Try



http://forums.mysql.com/read.php?99,33635,258189#msg-258189

For anyone interested, I have created a c++ user defined function that can send mail without having to have SMTP installed on the server. It uses Microsoft's CDO to relay via any SMTP server.

Usage:
Compile this project (http://www.divshare.com/download/7121306-6e1) using Visual Studio Express and place the DLL in the /lib/plugins directory. In MySQL;
create function SendMail returns string soname 'SendMail.dll';
select SendMail('to@address','from@address','Subject','Message','smtp.domain');



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!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search