The code I use to slice the mail body to fixed length chunks that are forwarded to my GSM phone as SMS messages. Of course, the mail gets filtered first...
$max_len = 140; use POSIX; @chunks = unpack("A$max_len" x (ceil(length($message)/$max_len)), $mes +sage);