≡ Menu

Creating a Simple Program Sending SMS with VB6 and Gammu

I would love a simple example program to create Sending SMS using VB6, Gammu and MySQL database

Maybe you have to know and have already discussed about this, but just sharing it. For that use PHP, JAVA and others may have a lot, I try to use VB6. If later I add a lot of other interests.

combat equipment provided:
– Software VB6 course
– ODBC Driver (preferably the latest version 5.1) on the download here:


– Web servers, I use XAMPP. The others are also biased for example WAMP:


– Gammu Can be downloaded here:


– Mobile of course (or another modem that supports Gammu). I use a Siemens C55 (Can not be in donlot but must buy)

The steps are:
1. Install VB6, when it passed
2. Install Web Server, for example, had XAMPP
3. Install gammu / If it can be a ZIP donlot it, put it in Drive for example C:, instead of the folder so gammu. (let’s just been finished and is on C:gammu)
4. Find the file gammurc and smsdrc in C:Gammusharedocgammuexamplesconfig
5. Edit gammurc and smsdrc using notepad or another text processing.

In this fox gammurc file:

device = com3: (change it to your modem/mobile phone port)
connection = at19200 (adjust with your modem/mobile phone)

In smsdrc file, change this

port = com3:
connection = at19200
service = MYSQL
user = root
password =
pc = localhost
database = sms


devices and ports: depending on your modem port
Connection: depending on your modem connection/mobile phone

6. copy files gammurc and smsdrc into the folder


7. run XAMPP-Control, click Start on Apache, click Start on Mysql
8. in the browser type http://localhost/phpmyadmin, create a database with the name of an sms, then IMPORT mysql.sql file located in


and click GO

9. Install ODBC Driver, if it is finished go to Start -> Settings -> Control Panel -> Administrative Tools -> Data Sources (ODBC), the DSN Users click ADD.
10. The contents of the Data Source name for example SMSX, Server: localhost, port: 3306, user: root, Password blank), Database: sms

Now living a try:

1. Click Start -> Run, type CMD, on the CMD console, type:


2. To check the modem / mobile phone already are connected anything yet type: gammu identify
3. If you are connected gammu run its service, type:

gammu-smsd-i-c smsdrc

It is finished, the next stage live insert script below to Visual Basic (VB) 6, or the source can be downloaded here:

Source Code: http://www.4*shared.com/file/U-BoUo2J/smsvb.html

Source code form1:

Private Sub Command1_Click()
   Dim RS As ADODB.Recordset
   Set RS = New ADODB.Recordset
   Dim SQL As String
   SQL = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID) VALUES ('" & Nohp.Text & "','" & Pesan.Text & "', 'Gammu')"
   RS.CursorLocation = adUseClient
   RS.Open SQL, conn, adOpenDynamic, adLockOptimistic
   MsgBox "Pesan telah dikirim", vbOKOnly, "Kirim"
End Sub

Source code module1:

Public Sub Koneksi()
   On Error GoTo elor:
   Dim filename As String
   Dim Server, Uid, Psw, Db As String
   Set conn = New ADODB.Connection
   conn.ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;UID=root;PWD=;DATABASE=sms;" _
   & "OPTION = " & 1 + 2 + 8 + 32 + 2048 + 163841
Exit Sub
   MsgBox " Error Koneksi ke MySQL" + Chr(13) + "Pesan Error: " + err.Description, vbCritical, "Error"
End Sub

Hopefully useful. Please corrected if there is something wrong with Creating a Simple Program Sending SMS with VB6 and Gammu
source: tipayun

{ 3 comments… add one }
  • Denovez June 22, 2011, 6:51 pm

    thanks its work.
    please upload for auto response with visual basic 🙂 or reading inbox gammu.

  • dankrez August 1, 2011, 12:36 am

    mas asep,,,
    ga ada eror sama sekali, mysql lancar, kesimpen di database
    di vb smsnya terkirim
    tapi, kok di hp yang sebenarnya (alamat tujuan) gak diterima sms yah?

  • Yusrizal Siregar November 5, 2013, 6:05 pm

    Pagi pak,

    Saya sudah ikuti petunjuk satu persatu, service juga sudah saya buat dan gammu-smsd.exe sudah running, tapi SMS tidak terkirim, saya lihat di database sms pesan yg dikirim sudah masuk ke table outbox.

    Saya sudah coba kirim menggunakan +62 dan tanpa kode negara.

    Saya menggunakan Windows 7 32bit dengan modem Wavecom M1206B.

    Terima kasih atas waktunya.

Leave a Comment