Wednesday, November 19, 2008

SMSing using PL/SQL

1. Compile the below procedure on sql*plus

p_sender IN VARCHAR2,
p_recipient IN VARCHAR2,
p_message IN VARCHAR2
mailcon UTL_SMTP.connection;
mailcon := UTL_SMTP.open_connection ('localhost');
UTL_SMTP.helo (mailcon, 'localhost');
UTL_SMTP.mail (mailcon, p_sender);
UTL_SMTP.rcpt (mailcon, p_recipient);
UTL_SMTP.DATA (mailcon,
'From: '
|| p_sender
|| UTL_TCP.crlf
|| 'To: '
|| p_recipient
|| UTL_TCP.crlf
|| 'Subject: SMS From Database'
|| UTL_TCP.crlf
|| p_message
UTL_SMTP.quit (mailcon);

2. We need to execute the above procedure so as to send SMS. The systax is as follows:

exec SEND_SMS('', '','This is my first SMS');

Note: In place of the '' you need to provide your mobile number. Also please refer to the below list of mobile operator and the area of the service.

Andhra Pradesh AirTel-----------Mobile
Andhra Pradesh Idea Cellular-----Mobile
Chennai Skycell/Airtel------------Mobile
Chennai RPG Cellular-------------Mobile
Delhi Airtel-----------------------Mobile
Delhi Hutch-----------------------Mobile
Gujarat Airtel---------------------Mobile
Gujarat Idea Cellular--------------Mobile
Gujarat Celforce/Fascel-----------Mobile
Goa Airtel-------------------------Mobile
Goa BPL Mobile-------------------Mobile
Goa Idea Cellular------------------Mobile
Haryana Airtel--------------------Mobile
Haryana Escotel-------------------Mobile
Himachal Pradesh Airtel-----------Mobile
Karnataka Airtel-------------------Mobile
Kerala Airtel-----------------------Mobile
Kerala Escotel---------------------Mobile
Kerala BPL Mobile-----------------Mobile
Kolkata Airtel----------------------Mobile No
Madhya Pradesh Airtel-------------Mobile
Maharashtra Airtel-----------------Mobile
Maharashtra BPL Mobile-----------Mobile
Maharashtra Idea Cellular----------Mobile
Mumbai Airtel----------------------Mobile
Mumbai BPL Mobile----------------Mobile
Punjab Airtel-----------------------Mobile
Pondicherry BPL Mobile------------Mobile No
Tamil Nadu Airtel-------------------Mobile
Tamil Nadu BPL Mobile-------------Mobile
Tamil Nadu Aircel-------------------Mobile
UP (West) Escotel-------------------Mobile

1 comment: