Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

How have Trigger's example after insert send to mail on outlook?. Expand / Collapse
Author
Message
Posted Monday, February 4, 2013 1:06 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, January 6, 2014 1:47 AM
Points: 292, Visits: 1,084
I hope this helps.

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

With Thanks,
Satnam
Post #1415148
Posted Monday, February 4, 2013 1:25 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 18, 2014 11:42 PM
Points: 1,310, Visits: 1,786
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.)
Post #1415155
Posted Monday, February 4, 2013 2:59 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, February 9, 2013 12:24 AM
Points: 4, 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.
Post #1415199
Posted Monday, February 4, 2013 6:41 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: 2 days ago @ 12:28 PM
Points: 4,611, Visits: 4,067
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
Post #1415270
Posted Monday, June 3, 2013 5:54 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, June 3, 2013 5:52 PM
Points: 1, Visits: 0
would this code runs on mysql successfully, please help me.
Post #1459504
Posted Tuesday, June 4, 2013 4:18 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, November 6, 2014 5:01 AM
Points: 2,116, Visits: 6,441
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)
Post #1459644
Posted Tuesday, June 4, 2013 5:15 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:09 AM
Points: 12,962, Visits: 32,500
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1459670
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse