You are on page 1of 2

You can send an SMS by keying in the destination phone number and text message.

If you want to send a message in your native language (Unicode), you need to check in
Send as Unicode(UCS2). GSMComm object comm has a SendMessage method which will
be used for sending SMS to any phone. Create a PDU for sending messages. We can
create a PDU in straight forward version as:

Hide Copy Code


SmsSubmitPdu pdu = new SmsSubmitPdu 
        (txt_message.Text,txt_destination_numbers.Text,""); 

An extended version of PDU is used when you are sending a message in Unicode.

Hide Shrink Copy Code


 try 

    // Send an SMS message 
    SmsSubmitPdu pdu; 
    bool alert = chkAlert.Checked; 
    bool unicode = chkUnicode.Checked; 
 
    if (!alert && !unicode) 
    { 
        // The straightforward version 
        pdu = new SmsSubmitPdu 
        (txt_message.Text, txt_destination_numbers.Text,""); 
    } 
    else 
    { 
        // The extended version with dcs 
        byte dcs; 
        if (!alert && unicode) 
            dcs = DataCodingScheme.NoClass_16Bit; 
        else 
        if (alert && !unicode) 
            dcs = DataCodingScheme.Class0_7Bit; 
        else 
        if (alert && unicode) 
            dcs = DataCodingScheme.Class0_16Bit; 
        else 
            dcs = DataCodingScheme.NoClass_7Bit; 
 
        pdu = new SmsSubmitPdu 
        (txt_message.Text, txt_destination_numbers.Text, "", dcs); 
    } 
 
    // Send the same message multiple times if this is set 
        int times = chkMultipleTimes.Checked ? 
                int.Parse(txtSendTimes.Text) : 1; 
 
    // Send the message the specified number of times 
    for (int i=0;i<times;i++) 
    { 
        CommSetting.comm.SendMessage(pdu); 
        Output("Message {0} of {1} sent.", i+1, times); 
        Output(""); 
    } 

catch(Exception ex) 

    MessageBox.Show(ex.Message); 

 
Cursor.Current = Cursors.Default; 

You might also like