Text Message Control  
 

Short Message Service (SMS) is a text messaging service used by mobile communication devices to exchange brief text messages. Most service providers also provide gateway servers that can be used to send messages to a wireless device on their network using standard email protocols. The Text Message control provides methods that can be used to determine the provider associated with a specific telephone number and send a text message to the device using the provider's mail gateway.

The first step your application must take is to initialize the library, which will load the required system libraries and initialize the internal data structures that are used. If the control is placed on a form, then the container automatically handles the initialization of control. If the control is created dynamically, then your application is responsible for initialization.

Initialize
Initialize the control and load the Windows Sockets control for the current process. If the control is created dynamically using a method similar to CreateObject, then the application must call this method to initialize the component before setting any properties or calling any other methods in the control.

Uninitialize
Unload the Windows Sockets library and release any resources that have been allocated for the current process. This is the last method call that the application should make prior to terminating. This is only necessary if the application has previously called the Initialize method.

Text Messages

Sending a text message is done with a single method call with several optional parameters. By default, messages are sent via an SMTP gateway, however the control was designed to be extensible so that additional methods could be integrated into future versions of the controls. For example, a third-party company may offer a service that allows messages to be sent using HTTP and that can be added as an additional service type.

Message
This property is used to specify the current message text. In most cases, a message should not exceed 160 characters in length, although some service providers may accept longer messages. If a message exceeds the maximum number of characters accepted by a service provider, the message may be ignored or it may be split into multiple messages.

PhoneNumber
This property is used to specify the current phone number for the device you want to send a message to. This can be a standard E.164 formatted phone number or an unformatted number. Any extraneous whitespace, punctuation or other non-numeric characters in the string will be ignored.

Sender
This property is used to specify the email address of the sender when the SMTP service is used to send the message. For other service types, this property typically specifies the phone number or shortcode associated with the sender.

Urgent
This property specifies whether a message will be flagged as urgent or not. If this property is set to True, the message will sent with a high priority. Note that this does not guarantee the message will be received any differently than a standard text message. Each wireless service provider may handle urgent messages differently, and some providers may simply ignore the message priority.

SendMessage
This method is used to send a text message. It accepts one or more optional parameters that can specify the sender, recipient and content of the message, or if no parameters are specified, will use the PhoneNumber, Sender and Message property values.

Relaying Messages

When a text message is sent using the SMTP service, the default action is to attempt to connect directly to the wireless service provider's gateway server. However, many residential Internet service providers (ISPs) do not permit their customers to connect to third-party mail servers and will block the outbound connection. Some wireless service providers may also reject messages that originate from residential IP addresses.

To resolve this issue, the developer should allow the user to specify an alternate mail server that will relay the message to the wireless service provider. For residential users, this will typically be the mail server provided by their ISP. For business users, this will usually be their corporate mail server. The ServerName and ServerPort properties are used to identify the relay server, and the UserName and Password properties provide the credentials to authenticate the client session.

Relay
This property is used to determine if the control will send the message directly to the wireless service provider's gateway server, or if the message will be relayed through another mail server.

ServerName
This property is used to specify the host name or IP address of the server that will relay the message.

ServerPort
This property is used to specify the port number that will be used to establish the connection with the relay server. For SMTP servers, this would typically either be port 25 or port 587.

UserName
This property is used in conjunction with the Password property to authenticate the client session. If the message is being sent using SMTP, this would typically be the user name or email address of the person sending the message.

Password
This property is used in conjunction with the UserName property to authenticate the client session. If the message is being sent using SMTP, this would be the password associated with the user name.

Service Providers

When a service provider is mentioned in the documentation, typically it is referring to the wireless service provider (also commonly called a "carrier") that is responsible for providing network access for the mobile device. These are identified by name, such as "Verizon Wireless" and "AT&T Mobility". The control has a built-in table of known providers in North America, and can return this information to your application. Note that in some cases, a service provider may also refer to a specific service used to send a text message.

Provider
This property the preferred wireless service provider associated with the current phone number. Changing the value of this property will change the preferred wireless service provider. If this property is an empty string, the default provider assigned to the recipient's phone number will be used.

ProviderCount
This property returns the number of wireless service providers supported by the control. This property is used in conjunction with the ProviderName property to enumerate all of the supported service providers.

 ProviderName
This property array returns the name of supported wireless service provider and is used in conjunction with the ProviderCount property to enumerate all of the supported service providers. Typically this done to populate a user-interface control that enables the user to select a preferred service provider.

GetAddress
This method can be used obtain the email address for the wireless service provider's gateway that is associated with a phone number. This is done by sending an query to a server that will check the phone number against a database of known providers and the phone numbers that have been allocated for wireless devices.

GetProvider
This method can be used to obtain the name of the service provider associated with a phone number. This is done by sending an query to a server that will check the phone number against a database of known providers and the phone numbers that have been allocated for wireless devices.