The Bill is a radical revision of sex crime law in Scotland and broadly follows last December's recommendations of the Law Commission of Scotland. Justice Secretary Kenny MacAskill described it as a "once in a generation" opportunity to create a clear legal framework for sex crimes.
The Bill, though, could result in the jailing of people who send text and picture messages with sexual content for up to 10 years. The Bill opens the door to convictions for people whose flirting is ill-judged or goes too far.
The Bill creates a new offence of communicating indecently.
The offence will be committed if someone sends an unsolicited text message to someone else which a court finds was designed to give the sender sexual gratification or to humiliate, distress or alarm the receiver.
Causing a person to see or hear an indecent communication is also an offence. It can be committed by reading "a passage in a book or magazine" or by communicating the sounds of actual or simulated sexual activity or by communicating in sign language.
It will be up to prosecutors and courts to decide which communications are serious enough to warrant the heavy jail terms, but ill-advised flirting or joke messages could come under those definitions and expose senders to the long jail terms.
The Bill also bans the sending of images of a person or an "imaginary person" engaging in sexual activity without the receiver's permission. Again if the court finds that the message was designed to give the sender sexual gratification or humiliate, distress or alarm the recipient then the sender could be jailed for up to 10 years.
That person could be found guilty of another new offence, that of coercing a person into looking at an image of a sexual activity.
The Scottish Law Commission's Colin Tyre told The Scotsman newspaper that the new offences were designed to address a growing problem.
"We wanted to make sure all forms of communication were covered by a single law. Sending offensive e-mails in the workplace has become more common, as have text messages," he said.