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?.

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