Send SMS using triggers

  • Please refer to my latest post, which gives brief idea about my problem.

    but please help

     

    An Idea Can Change Ur Life


    Kindest Regards,

    k.sandeep

    An Idea Can Change Your Life

  • Did you notice? This is a forum about transactional SQL.

    What "object of the class" in T-SQL are you talking about?

    _____________
    Code for TallyGenerator

  • Sorry sir, everything i posted was just in haste.

    You see sir, Logic is simple

    1. An interface in VB.net gives data to a table in SQL server, say MsgList.

    2.As soon as the row is inserted a trigger fires.

    3. The trigger will in turn call a procedure.

    4. The procedure can use some stored procedures, which would aid in the purpose.

    BUT THE QUESTION IS WHICH STORED PROCEDURES AND WHAT PARAMETERS AND WHAT ????????? WUD AID?

    PLEASE HELP.


    Kindest Regards,

    k.sandeep

    An Idea Can Change Your Life

  • You can use most carrier's SMTP interface to send SMS messages (they will cut you off if you whack them hard). Naturally you must know the carrier of your target mobile. I have listed a few SMTP interfaces to SMS below. I believe all of them work with <Mobile#>@<SMS-SMTP-Domain> as shown in the sample below:

    SMS SMTP Domains:

    * Alltel  @message.alltel.com

    * AT&T  @mobile.att.net

    * Cingular @mobile.mycingular.com

    * Nextel  @messaging.nextel.com

    * Sprint  @messaging.sprintpcs.com

    * SunCom  @tms.suncom.com

    * T-mobile @tmomail.net

    * VoiceStream @voicestream.net

    * Verizon  @vtext.com

    Add the ap_SendMail proc (add error logic if you like & appropriate grants to the sp_OAx crap), then from your trigger call:

    exec sp_SendMail 'me@here.com', '9995551212@messaging.sprintpcs.com', 'Some Subject', 'Some Message'

    Cheap but effective.

    /*******************************************************************************

    * Name: dbo.sp_SendMail

    * Desc: Sends mail via corporate forewarder without requiring MAPI client

    *-------------------------------------------------------------------------------

    * Notes: Set the @SMTPServer variable to match your installation requirements

    *-------------------------------------------------------------------------------

    * History:

    *   03/31/2005, v1.0.0.1004, P.Bishop, Created

    *******************************************************************************/

    CREATE PROCEDURE dbo.sp_SendMail

      @From varchar(255),

      @To varchar(255),

      @Subject varchar(255),

      @Body varchar(1024)

    AS

    BEGIN

      declare @SMTPServer varchar(255)

      declare @hr int

      declare @iMsg int

      set @SMTPServer = '192.168.0.1'

      exec @hr = master.dbo.sp_OACreate 'CDO.Message', @iMsg OUT

      exec @hr = master.dbo.sp_OASetProperty @iMsg, 'Configuration.fields("<A href="http://schemas.microsoft.com/cdo/configuration/sendusing&quot.Value','2'">http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'

      exec @hr = master.dbo.sp_OASetProperty @iMsg, 'Configuration.fields("<A href="http://schemas.microsoft.com/cdo/configuration/smtpserver&quot.Value'">http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', @SMTPServer

      exec @hr = master.dbo.sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

      exec @hr = master.dbo.sp_OASetProperty @iMsg, 'From', @From

      exec @hr = master.dbo.sp_OASetProperty @iMsg, 'To', @To

      exec @hr = master.dbo.sp_OASetProperty @iMsg, 'Subject', @Subject

      exec @hr = master.dbo.sp_OASetProperty @iMsg, 'TextBody', @Body

      exec @hr = master.dbo.sp_OAMethod @iMsg, 'Send', NULL

      exec @hr = master.dbo.sp_OADestroy @iMsg

    END

    GO

Viewing 4 posts - 1 through 3 (of 3 total)

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