Example #1
0
        /// <summary>
        /// Sends a binary SMS message to the specified address with the specified provider specific options.
        /// </summary>
        /// <param name="destination">Address of recipient.</param>
        /// <param name="message">Binary representation of message contents.</param>
        /// <param name="providerData"></param>
        /// <returns>An identifier for the message which can be used to check the status.</returns>
        public int SendMessage(SmsAddress destination, byte[] message, ProviderSpecificData providerData)
        {
            int messageid = 0;

            int result = SmsSendMessage(m_handle, null, destination.ToByteArray(), null, message, message.Length, providerData, TextProviderSpecificData.Length, DataEncoding.Optimal, 0, ref messageid);


            if (result != 0)
            {
                throw new ExternalException("Error sending message");
            }

            /*string headerbytes = "";
             * int headerlen = ((TextProviderSpecificData)providerData).HeaderDataSize;
             *
             * byte[] header = ((TextProviderSpecificData)providerData).HeaderData;
             * for(int ibyte = 0; ibyte < headerlen; ibyte++)
             * {
             *      headerbytes += header[ibyte].ToString("X") + "|";
             * }
             * System.Windows.Forms.MessageBox.Show(headerbytes);*/

            return(messageid);
        }
Example #2
0
 /// <summary>
 /// Sends a text SMS message to the specified address with the specified provider specific options.
 /// </summary>
 /// <param name="destination">Address of recipient.</param>
 /// <param name="message">Message body as a string.</param>
 /// <param name="providerData">Provider specific options.</param>
 /// <returns>An identifier for the message which can be used to check the status.</returns>
 public int SendMessage(SmsAddress destination, string message, ProviderSpecificData providerData)
 {
     return(SendMessage(destination, System.Text.Encoding.Unicode.GetBytes(message), providerData));
 }