Using the filters message, message_start, and sender

The recommended filters are called subject and content. However, there are three other types of filter that you may also want to use.

The Listener translates non-printable characters in a message to a tilde (~) so if there are non-printable characters, the filter must also use tildes.

  • message   compares the entire message to text you specify. To match, this filter must also be the exact same length as the message. You can specify only one message per message handler.

    The format of messages is carrier-dependent, and you must account for this if you use the message, message_start, or sender filters. For example, you may want to match a message from a sender named Bob@mail.com with the subject Help and the message Me. In UDP, this would appear as [Help]Me. On Bell Mobility's email to SMS conversion service, it would be Bob@mail.com[Help]Me. On Fido's email to SMS conversion service, it would arrive as Bob@mail.com\n(Help)\nMe, but would be translated by the Listener to Bob@mail.com(Help)Me. You must test with your carrier to determine the appropriate format, using the dblsn options -v and -m.

  • message_start   compares a portion of the message (from the beginning) to text that you specify. When you specify message_start, the Listener creates the action variables $message_start and $message_end. See Action variables. There is a maximum of one message_start per message handler.

  • sender   is the sender of the message. You can only specify one sender per message handler. For UDP gateways, the sender is the IP address of the host of the gateway. For SMS email, the sender is the email address embedded in the beginning of the message if the SMS format is compatible with server-initiated synchronization. Otherwise, the sender information is not available.

Multiple message handlers may be required

Subject and content are the recommended filters when messages arrive in a compatible format. However, if your message format is incompatible, you need to use the message, message_start, and/or sender filters. In that case, if the delivery path can vary (sometimes through UDP and sometimes through SMTP), then you need multiple handlers with different filters.