[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3070
  • Last Modified:

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
0
mucicid
Asked:
mucicid
  • 3
  • 3
1 Solution
 
ebob42Commented:
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

0
 
mucicidAuthor Commented:
wow... thanks ebob42, i shuld try that. but what i need know is send sms trough a gsm modem. how about that ?
0
 
ebob42Commented:
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 ;-)
0
Will You Be GDPR Compliant by 5/28/2018?

GDPR? That's a regulation for the European Union. But, if you collect data from customers or employees within the EU, then you need to know about GDPR and make sure your organization is compliant by May 2018. Check out our preparation checklist to make sure you're on track today!

 
mucicidAuthor Commented:
its ok... i've got a new idea from you anyway. can i receive sms using your that molie service ?
0
 
ebob42Commented:
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).
0
 
amagabarCommented:
I think you can use AT Command. Initially, It is a collection of instruction to develop communication between computer-modem. I use nokia 3220 as GSM modem and cable data MA-8620E (usb port). By this way of interfacing, the cable data will convert to serial async communication, thus the data that come from/in handphone can be digest by hyperterminal.
see: http://www.developershome.com/sms/howToUseHyperTerminal.asp

Now, you can use TComport component to create as like hyperterminal in your delphi application.
It's free: http://sourceforge.net/projects/comport/
Finally you can feel free to communicate with your GSM Modem by your delphi program such as: read sms, send sms, phonebook management, calling management etc.

some important AT command:

1.      AT+CGMM      read  number type of your gsm modem
2.      AT+CPBR=3      read data Phone book number 3
3.      AT+CGSN      show IMEI / serial number
4.      AT+CSCS="GSM"; +CMGR= 2      read sms no <index>, CSCS= select char type
5.      Nokia:
ATD[02723113931]; +&c[0]
siemen:
ATD[02723113931]; &c0      to Call a phone number (0272) 3113931.
+&c[0] : carrier always ON
6.      AT+CHUP      Hung up (stop call)
7.      Nokia: AT+CMGL
Siemen: AT+CMGL=4      display all sms that exist in ur hp
8.      AT+CMGD=1      delete SMS number 1
9.      AT+CMGR=1      read SMS indek 1 di memori Hp

below a chunk of my code to send sms with TComport:

procedure TFrmSmsServer3.CBtnSendSMSlClick(Sender: TObject);
var str : string;
begin
 str := 'AT+CMGS=[recipient number]';
 Str := Str + #13#10;
 ComPort1.WriteStr(Str);

// sometime need delay at this steps
 str := MemoContentSMS.Text + #26;
 Str := Str + #13#10;
 ComPort1.WriteStr(Str);
end;

Hope can help you. Bless wishes.
0
 
mucicidAuthor Commented:
thanks this is very helpful.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now