Link to home
Start Free TrialLog in
Avatar of mucicid
mucicidFlag for Indonesia

asked on

SMS Component for delphi

hi there... are there any component, vcl, library or somehing to send sms from delphi. im using a library for .net currently buy it have problem running on windows 7 so im planing to rewrite on delphi. an open source would be very gladful but pay software is okay. Thank you very much
Avatar of ebob42
ebob42
Flag of Netherlands image

You typically need an account to send SMS messages - this is not free. There are several places where you can get an account, and then use an API to send SMS messages. The API is typically exposed via the web, as a SOAP, REST or plain HTTP service. I've written an article that shows code snippets to connect to two different SMS providers using Delphi for Win32 as well as Delphi for .NET code.

See http://www.drbob42.com/sms/ for my website on SMS sending with Delphi, using Kapow! or Molly as providers (but there are several more, no doubt).

Here's an example of the Delphi code to call the API, taken from the article at http://www.drbob42.com/examines/examin97.htm


    function SendSMS(const Username, Password, Originator, Recipients,
      Message: String; Gateway: integer = 1): String;
    const
      URL = 'http://www.mollie.nl/xml/sms/?username=%s&password=%' +
            's&originator=%s&recipients=%s&gateway=%d&message=%s';
      ResponseSize = 1024;
    var
      hSession, hURL: HInternet;
      Request: String;
      ResponseLength: Cardinal;
    begin
      hSession := InternetOpen('DrBob42', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
      try
        Request := Format(URL,[Username,Password,Originator,Recipients,Gateway,HttpEncode(Message)]);
        hURL := InternetOpenURL(hSession, PChar(Request), nil, 0,0,0);
        try
          SetLength(Result, ResponseSize);
          InternetReadFile(hURL, PChar(Result), ResponseSize,
            ResponseLength);
          SetLength(Result, ResponseLength)
        finally
          InternetCloseHandle(hURL)
        end
      finally
        InternetCloseHandle(hSession)
      end
    end;

Open in new window

Avatar of mucicid

ASKER

wow... thanks ebob42, i shuld try that. but what i need know is send sms trough a gsm modem. how about that ?
Ah, sorry, I didn't realise that's what you were looking for. I don't know how to use a gsm modem, sorry. I've used the SMS gateway services for many years now, much easier ;-)
Avatar of mucicid

ASKER

its ok... i've got a new idea from you anyway. can i receive sms using your that molie service ?
You can specify a number that they can use to answer to (you can even specify a name of some other string as "sender"), so they can answer to it.

There is no API from mollie to receive SMS messages, but there are other services that can help with that. I typically send the SMS messages to my own phone to let myself know that someone purchased another book or license from me while I was away (on holiday for example).
ASKER CERTIFIED SOLUTION
Avatar of amagabar
amagabar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mucicid

ASKER

thanks this is very helpful.