Low level explanation of how a message is sent via RSA I understand that RSA encryption uses this formula:

C = M^e (mod N)


public key is e and N

N is pq - p and q are private key.

mod N makes above function one-way - ie cannot be reversed.  Hence given C, e and N, it is not possible (easily) to find M.

Basic idea is that modulo arithmetic on an exponent is a one way function.

The practical bit I am struggling on now is that M (the message) must be a number.  How is the text eg "I love you" converted to a number.  I am looking to understand the basic concepts but also in reality what scheme is used to create a number from the text.  What are the options and what is generally used in practice?  Please explain the mathematics as required.

You could take the byte stream of the text message above:

01001001001000000110110001101111011101100110010100100000011110010110111101110101


and treat as a LARGE binary number.  I guess the numbers would get pretty large like this so probably not the way its done.
How it is done in practice is that no one uses RSA to encrypt messages. They use RSA to encrypt (and sign) an encryption key, and then encrypt the message with the encryption key. They send the encrypted key and the encrypted message to the other party. The other party uses their RSA private key to decrypt the key, then uses that key to decrypt the message. Furthermore, in practice, they also add padding to the key before encrypting it with RSA.

That said, RSA can indeed encrypt any message that is smaller than the modulus N. So, if your byte stream in the question is smaller than the modulus, you can encrypt it with RSA. If the byte stream were larger than N, you could theoretically break it up into smaller messages and encrypt them individually. The problem with this is RSA is deterministic; so you'd have to add some random padding to make it non-deterministic. Typically people just don't bother with RSA for bulk encryption, however.